Objective:
Apache HTTP Server( Apache) is an open source Web server of the Apache Software Foundation, which can operate in most computer operating systems, and is widely used due to its multi-platform and security. is one of the most popular Web server-side software. It is fast, reliable, and can be compiled into the server by a simple API extension, such as the Perl/python interpreter.
Environment Introduction
System Environment: CentOS6.5
Required Packages: apr-1.5.1.tar.gz, apr-util-1.5.4.tar.gz, httpd-2.4.12.tar.gz
Note: httpd2.4 need to rely on Apr and Arp-util 1.4 or higher
CentOS compile and install Apache preparation: Ensure that the development package group is installed (development tools, Server Platform development)
Yum groupinstall Development tools Server Platform Development
0, check the old version of Apache package name, uninstall the old version of Apache
RPM-e httpd-2.2. el6.centos.x86_64--nodeps
1, download the official source package and Unzip:
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.12.tar.gzwget http: mirror.bit.edu.cn/apache/apr/apr-1.5.1.tar.gzwget http:// Mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
2. Decompression
tar -xvf httpd-2.4. . tar. gz
tar -xf apr-1.5. 1. Tar tar -xf apr-util-1.5. 4. Tar
3, to resolve the dependency relationship:
MV apr-1.5. 1 httpd-2.4. /srclib/Aprmv apr-util-1.5. 4 httpd-2.4. /srclib/apr-util
2. Switch to the source directory:
CD httpd-2.4. A
3. Execute Configue Script:
./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd/--enable-so
1 Detailed compilation parameters:2 3--prefix: #安装路径4 5--Sysconfdir: #指定配置文件路径6 7--enable-so: #DSO兼容, dso=Dynamic shared object, which dynamically shares objects for dynamic module entry8 9--enable-ssl: #支持SSL/tls, HTTPS access required to be installed openssl-develTen One--enable-CGI: #支持CGI脚本 (default on non-threaded MPM mode) A ---enable-rewrite: #启用Rewrite功能, url rewrite - the--enable-deflate: #支持压缩功能 - ---with-zlib: #使用指定的zlib库, do not specify path will automatically find - +--with-pcre: #使用指定的PCRE库, do not specify path will automatically look for required installed pcre-devel - +--with-Apr: #指定apr安装路径 A at--with-apr-util: #指定apr-Util installation Path - ---enable-mpms-shared: #支持动态加载的MPM模块, Optional parameters: All - ---WITH-MPM: #设置默认启用的MPM模式, {prefork|worker|Event} - in--enable-modules: #支持动态启用的模块, optional parameter: All,most,few,reallyall - to#编译之前可使用./configure--help View the parameters
4. Make and make install
Make Make Install
5, in order to facilitate the use of the command to add environment variables, editing the binary how to let the system find:
Cat /etc/profile.d/apache. SH path=/usr/local/apache/bin: $PATHexport path
6, the head file output to the system:
#LN -sv/usr/local/apache/include/usr/local/include/httpd
7. Let the system regenerate the library file path cache
#ldconfig-V | grep " ^[^[:space:]] "
8. Start Apache Service:
# Apachectl Start
9. Check if port 80 is being monitored:
Netstat-ntl
The first encounter is the 80 port is not listening, so open the installation directory:/usr/local/apache/logs/error_log appears the following prompt:
Google for a second reason possible, resource constrained, unable to allocate memory
Workaround:
# ulimit Unlimited-uUnlimited >>/etc/profile #保存修改到自启动文件
Check again for Port 80 has been monitored:
Browser Access test:
Compile and install successfully!
Compiling and installing httpd-2.4.12