一键安装httpd脚本
#!/bin/bash
#
#********************************************************************
#Author: mozhiwen
#QQ: 490545607
#Date: 2023-04-24
#FileName: install_httpd.sh
#URL: http://www.mozhiwen.com
#Description: httpd install
#Copyright (C): 2023 All rights reserved
#*******************************************************************#
CPUS=`grep -c processor /proc/cpuinfo`
HTTPD_VERSION=2.4.57
INSTALL_DIR=/opt/httpd
COLOR="echo -e \E[32;1m]"
END="\E[OM"
. /etc/os-release
if [ $ID = 'rocky' -o $ID = 'centos' ];then
systemctl disabled --now firewalld
yum -y install gcc make apr-devel apr-util-devel openssl-devel pcre-devel redhat-rpm-config bzip2
elif [ $ID = 'ubuntu' ];then
apt update
apt -y install libapr* libpcre3* libssl-dev make
else
$COLOR"不支持此系统安装"$END
exit
fi
cd /opt/
rpm -q wget || yum -y install wget
wget https://dlcdn.apache.org/httpd/httpd-2.4.57.tar.bz2 --no-check-certificate || { $COLOR "下载失败,退出" $END;exit ; }
tar xf httpd-${HTTPD_VERSION}.tar.bz2
cd httpd-${HTTPD_VERSION}
./configure --prefix=${INSTALL_DIR} --enable-ssl --disable-status
make -j $CUPS && make install
ln -s /opt/httpd/bin/apachectl /usr/local/bin
apachectl start && $COLOR"安装成功!!!"$END
$COLOR"请访问:http://`hostname -I`"$END
curl 10.0.0.136:80
标签:脚本,httpd,END,--,一键,devel,COLOR,install From: https://www.cnblogs.com/m490545607/p/17375410.html