編譯安裝httpd
http://apr.apache.org/download.cgi
下載 apr-util-1.6.1.tar.bz2 apr-1.6.5.tar.bz2
http://httpd.apache.org/download.cgi#apache24
下載Source: httpd-2.4.39.tar.bz2
- 按裝依賴
yum install pcre-devel openssl-devel expat-devel
- 安裝apr
[172.168.2.8-root@lvsapr-1.6.5]#cd apr-1.6.5/ ./configure --prefix=/usr/local/apr make && make install
- 安裝arp-util
cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr-util \ --with-apr=/usr/local/apr make && make install
- 安裝httpd
cd httpd-2.4.39 ./configure --prefix=/usr/local/httpd2.4.39 \ --sysconfdir=/etc/httpd2.4.39 \ --enable-so \ --enable-ssl \ --enable-cgi \ --enable-rewrite \ --with-zlib \ --with-pcre \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-modules=most \ --enable-mpms-shared=all \ --with-mpms=prefork make && make install
- 設置環境變量
cat >> /etc/profile.d/httpd.ssh << 'EOF' export PATH=/usr/local/httpd2.4.39/bin:$PATH EOF
- 連接
ln -s /usr/local/httpd2.4.39/ /usr/local/httpd
- centos6.9安裝apache2.4.39
- 把 apr 和apr-util 移動到http2.4.39源碼包srclib/下重命名
[root@node2 /usr/local/src]# mv apr-1.6.5 httpd-2.4.39/srclib/apr [root@node2 /usr/local/src]# mv apr-util-1.6.1 httpd-2.4.39/srclib/apr-util
yum install pcre-devel openssl-devel expat-devel
./configure --prefix=/usr/local/httpd2.4.39 \ --enable-so \ --enable-ssl \ --enable-cgi \ --with-include-apr \ --enable-rewrite \ --with-zlib \ --with-pcre \ --enable-modules=most \ --enable-mpms-shared=all \ --with-mpms=prefork
cat >> /etc/profile.d/httpd.ssh << 'EOF' export PATH=/usr/local/httpd2.4.39/bin:$PATH EOF
ln -s /usr/local/httpd2.4.39/ /usr/local/httpd
- 修改啟動腳本
[root@node2 ~]# cp /etc/init.d/http /etc/init.d/http2.4.39 apachectl=/usr/local/httpd2.4.39/bin/apachectl httpd=${HTTPD-/usr/local/httpd2.4.39/bin/httpd} prog=httpd pidfile=${PIDFILE-/usr/local/httpd2.4.39/logs/httpd.pid} lockfile=${LOCKFILE-/var/lock/subsys/httpd2.4.39}
- 加入服務管理
[root@node2 /etc/init.d]# chkconfig --add httpd2.4.39 [root@node2 /etc/init.d]# chkconfig --list | grep httpd2.4.39 httpd2.4.39 0:off 1:off 2:off 3:off 4:off 5:off 6:off
- 啟動
[root@node2 /etc/init.d]# /etc/init.d/httpd2.4.39 start
- 檢驗環境變量
[root@node2 /etc/init.d]# which httpd /usr/local/httpd2.4.39/bin/httpd [root@node2 /etc/init.d]# which -a httpd /usr/local/httpd2.4.39/bin/httpd /usr/sbin/httpd

