Operating system
64-bit CentOS Linux release 7.2.1511 (Core)
Download Apache related software
1.apr and Apr-util,: http://apr.apache.org/download.cgi
2.pcre,:http://www.pcre.org
3.apache,:http://httpd.apache.org/download.cgi
4. Description
Installs Apache, relies on three software: Apr,apr-util,pcre. So these three software must be installed before installing Apache.
Copy to CentOS
[Email protected] ~]# Mkdir/soft
Copy the downloaded four tar packages to the/soft directory of CentOS using WINSCP
Installing other dependent software
Install Apache relies on apr,apr-util,pcre three software, and install these three software, they also rely on other small software, so this time we have to install other small software.
[Email protected] ~]# yum-y install gcc gcc-c++ libtool expat-devel
Extract four Packages
[Email protected] ~]# Cd/soft
[Email protected] soft]# TAR-ZXVF apr-1.6.3.tar.gz
[Email protected] soft]# TAR-ZXVF apr-util-1.6.1.tar.gz
[Email protected] soft]# TAR-ZXVF pcre-8.41.tar.gz
[Email protected] soft]# TAR-ZXVF httpd-2.4.29.tar.gz
Install Apr
[Email protected] soft]# CD apr-1.6.3/
[Email protected] apr-1.6.3]#/configure--PREFIX=/USR/LOCAL/APR
The following error was encountered during compilation:
Rm:cannot remove ' Libtoolt ': No such file or directory
Do not panic, open/soft/apr-1.6.3/configure This file, the $RM "$cfgfile" that line deleted.
and then recompile.
[[email protected] apr-1.6.3]# make && make install
Installing Apr-util
[Email protected] apr-1.6.3]# CD/SOFT/APR-UTIL-1.6.1/
[Email protected] apr-util-1.6.1]#/configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
[[email protected] apr-util-1.6.1]# make && make install
--with represents a dependency relationship
Installing Pcre
[Email protected] apr-util-1.6.1]# cd/soft/pcre-8.41/
[Email protected] pcre-8.41]#/configure--prefix=/usr/local/pcre
[[email protected] pcre-8.41]# make && make install
Installing Apache
[Email protected] pcre-8.41]# cd/soft/httpd-2.4.29/
[Email protected] httpd-2.4.29]#/configure--prefix=/usr/local/apache--with-apr=/usr/local/apr--with-apr-util=/ Usr/local/apr-util--with-pcre=/usr/local/pcre
[[email protected] httpd-2.4.29]# make && make install
Turn on port 80
Open port
Firewall-cmd--zone=public--add-port=80/tcp--permanent
Restarting the firewall
Firewall-cmd--reload
Launch Apache
1. You need to uncomment the ServerName in httpd.conf before starting.
Open/usr/local/apache/conf/httpd.conf, find # ServerName www.example.com:80 This line, delete the #.
2. Launch Apache.
[[email protected] conf]#/usr/local/apache/bin/apachectl start
In the browser address bar type: http://192.168.1.90/, it will be displayed: It works!
Reference address
Http://www.cnblogs.com/carlo-jie/p/6103276.html
Http://www.jianshu.com/p/949350cae1c8
http://blog.csdn.net/lyp256/article/details/55090282
Most of them refer to the first link
Step on the Pit
******************************************************************************
If you encounter the following error, you need to install Expat-devel.
XML/APR_XML.C:35:19: Fatal error: expat.h: No file or directory #include <expat.h>
Cause: Missing Expat-devel Package, install the package: Yum Install Expat-devel
Reference URL: http://www.mamicode.com/info-detail-1950100.html
******************************************************************************
Fix httpd:could not reliably determine the server ' s fully qualified domain name
Open httpd.conf with Notepad
Remove the #ServerName localhost:80 comments from the inside.
And then restart Apache.
Reference URL:
Http://www.cnblogs.com/52linux/archive/2012/03/24/2415637.html
Http://www.cnblogs.com/jkko123/p/6294679.html
******************************************************************************
Install APR error rm:cannot remove ' Libtoolt ': No such file or
Just open the/usr/local/src/apr-1.4.6/configure and remove the $RM $cfgfile.
$RM "$cfgfile" is about 42302 lines
And then run it again./configure--PREFIX=/USR/LOCAL/APR.
Reference Address: http://blog.sina.com.cn/s/blog_6294abe70101b51z.html
Centos7 Installing Apache