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 to install Apache on Linux system

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the Linux system how to install Apache, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Apache is an open source Web server that can run on all used computer platforms and become the most popular web server-side software.

About Apache: Apache HTTP Server (Apache) is an open source web server of the Apache Software Foundation and is the number one Web server software used in the world.

It can run on almost all widely used computer platforms, and is one of the most popular Web server-side software because of its cross-platform and security.

It is fast, reliable and can compile interpreters such as Perl/Python into the server through a simple API extension. Apache HTTP server is a modular server, derived from NCSAhttpd server, after many modifications, it has become the number one Web server software in the world.

Apache is taken from the pronunciation of "a patchy server", which means a server full of patches. Because it is free software, people are constantly developing new features, new features, and fixing old defects for it.

Apache is characterized by simplicity, high speed, stable performance, and can be used as a proxy server.

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 the apache installation directory. If Apr is not installed, an error will be reported:

Checking ``for`` APR... No``configure: error: APR not found. Please read the documentation.3, then install apr, download apr-1.6.3.tar.gz first

4. Upload to server / usr/local/software

Tar-zxvf apr- 1.6.3.tar.gz``cd apr- 1.6.3``.normalre``make``make install will report an error again:

Checking ``for`` APR-util... No``configure: 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.gz`cd apr-util- 1.6.1``./ configure-- prefix=/usr/local/apr-util/-- with-apr=/usr/local/apr will also report an error at this time:

Xml/apr_xml.c:35:19: fatal error: expat.h: there is no interruption in the compilation of the file or directory `accounde`^ ``. ``make: * * [xml/apr_xml.lo] error 17. Guess is a development library that may be missing expat

Yum install expat-devel # will let you type y``./ configure-- prefix=/usr/local/apr-util/-- with-apr=/usr/local/ apr`make # success! ``make install8, go back to install apache at this time, 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 when they came here, but this error is similar to the one encountered before.

Checking ``for`` pcre-config... False`configure: 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 reported an error again, I'm sure this is the last time

Checking windows.h usability... No``bicycle windows.h presence... No```for`` windows.h... No``configure: error: You need a C++ compiler ``for`` C++ support.10, install C++ environment

Yum install-y gcc gcc-c++ ``# wrong so many times, don't forget where you are now, next you still have to install pcre``. / make`make install11, well, after a big circle, next you still have to install apache

Cd.. ``cd apache``. / configure-- prefix=/usr/local/apache2/-- with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/ ``make`make 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_ParserCre collect2: error: ld returned 1 exit status make [2]: * * [htpasswd] error 1 make [2]: Leaving directory `/ usr/local/software/apache/support 'make [1]: * * [all-recursive] error 1 make [1]: Leaving directory `/ usr/local/software/apache/support' this kind of error has not been seen before After a decisive online search, 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.gz``cd apr-util- 1.5.2``./ configure-- prefix=/usr/local/apr-util-1.5/-- with-apr=/usr/local/ apr`make`make install14, 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 files mkdir / usr/local/apache2/conf mkdir / usr/local/apache2/conf/extra mkdir / usr/local/apache2/conf/original mkdir / usr/local/apache2/conf/original/extra Installing HTML documents mkdir / usr/local/apache2/htdocs Installing error documents mkdir / usr/local/apache2/error Installing icons mkdir / usr/local/apache2/icons mkdir / usr/local/apache2/logs Installing CGIs mkdir / usr/local/apache2/cgi-bin Installing header files mkdir / usr/local/apache2/include Installing build system files Mkdir / usr/local/apache2/build Installing man pages and online manual mkdir / usr/local/apache2/man mkdir / usr/local/apache2/man/man1 mkdir / usr/local/apache2/man/man8 mkdir / usr/local/apache2/manual make [1]: Leaving directory `/ usr/local/software/apache15, Enter the configuration file location: / usr/local/apache2/conf

Cp httpd.conf httpd.conf.bak # backup configuration file ``vim httpd.conf`` # uncomment the 191line and modify it to: ``ServerName [your IP]: 80``: wq16, launch 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 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, the original file installation method of`` / / in front of bin is too complicated. In fact, there is another way to install apache service. I don't know if it conflicts with my previous installation. Let's try it today.

Yum source installation mode

1. Yum source installation (network download is required)

First shut down the apache service ``yum install httpd # enter: yResult:

Installed as a dependency:

Apr.x86_64 067.el7.centos.6 mailcap.noarch 1.4.8-3.el7_4.1 apr-util.x86_64 06.el7 httpd-tools.x86_64 1.5.2-67.el7.centos.6 mailcap.noarch 067.el7.centos.6 mailcap.noarch 2.1.41-2.el72, yum is installed at: / etc/httpd/conf, before I enter the backup configuration file, the modification is different from before, at line 95, for reference only

Cd / etc/httpd/conf cp httpd.conf httpd.conf.bak # drop the comment on line 95 and change it to: ServerName [your IP]: 80: wq3, start the service

Systemctl start httpd.service type ip in the browser, and the html preset by apache appears. Perfect!

4. Shut down the service

Systemctl stop httpd.service5, I went to start the httpd installed in the first way again

/ usr/local/apache2/bin/apachectl start refresh browser suddenly appears: It worksinstalled, indicating that there is no conflict between the two installation methods.

Thank you for reading this article carefully. I hope the article "how to install Apache in Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report