Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How linux installs the apache server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to install linux apache server, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Compressed package installation mode

1. Download httpd-2.4.29.tar.gz

2. Upload to server / usr/local/software

Tar-zxvf httpd-2.4.29.tar.gz./configure-- prefix=/usr/local/apache2/ # set up the apache installation directory

If Apr is not installed, an error will be reported:

Checking for APR... Noconfigure: error: APR not found. Please read the documentation.

3. After installing apr, download apr-1.6.3.tar.gz first

4. Upload to server / usr/local/software

Tar-zxvf apr-1.6.3.tar.gzcd apr-1.6.3.configuremakemake install

Will report an error again:

Checking for APR-util... Noconfigure: error: APR-util not found. Please read the documentation.

5. Download apr-util-1.6.1.tar.gz

6. Upload to server / usr/local/software

Tar-zxvf apr-util-1.6.1.tar.gzcd apr-util-1.6.1./configure-prefix=/usr/local/apr-util/-with-apr=/usr/local/apr

An error will also be reported at this time:

Xml/apr_xml.c:35:19: fatal error: expat.h: no compilation break for that file or directory # include ^. Make: * * [xml/apr_xml.lo] error 1

7. Guess that the development library may be short of expat.

Yum install expat-devel # will let you type y./configure-- prefix=/usr/local/apr-util/-- with-apr=/usr/local/aprmake # successfully! Make install

8. When you go back to install apache, you should specify not only the path of apr, but also the path of apr-util

. / configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/

Still reported an error, many people may have collapsed here, but this mistake is similar to the one encountered before.

Checking for pcre-config... Falseconfigure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

9. Download pcre-8.41.tar.gz

10. Upload to server / usr/local/software

Tar-zxvf pcre-8.41.tar.gz./configure

It's wrong again. I promise this is the last time.

Checking windows.h usability... Nochecking windows.h presence... Nochecking for windows.h... Noconfigure: error: You need a C++ compiler for C++ support.

10. Install C++ environment

Yum install-y gcc gcc-c++# has been wrong so many times, don't forget where it is now, and then install pcre./configuremakemake install.

11. Well, after a big circle, the next step is to install apache

Cd.. cd apache./configure-prefix=/usr/local/apache2/-with-apr=/usr/local/apr/-with-apr-util=/usr/local/apr-util/makemake install

How miserable! The last step is to report an error:

/ usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode' / usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler' / usr/local/apr-util//lib/libaprutil-1.so: undefined reference to `XML_ParserCrecollect2: error: ld returned 1 exit statusmake [2]: * * [htpasswd] error 1make [2]: Leaving directory `/ usr/local/software/apache/support'make [ 1]: * * [all-recursive] error 1make [1]: Leaving directory `/ usr/local/software/apache/support'

I have never seen this kind of error report, and I did a decisive online search, and the answer is: the apr version is too high.

So I downloaded apr-util-1.5 http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz

13. Upload to server / usr/local/software

Tar-zxvf apr-util-1.5.2.tar.gzcd apr-util-1.5.2./configure-prefix=/usr/local/apr-util-1.5/-with-apr=/usr/local/aprmakemake install

Repeat step 11, the only difference is that the configuration now specifies: apr-util-1.5, which is very important!

Cd.. cd apache./configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util-1.5/make # make time will be longer make install

Perfect ending:

Installing configuration filesmkdir / usr/local/apache2/confmkdir / usr/local/apache2/conf/extramkdir / usr/local/apache2/conf/originalmkdir / usr/local/apache2/conf/original/extraInstalling HTML documentsmkdir / usr/local/apache2/htdocsInstalling error documentsmkdir / usr/local/apache2/errorInstalling iconsmkdir / usr/local/apache2/iconsmkdir / usr/local/apache2/logsInstalling CGIsmkdir / usr/local/apache2/cgi-binInstalling header filesmkdir / usr/local/apache2/includeInstalling build system filesmkdir / usr/local/apache2/buildInstalling man pages and online manualmkdir / usr/ Local/apache2/manmkdir / usr/local/apache2/man/man1mkdir / usr/local/apache2/man/man8mkdir / usr/local/apache2/manualmake [1]: Leaving directory `/ usr/local/software/apache'

15. Enter the configuration file location: / usr/local/apache2/conf

Cp httpd.conf httpd.conf.bak # backup configuration file vim httpd.conf# release the comment on line 191 and change it to: ServerName [your IP]: 80:wq

16. Start apache

/ usr/local/apache2/bin/apachectl start# or / usr/local/apache2//bin/httpd-k start

Turn off the firewall, enter the server's ip in the browser's address bar and the web page will appear: It works!

17. Close apache

Ps-ef | grep apache/usr/local/apache2/bin/apachectl stop# or / usr/local/apache2//bin/httpd-k stop# Yes, there is / / in front of bin

This way of installing original files is too complicated. In fact, there is another way to install apache services. I don't know if there is any conflict with my previous installation. I also have a try today.

Yum source installation mode

1. Yum source installation (network download is required)

First, during the intermediate process of shutting down apache service yum install httpd #, enter: y

Result:

Installed as a dependency:

Apr.x86_64 0VOR 1.4.8-3.el7_4.1 apr-util.x86_64 0RU 1.5.2-6.el7 httpd-tools.x86_64 0RU 2.4.6-67.el7.centos.6 mailcap.noarch 0Rl 2.1.41-2.el7 over!

2. The installation location of yum is at: / etc/httpd/conf. After I enter the backup configuration file, the modification is different from that before. It is on line 95, for reference only.

Cd / etc/httpd/confcp httpd.conf httpd.conf.bak# drop the comment on line 95 and change it to: ServerName [your IP]: 80:wq

3. Start the service

Systemctl start httpd.service

Enter ip in the browser and the apache preset html appears, perfect!

4. Shut down the service

Systemctl stop httpd.service

5. I will start the httpd installed in the first way again

/ usr/local/apache2/bin/apachectl start

Refresh the browser suddenly appeared: It worksinstalled, indicating that the two installation methods do not conflict.

The above is all about how linux installs the apache server. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report