apache2.4 Installation Method One
The following is a list of my installation records for today. System: Centos6.2 X64 httpd 2.4.1
1. Download package, wget http://apache.etoak.com//httpd/httpd-2.4.1.tar.bz2
2. Extract, Tar xjf httpd-2.4.1.tar.bz2
3. Install the compilation environment Yum-y install gcc gcc-c++ glibc Glibc-common pcre-devel flex autoconf make Automake
4. Download Apr, wget http://labs.mop.com /APACHE-MIRROR//APR/APR-1.4.6.TAR.BZ2
5. Download apr-util, wget http://mirror.bit.edu.cn/apache//apr/ APR-UTIL-1.4.1.TAR.BZ2
6. Extract Apr,tar XJF apr-1.4.6.tar.bz2
7. Extract Apr-util,tar XJF apr-util-1.4.1.tar.bz2
8. Compile Apr, cd apr-1.4.6 ./configure--prefix=/usr/local/apr make && make install
9. Compile Apr-util, cd ... /apr-util-1.4. ./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config make && make install
10.cd httpd-2.4.1
11../configure--prefix=/usr/local/apache-- WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util/--enable-so--enable-modules=all
Make & & make install
13./usr/local/apache/bin/apachectl start
Set Apache auto Start
The Apache installation path is:/usr/local/apache
1), CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/RC.D/INIT.D/HTTPD//If there are other versions of Apache, it can also be covered directly.
Ln-s/etc/rc.d/init.d/httpd/etc/rc.d/rc5.d/s85httpd//Link set up
At this point, Apache can be started automatically.
2, run Chkconfig--list, found no Linux services list httpd, through Chkconfig--add httpd to add, but the hint: httpd service does not support Chkconfig. You need to edit/etc/rc.d/init.d/httpd to add the following comment information:
#chkconfig: 345 85 15
#description: Apache
The first line of 3 numeric parameter meanings are: Which Linux levels need to start httpd (3,4,5), start sequence number (85), and close ordinal number (15).
Execute after Save: Chkconfig--add httpd, successfully added.
S
s85httpd linked files appear in the RC3.D, rc4.d, rc5.d paths, and k61httpd linked files appear in other run level paths.
Apache Installation Method II
Dependent libraries
Apache relies on Apr, apr-util and pcre, download the URL as:
1 Apr and apr-util:http://apr.apache.org/. As of 2012/12/26, the editions were: Apr-1.4.6.tar.gz and apr-util-1.5.1.tar.gz;
2 pcre:http://pcre.org/(actual download URL is http://sourceforge.net/projects/pcre/files/pcre/and ftp://ftp.csx.cam.ac.uk/pub/ software/programming/pcre/, recommended to download from the SourceForge.net, after a recurrent ventilation). As of 2012/12/26, the version is: pcre-8.32.tar.gz.
3. Apache2.4 Download URL
Http://httpd.apache.org/download.cgi#apache24
Apache2.4 's source code package is: httpd-2.4.3.tar.gz (note that the last version number 3 may be different).
4. Installation Steps
Apr and Apr-util do not have to compile and install in particular, with Apache, see the "Installing Apache" section below.
4.1. Install Pcre
Before you install Apache, you need to install Pcre, and the installation process follows the Automake approach in the following steps:
1)./configure–prefix=/usr/local/pcre (Note: Install Pcre to/usr/local/pcre directory)
2) Make
3) make install
4.2. Install Apache
1 upload the httpd-2.4.3.tar.gz to the compiled directory (where you can assume that the compilation directory is/tmp/x or any other directory)
2 into the/tmp/x directory, extract source package: Tar xzf httpd-2.4.3.tar.gz, after decompression will produce a httpd-2.4.3 directory in/tmp/x, in the httpd-2.4.3 directory will also have a srclib subdirectory
3 upload Apr and Apr-util source Pack to Srclib subdirectory
4) into the Srclib subdirectory, the APR and Apr-util source package decompression, such as: Tar Xzf apr-1.4.6.tar.gz; Tar xzf apr-util-1.5.1.tar.gz, note that the APR and Apr-util directories produced after decompression are of version number
5 Rename the APR and Apr-util directory, remove the following version number, such as: MV apr-1.4.6 Apr; MV apr-util-1.5.1 Apr-util (this is stated in the official guide)
6 Enter the/tmp/x/httpd-2.4.3 directory and compile Apache in Automake mode (note that you need to specify Pcre):
./configure–prefix=/usr/local/httpd–with-pcre=/usr/local/pcre (Note:/USR/LOCAL/HTTPD is an Apache installation directory that can be modified as needed).
7) Next execute make compile source code
8 after successful compilation, execute make install to install Apache to the/USR/LOCAL/HTTPD directory
9) so far,!!!
5. Modify Configuration
If the Apache installed in the/USR/LOCAL/HTTPD directory, then enter the/usr/local/httpd/conf directory, the http.conf as needed to modify, often modified lines are:
1) Listen 80
2) documentroot "/usr/local/httpd/htdocs"
6. Attached 1:apache official Chinese document homepage
http://httpd.apache.org/docs/2.4/
7. Attach 2: One key script 7.1. One-Key scripting prerequisites
1 use root user operation;
2 APR, Apr-util, Pcre and Apache installation packages are placed in the same directory, such as:
~/app # ls
apr-1.4.6.tar.gz apr-util-1.5.1.tar.gz httpd-2.4.3.tar.gz pcre-8.32.tar.gz
3) do not put any other suffix to. tar.gz files in the directory
7.2. One-key script full text
#!/bin/sh
# writed by Yijian on 2012/12/26
# A key to install Apache
# Download
#which wget
#if test $? -ne; Then
# echo ' wget not FOUND '
#else
# wget "Http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz"
# wget "Http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.5.1.tar.gz"
# wget "Http://labs.mop.com/apache-mirror/httpd/httpd-2.4.3.tar.gz"
# wget "Http://nchc.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz"
#fi
# Get Names
apr_tar_gz= ' ls |grep-e ' apr-[0-9]*. [0-9]*. [0-9]*.tar.gz "'
apr_util_tar_gz= ' ls |grep-e ' apr-util-[0-9]*. [0-9]*. [0-9]*.tar.gz "'
Apr= ' basename $apr _tar_gz. tar.gz '
Apr_util= ' basename $apr _util_tar_gz. tar.gz '
Httpd= ' basename httpd-*.tar.gz. tar.gz '
Pcre= ' basename pcre-*.tar.gz. tar.gz '
Echo $APR
Echo $APR _util
Echo $pcre
Echo $httpd
# Unzip files
Tar xzf $apr. tar.gz
Tar xzf $apr _util.tar.gz
Tar xzf $pcre. tar.gz
Tar xzf $httpd. tar.gz
# depends
MV $apr $HTTPD/SRCLIB/APR
if test $? -ne 0; Then
Exit 1
Fi
MV $apr _util $httpd/srclib/apr-util
if test $? -ne 0; Then
Exit 1
Fi
# Compile Pcre
CD $pcre
./configure–prefix=/usr/local/pcre
Make
if test $? -ne 0; Then
Exit 1
Fi
Make install
if test $? -ne 0; Then
Exit 1
Fi
# Compile Apache
Cd.. /$HTTPD
./configure–prefix=/usr/local/httpd–with-pcre=/usr/local/pcre
if test $? -ne 0; Then
Exit 1
Fi
Make
if test $? -ne 0; Then
Exit 1
Fi
Make install
if test $? -ne 0; Then
Exit 1
Fi
# congratulation
echo "Finished"
Cd/usr/local/httpd/conf