安装httpd-2.4
依赖于apr-1.4+, apr-util-1.4+,
apr: apache portable runtime,解决跨平台实现
CentOS 6:默认:apr-1.3.9, apr-util-1.3.9
安装前准备开发包:
开发环境包组:
Development Tools,Server
相关包:pcre-devel,openssl-devel expat-devel
下载源代码并解压缩:
httpd-2.4.27.tar.bz2
apr-1.6.2.tar.bz2
apr-util-1.6.0.tar.bz2
centos6 编译安装httpd-2.4方法一
1、安装apr-1.4+
cd apr-1.6.2
./configure --prefix=/app/apr --host=x86_64
make && make install
2、安装apr-util-1.4+
cd ../apr-util-1.6.0
./configure --prefix=/app/apr --host=x86_64
make -j 2 && make install
3、编译安装httpd-2.4
cd ../httpd-2.4.27
./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/app/apr/ --with-aprutil=/app/apr-util/ --enable-modules=most --enablempms-shared=all --with-mpm=prefork
make -j 4 && make install
centos6 编译安装httpd-2.4方法二
1、cp -av apr-util-1.6.1 httpd-2.4.35/srclib/apr-util
2、cp -av apr-1.6.5 httpd-2.4.35/srclib/apr
3、cd httpd-2.4.35/
./configure --prefix=/usr/local/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
4、make && make install
Httpd编译过程:/usr/local/apache24/build/config.nice
自带的服务控制脚本:/usr/local/httpd24/bin/apachectl
5、在centos6 编译安装httpd-2.4
vim /etc/profile.d/httpd24.sh
export PATH=/app/http24/bin:$PATH
vim /etc/man.config
MANPATH /usr/local/apache24/man
6、自定义启动脚本(参考httpd-2.2的服务脚本)
cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24
vim /etc/rc.d/init.d/httpd24
apachectl=/usr/local/httpd24/bin/apachectl
httpd= { PIDFILE -/usr/local/httpd24/logs/httpd.pid }
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}
chkconfig –add httpd24 ;chkconfig –list httpd24