[root@web03 scripts]# cat auto_install_apache.sh
#!/bin/bash
#2019.12.24 19:32
#auto install apache
#author: zhangsan
###########################
APACHE_VER="$1"
APACHE_SOFT="httpd-${APACHE_VER}.tar.bz2"
APACHE_URL="https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/"
APACHE_DIR="/usr/local/apache"
APACHE_YUM="yum install -y"
APACHE_ARG="--enable-so --enable-rewrite --enable-proxy"
#安装依赖
${APACHE_YUM} wget bzip-devel tar make zlib zlib-devel
${APACHE_YUM} gcc gcc-c++ apr-devel apr-util-devel pcre-devel
cd /server/tools
wget -c ${APACHE_URL}/${APACHE_SOFT}
tar -xf ${APACHE_SOFT}
cd httpd-${APACHE_VER}
./configure --prefix=${APACHE_DIR}/ ${APACHE_ARG}
make
make install
${APACHE_DIR}/bin/apachectl start
ps -ef|grep 80
systemctl stop firewalld.service
#开机自启动
echo "${APACHE_DIR}/bin/apachectl start">>/etc/rc.local