yum -y install expat-devel openssl-devel
tar -xf apr-util-1.6.1.tar.gz 三个包百度找到下载,并上传
tar -xf httpd-2.4.39.tar.gz
tar -xf apr-1.7.0.tar.gz
cd apr-1.7.0/
vim configure
RM='$RM -f'$ 第31279行
./configure --prefix=/usr/local/apr
make && make install
cd .. 退出apr的编译目录,进入和 apr-util解压后的同级目录
cd apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd .. 退出apr-util的编译目录,进入和httpd解压后的同级目录
cd httpd-2.4.39/
./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-proxy --enable-proxy-fcgi
make && make install
vim /etc/profile
PATH=/usr/local/httpd/bin:$PATH
source /etc/profile
vim /etc/init.d/httpd 做成systemctl服务
#!/bin/bash
# chkconfig: 12345 80 90
function start_http() {
/usr/local/httpd/bin/apachectl start
}
function stop_http() {
/usr/local/httpd/bin/apachectl stop
}
case "$1" in
start)
start_http
;;
stop)
stop_http
;;
restart)
start_http
sleep 1
stop_http
;;
*)
echo "Usage : start | stop | restart"
;;
esac
chmod a+x /etc/init.d/httpd
systemctl daemon-reload
systemctl start httpd
chkconfig --add httpd 开机启动
Centos7编译安装apache
最新推荐文章于 2024-07-06 16:13:53 发布