centos7和centos6安装httpd
编译安装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