Apache2.4 Installation Guide and one-click installation script 1. preface this document attempts to clarify the installation of Apache2.4 in the simplest way. Apache uses the automake compilation method, including the libraries it depends on. Because of this dependency, the compilation and installation are slightly more complex. 2. The dependent database Apache depends on apr, apr-util, and pcre. The download URL is: 1) Apr and Apr-util: http://apr.apache.org /. As of, versions were: apr-1.4.6.tar.gzand apr-util-1.5.1.tar.gz; 2) Pcre: http://pcre.org ). As of, the version is: pcre-8.32.tar.gz. 3. Apache2.4 download URL ghost (note that the last version 3 may be different ). 4. The installation steps Apr and Apr-util do not need to be specially compiled and installed. They are completed with Apache. See the "install Apache" section below. 4.1. install Pcre before installing Apache. Install Pcre in the automake mode. The steps are as follows: 1 ). /configure -- prefix =/usr/local/pcre (Note: Install Pcre in the/usr/local/pcre directory) 2) make3) make install4.2. install Apache1) upload httpd-2.4.3.tar.gz to the compiling directory (assuming the compiling directory is/tmp/X, or any other directory). 2) enter the/tmp/X Directory and decompress the source package: tar xzf httpd-2.4.3.tar.gz. After decompression, A httpd-2.4.3 directory will be generated in/tmp/X, there will be a srclib subdirectory under the httpd-2.4.3 directory 3) upload the source package of Apr and Apr-util to the srclib subdirectory 4) Go To The srclib subdirectory and decompress the source package of Apr and Apr-util, such as tar xzf. Pr-1.4.6.tar.gz; tar xzf apr-util-1.5.1.tar.gz, note that after decompression the generated Apr and Apr-util directory is with version number 5) Rename the Apr and Apr-util directory, remove the following version number, such: mv apr-1.4.6 apr; mv apr-util-1.5.1 apr-util (described in this official guide) 6) Go to the/tmp/X/httpd-2.4.3 directory, 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 the installation directory of Apache, can be modified as needed ). 7) execute make to compile the source code. 8) after the compilation is successful, execute make install to install Apache under directory 9 of/usr/local/httpd !!! 5. modify the configuration. If Apache is installed in the/usr/local/httpd directory, go to the/usr/local/httpd/conf directory. conf is modified as needed. The frequently modified rows include: 1) Listen 802) DocumentRoot "/usr/local/httpd/htdocs" 6. appendix 1: Apache official Chinese documents home page http://httpd.apache.org/docs/2.4/7. appendix 2: one-click script 7.1. one-click script prerequisite 1) Use root user operations; 2) Put Apr, Apr-util, Pcre, and Apache installation packages in the same directory, for example :~ /App # lsapr-1.4.6.tar.gz apr-util-1.5.1.tar.gz httpd-2.4.3.tar.gz pcre-8.32.tar.gz3) under the directory do not want to put its suffix is .tar.gz file 7.2. one-click 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 namesapr_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 $ 2.16.tar.gz 'apr _ util = 'basename $ 2.16.tar.gz' httpd = 'basename httpd-* .tar.gz 'pcre = 'basename pcre-* .tar.gz 'echo $ aprecho $ apr_utilecho $ pcreecho $ httpd # unzip filestar xzf unzip tar xzf unzip httpd.tar.gz # Dependsmv $ apr $ httpd/srclib/release F test $? -Ne 0; thenexit 1 fimv $ apr_util $ httpd/srclib/apr-utilif test $? -Ne 0; thenexit 1fi # Compile pcrecd $ pcre./configure -- prefix =/usr/local/pcremakeif test $? -Ne 0; thenexit 1 fimake installif test $? -Ne 0; thenexit 1fi # Compile apachmcm ../$ httpd./configure -- prefix =/usr/local/httpd -- with-pcre =/usr/local/pcreif test $? -Ne 0; thenexit 1 fimakeif test $? -Ne 0; thenexit 1 fimake installif test $? -Ne 0; thenexit 1fi # Congratulationecho "finished" cd/usr/local/httpd/conf