**centos6 编译安装httpd-2.4方法二
1.安装先关包组及被依赖程序包:
#yum -y groupinstall Development tools
#yum -y install openssl-devle pcre-devel expat-devel
2.下载源码包:(建议同意格式)
#ls
-rw-r--r-- 1 root root 854100 Jan 30 2018 apr-1.6.3.tar.bz2
-rw-r--r-- 1 root root 428595 Jan 30 2018 apr-util-1.6.1.tar.bz2
-rw-r--r-- 1 root root 6567926 Jan 30 2018 httpd-2.4.29.tar.bz2
----------------------
3.解压缩:
#tar xvf apr-util-1.6.1.tar.bz2
#tar xvf apr-util-1.6.1.tar.bz2
#tart xvf httpd-2.4.29.tar.bz2
4.拷贝apr及arp-util目录到httpd目录下的srclib目录下并且改名:
#cp -a apr-1.6.3 httpd-2.4.29/srclib/apr
#cp -a apr-util-1.6.1 httpd-2.4.29/srclib/apr-util
5.安装:
./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 \
make && make install
6.导出环境变量:
echo ‘/usr/local/httpd24/bin/:$PATH‘ > /etc/profile.d/httpd24.sh
7.导出帮助文件:
echo ‘MANPATH /usr/local/httpd24/man‘ >> /etc/man.config
8.修改启动启动服务名:
cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24
9.自定义启动脚本(参考httpd-2.2的服务脚本)
vim /etc/rc.d/init.d/httpd24
格式:
apachectl=/usr/local/httpd24/bin/apachectl
httpd=${HTTPD-/usr/local/httpd24/bin/httpd}
pidfile=${PIDFILE-/usr/local/httpd24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}
chkconfig –add httpd24 ;chkconfig –list httpd24
10.添加开机启动:
chkconfig --add httpd24
11.设置开机启动:
chkconfig httpd24 on
12.查看:
chkconfig --list
13.测试:
centos6 编译安装httpd-2.4方法二
原文:http://blog.51cto.com/37003839/2066781