パッケージ管理-httpd 2をワンタッチでインストールまたはアンインストールする.4.27

2126 ワード

httpスクリプトのインストール

#! /bin/bash
# 2018-08-09
# V 1.0 
# ZhuXiaoGuo


# 1.   YUM
echo "config yum"

#rm -rf /etc/yum.repos.d/* &>/dev/null
cat >/etc/yum.repos.d/epel.repo < /dev/null
yum  list &> /dev/null
yum  makecache &> /dev/null

echo "yum finish"


# 2.         

yum -y groupinstall "Development tools" &> /dev/null
yum -y install apr-devel &> /dev/null
yum -y install apr-util-devel &> /dev/null


# 3.   httpd,  

mkdir /data &> /dev/null

echo "Getting the httpd-2.4.27.tar.gz form network,please wait....."

 wget http://archive.apache.org/dist/httpd/httpd-2.4.27.tar.gz -P /data/
cd /data/
tar -zxvf httpd-2.4.27.tar.gz &> /dev/null

#     

echo "Begin install httpd server,please wait."
cd httpd-2.4.27

./configure --prefix=/app &> /dev/null  && echo configure finished || { echo configure error; exit; }
make &>/dev/null && echo make finished || { echo make error; exit; }
make install &> /dev/null && echo "httpd service has been finished." || { echo make install error; exit; }

echo "httpd service is starting "

cat >/etc/profile.d/httpdpath.sh< /dev/null && echo "Apache httpd service is working!" || echo start httpd error

httpスクリプトのアンインストール

#! /bin/bash

# 1.    httpd  

echo "Remove httpd starting "

apachectl stop &> /dev/null && echo "stopping httpd"

# 2.        /app

rm -rf /app &> /dev/null && echo "deleting  httpd dir."


# 3.      PATH  
echo "deleting  httpd source file."

find / -regex ".*httpd-2.4.27.*" -delete &> /dev/null && echo "deleting httpd path file"
rm -rf /etc/profile.d/httpdpath.sh &>/dev/null && echo "httpd has removed."