Centos 6编译安装httpd2.4的两种方法

2018-02-03 19:46:49来源:cnblogs.com作者:ˊReset﹎ゞ人点击

分享

第一种方法

一、下载解压

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -vxf httpd-2.4.29.tar.gz
tar -vxf apr-1.6.3.tar.gz
tar -vxf apr-util-1.6.1.tar.gz

二、安装开发包组和相关依赖包

yum groupinstall "Development tools"yum install openssl-devel pcre-devel expat-devel

三、编译apr和apr-util 

httpd是依赖于apr的,所以先编译apr和apr-util

1、编译apr

cd apr-1.6.3./configure --prefix=/app/apr
make && make install

2、编译apr-util

cd apr-util-1.6.1
./configure --prefix=/app/apr-util --with-apr=/app/apr
make && make install

四、编译httpd

cd httpd-2.4.29./configure --prefix=/app/httpd24 /--enable-so /--enable-ssl /--enable-cgi /--enable-rewrite /--with-zlib /--with-pcre /--with-apr=/app/apr/ /--with-apr-util=/app/apr-util/ /--enable-modules=most /--enable-mpms-shared=all /--with-mpm=prefork

make && make install

五、环境变量

echo 'PATH=/app/httpd24/bin/:$PATH' > /etc/profile.d/httpd24.sh. /etc/profile.d/httpd24.sh

六、创建用户和组

useradd -r -s /sbin/nologin apache

七、修改配置文件

vim /app/httpd24/conf/httpd.conf修改User apacheGroup apache

八、启动脚本

cp /etc/init.d/httpd /etc/init.d/httpd24
vim /etc/init.d/httpd24apachectl=/app/httpd24/bin/apachectlhttpd=${HTTPD-/app/httpd24/bin/httpd}pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

chkconfig --add httpd24
chkconfig httpd24 on
service httpd24 start

第二种方法

一、下载解压

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gzwget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gzwget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gztar -vxf httpd-2.4.29.tar.gztar -vxf apr-1.6.3.tar.gztar -vxf apr-util-1.6.1.tar.gz

二、安装开发包组和相关依赖包

yum groupinstall "Development tools"yum install openssl-devel pcre-devel expat-devel

三、拷贝apr和apr-util源码包

cp -r apr-1.6.3 httpd-2.4.29/srclib/aprcp -r apr-util-1.6.1 httpd-2.4.29/srclib/apr-util

三、编译

cd httpd-2.4.29./configure /--prefix=/app/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

后面的步骤和第一种方法一样

相关文章

    无相关信息

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台