The CentOS system is installed with basic Server. There are a number of missing components required before you install Apache, and here's a list of the components that need to be installed
Apache-aprapache-apr-utilperl-pcreapache
Website download Apache, download address: http://httpd.apache.org/download.cgi
Download the stable version of httpd-2.4.9.tar.gz and upload it to the server/usr/packages directory.
Install Apache:
# TAR-XVZF httpd-2.4.9.tar.gz
# cd httpd-2.4.9
#/configure--prefix=/usr/local/apache--enable-module=so- Enable-module=rewrite
Check the compilation Environment for errors:
Checking for APR ... no configure:error:APR not
found. Please read the documentation.
The reason for the lack of APR (Apache portable Runtime) is the need to download Apr and Apr-util.
Download Address: http://apr.apache.org/download.cgi
Download apr-1.5.1.tar.gz, apr-util-1.5.3.tar.gz
Install Apr:
# TAR-XVZF apr-1.5.1.tar.gz
# cd apr-1.5.1 #
. Configure
# make
# make install
Install Apr-util:
# TAR-XVZF apr-util-1.5.3.tar.gz
# cd apr-util-1.5.3
#. Configure--prefix=/usr/local/apr-util--with-apr=/ USR/LOCAL/APR
# make
# make install
Check the compilation environment again for an error:
Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/
Missing pcre, download address: http://sourceforge.net/projects/pcre/
Install Pcre:
# unzip-o pcre-8.35
# cd pcre-8.35
#/configure--prefix=/usr/local/pcre
# make
# make install
When you check the compilation environment again, add the parameters:
--with-apr=/usr/local/apr/--with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre
No error:
Installation completed.
This is my first time to install, the lack of association relationship components, the next installation directly installed components, the final installation of Apache, this will be smoother.
Start Apache
# cp/usr/local/apache/bin/apachectl/sbin/
# apachectl Start
Configure the Apache service to start when the system starts
# vi/etc/rc.d/rc.local
On the last line plus:/sbin/apachectl start
Modify Apache Default Site Directory
modifying/usr/local/apache/conf/httpd.conf files
Change into
Execute command
# apachectl Restart
The Apache configuration file is renewed ~ ~