Apache is the world's most used Web server software. It can run on almost all widely used computer platforms and is one of the most popular Web server-side software due to its widespread use across platforms and security. It is fast, reliable, and can be augmented with simple APIs to compile perl/python and other interpreters into the server.
There are two different ways to install Apache: source code installation and binary package installation. The two types of installation are unique, the binary package installation does not need to compile, and the source code installation needs to be configured to install the installation, the binary package installed in a fixed location, the selection of fixed modules, and source code installation allows you to choose the installation path, choose the module you want. This article mainly introduces the source code installation.
System environment: Red Hat Enterprise Linux 6.5 Primary configuration file: httpd.conf
Get the source code package http://httpd.apache.org/httpd-2.4.23.tar.bz2 http://apr.apache.org/apr-1.5.2.tar.gz Apr-util-1.5.4.tar. Gz
The above three source packages need to be imported into the Linux system before installation
Apache Service Source Installation started
[email protected] ~] #tar XZVF apr-1.5.2.tar.gz-c/opt/
[[Email protected] ~] #tar XZVF apr-util-1.5.4.tar.gz-c/opt/
[[Email protected] ~] #tar XJVF httpd-2.4.23.tar.bz2-c/opt///Unzip the source package
[[email protected] ~] #cd/opt/ & nbsp , &NB Sp //Switch to Source package extract directory
[[email protected] opt] #cp-R apr-1.5. 2/HTTPD-2.4.23/SRCLIB/APR
[[email protected] opt] #cp-R apr-util-1.5.4/httpd-2.4.23/srclib/apr-util //to inject Apr source into the HTTPD-2.4.23/SRCLIB/APR directory
[[email protected] opt]# mount/dev/cdrom/mnt///Mount Yum Warehouse
[Email protected] opt]# Vi/etc/yum.repos.d/rhel-source.repo//Edit Yum repository source via VI Editor
[rhel-source]
name=red Hat Enterprise Linux $releasever – $basearch –source
Baseurl=file:///mnt
enabled=1
gpgcheck=0 &N Bsp , &NB Sp , &NB sp; //Edit finished Wq save exit edit
[[email protected] opt] #cd/mnt , &NB Sp //Build Yum warehouse optimized compilation language
[[email protected] mnt]# yum-y Install \< BR>GCC \
gcc-c++ \
make \
Pcre-devel
[[email protected] mnt]# cd/opt/httpd-2.4.23/
[[email protected] httpd-2.4.23]#./configure \ , &NB Sp //consolidated compiled source
–prefix=/usr/local/apache \
–enable-so \
– Enable-rewrite \
–enable-mods-shared=most \
–with-mpm=worker \
–disable-cgid \
–disable-cgi
[[email protected] httpd-2.4.23]# Yum remove httpd//Uninstall the Web server that comes with the system itself before compiling the installation
[[email protected] httpd-2.4.23]# make//compile
[[email protected] httpd-2.4.23]# make install//compile installation
[Email protected] httpd-2.4.23]# ln-s/usr/local/apache/bin/*/usr/local/bin/ Create a soft link
[[email protected] httpd-2.4.23]# grep-v "#"/usr/local/apache/bin/apachectl >/ETC/INIT.D/HTTPD//Apach ECTL script generates Apache Service control script for template
[[email protected] httpd-2.4.23] #vi/etc/init.d/httpd
Insert the following line at the front of the file so that it supports the Chkconfig command:
#!/bin/sh
# chkconfig:2345 85 15
# Description:apache is a world Wide Web server. Edit Complete Wq Save exit Edit
[Email protected] httpd-2.4.23]# chmod +x/etc/init.d/httpd
[[email protected] httpd-2.4.23]# Chkconfig–add httpd//Add httpd to the Services Manager
[[email protected] httpd-2.4.23]# vi/usr/local/apache/conf/httpd.conf//Edit Apache master configuration file
Just modify the following two lines of configuration
servername localhost.localdomain &NBSP ; , &NB Sp //set to hostname display name
Listen 192.168.10.20:80 , &N Bsp //192.168.10.20 for server IP address
[[email protected] httpd-2.4.23] #service httpd start//Start service
Check that the HTTPD 80 port is listening, if it is not listening, it is the Linux firewall, you can clear the firewall rules to restart the service
[Email protected] httpd-2.4.23]# NETSTAT-ANTP | grep httpd
[[email protected] httpd-2.4.23] #service iptables stop
[[email protected] httpd-2.4.23] #service httpd restart
This article is from the "pain016" blog, make sure to keep this source http://pain016.blog.51cto.com/11970678/1840035
Apache source code compilation installation