基于Centoss7编译安装httpd2.4
2021-01-06 00:28
标签:oss use sha 指定 make Fix chmod 存在 util 基于Centoss7编译安装httpd2.4 标签:oss use sha 指定 make Fix chmod 存在 util 原文地址:https://www.cnblogs.com/jinlei92131/p/13601365.html#!/bin/bash
#设置变量
WORKDIR=/apps
#安装需要的环境包
yum -y install gcc make pcre-devel openssl-devel expat-devel
#在指定目录下下载压缩文件
mkdir /apps
cd ${WORKDIR}
wget https://mirrors.bfsu.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirrors.bfsu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.46.tar.bz2
#解压包
tar xvf apr-1.7.0.tar.gz
tar xvf apr-util-1.6.1.tar.gz
tar xvf httpd-2.4.46.tar.bz2
#移动apr和ap-util至srclib目录中,并去掉版本号
mv apr-1.7.0 httpd-2.4.46/srclib/apr
mv apr-util-1.6.1 httpd-2.4.46/srclib/apr-util
#开始编译安装
cd httpd-2.4.46/
./configure --prefix=/apps/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 -j 4 && make install
#创建用户
if id apache ;then
echo apache 用户已经存在无需创建
else
useradd -s /sbin/nologin -r apache
fi
#修改用户和组
cd ${WORKDIR}/httpd24/conf
sed -Ei.bak ‘/^User/s/daemon/apache/‘ httpd.conf
sed -Ei.bak ‘/^Group/s/daemon/apache/‘ httpd.conf
#配置环境变量
echo PATH=/apps/httpd24/bin:$PATH >> /etc/profile.d/httpd24.sh
source /etc/profile.d/httpd24.sh
#配置帮助
echo "MANDATORY_MANPATH /app/httpd24/man" >> /etc/man_db.conf
#设置开机自动启动
echo "/apps/httpd24/bin/apachectl start" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
文章标题:基于Centoss7编译安装httpd2.4
文章链接:http://soscw.com/index.php/essay/40370.html