vim httpd.sh
#!/bin/bash
case $1 in
"install")
DIR=/app/httpd24
echo "Start install httpd ..."
rpm -q gcc &> /dev/null || yum install gcc -y
yum groupinstall "development tools" -y
yum install apr-devel apr-util-devel pcre-devel openssl-devel -y
wget http://192.168.36.7/httpd-2.4.25.tar.gz
tar xvf httpd-2.4.25.tar.gz
cd httpd-2.4.25/
./configure --prefix=/app/httpd24 &>/dev/null
make && make install &>/dev/null
echo PATH="/$DIR/bin:"‘$PATH‘ > /etc/profile.d/httpd.sh
. /etc/profile.d/httpd.sh
echo "Install httpd is successful!"
;;
"remove")
echo "Start remove httpd ..."
rm -rf /app/httpd24
rm -f /etc/profile.d/httpd.sh
killall httpd
yum groupremove "development tools" -y
yum remove apr-devel apr-util-devel pcre-devel openssl-devel -y
echo "Remove httpd is successful!"
;;
*)
echo "Usage: `basename $0` install | remove"
;;
esac
地址如不通
wget http://192.168.36.7/httpd-2.4.25.tar.gz
tar xvf httpd-2.4.25.tar.gz
cd httpd-2.4.25/
替换为
wget https://www.apache.org/dist/httpd/httpd-2.4.38.tar.gz
tar -xvf httpd-2.4.38.tar.gz
cd httpd-2.4.38/