. /etc/init.d/functions
httpd_pre(){
cd /usr/local/src
wget https://downloads.apache.org/httpd/httpd-2.4.54.tar.bz2 || { echo "网络不通" ;exit; }
yum install -y gcc bzip2 apr-devel apr-util-devel redhat-lsb prce-devel g++
mkdir -p /apps/{httpd,etc}
}
apache(){
cd /usr/local/src
httprel=httpd-2.4.54
tar xf $httprel.tar.bz2
cd $httprel
./configure --prifix=/apps/httpd --sysconfdir=/apps/etc
make -j 2 && make install
/apps/httpd/bin/apachectl start && action "httpd启动成功" true && action "请访问http://`hostname -I`"
}
httpd_pre
apache
[root@rocky8 ~]# chmod +x httpd.sh
[root@rocky8 ~]# ./httpd.sh
--2022-07-27 21:17:18-- https://downloads.apache.org/httpd/httpd-2.4.54.tar.bz2
Resolving downloads.apache.org (downloads.apache.org)... 135.181.214.104, 88.99.95.219, 2a01:4f8:10a:201a::2, ...
Connecting to downloads.apache.org (downloads.apache.org)|135.181.214.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7434530 (7.1M) [application/x-bzip2]
Saving to: ‘httpd-2.4.54.tar.bz2.1’
...
httpd启动成功 [ OK ]
请访问http://10.0.0.151 [ OK ]