-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpd_install.sh
97 lines (86 loc) · 3.29 KB
/
httpd_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
TESTING_SERVER_MODS="--enable-info --enable-ssl --enable-cgi --enable-dav"
if [ "$1" != "" ]
then
HTTPD_VERSION="$1"
INSTALL_DIRECTORY="/usr/local"
PRODUCT="httpd-$HTTPD_VERSION"
DOWNLOAD_URL="https://archive.apache.org/dist/httpd/$PRODUCT.tar.gz"
LOGFILE="/tmp/$PRODUCT-install.log"
if [ "$2" != "" ]
then
INSTALL_DIRECTORY="$2"
else
INSTALL_DIRECTORY="$INSTALL_DIRECTORY/$PRODUCT"
fi
if [ -e "$INSTALL_DIRECTORY" ]
then
echo "[!] WARNING : $INSTALL_DIRECTORY Will Be Overwritten By New Installation"
echo "[*] Are You Sure That You Want To Install HTTPd $HTTPD_VERSION In : $INSTALL_DIRECTORY ? (y,n) : "
read CONFIRM
if ![ "$CONFIRM" == "Y" ] && ![ "$CONFRIM" == "y" ] && ![ "$CONFIRM" == "yes" ]
then
echo "[*] Aborting ..."
exit
fi
fi
echo "###################################### Summary ######################################"
echo ""
echo " Product Name: $PRODUCT"
echo " Version: $HTTPD_VERSION"
echo " Download From: $DOWNLOAD_URL"
echo " Install Directory: $INSTALL_DIRECTORY"
echo ""
echo "#####################################################################################"
echo "[*] Downloading $PRODUCT Sources ..."
wget $DOWNLOAD_URL -O /tmp/$PRODUCT.tar.gz >> $LOGFILE 2>&1
configuration_parameters="--with-mpm=worker --prefix=\"${INSTALL_DIRECTORY}/\""
echo "[*] Extracting Files In : /tmp/$PRODUCT ..."
tar -x -z -f /tmp/$PRODUCT.tar.gz -C /tmp
sudo rm -rf /tmp/$PRODUCT.tar.gz
cd /tmp/$PRODUCT
if [ ! -f "/usr/bin/apr-1-config" ]
then
sudo svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr >> $LOGFILE 2>&1
cd srclib/apr
echo "[*] Building APR ..."
sudo ./buildconf >> $LOGFILE 2>&1
sudo ./configure >> $LOGFILE 2>&1
sudo make clean
sudo make >> $LOGFILE 2>&1
echo "[*] Installing APR ..."
sudo make install >> $LOGFILE 2>&1
configuration_parameters="${configuration_parameters} --with-included-apr"
cd ../../
else
configuration_parameters="${configuration_parameters} --with-apr=/usr/bin/apr-1-config"
fi
echo "[*] Building $PRODUCT ..."
sudo ./buildconf >> $LOGFILE 2>&1
eval "sudo ./configure ${configuration_parameters}" >> $LOGFILE 2>&1
sudo make clean
sudo make >> $LOGFILE 2>&1
echo "[*] Installing $PRODUCT Files ..."
sudo make install >> $LOGFILE 2>&1
BUILD_INFO=$(sudo $INSTALL_DIRECTORY/bin/apachectl -v)
if [ "$BUILD_INFO" != "" ]
then
echo "[+] Installation Done ."
echo ""
echo "$BUILD_INFO"
else
echo "[-] ERROR : Installation Failed"
echo ""
echo " -> Please Check The Installation Log File : $LOGFILE"
fi
else
echo "===================================[ Usage ]==================================="
echo " Arguments :"
echo " $0 <HTTPD_VERSION>"
echo " $0 <HTTPD_VERSION> [APCHE_INSTALL_DIRECTORY]"
echo ""
echo " Exemple :"
echo " $0 2.4.29 /usr/local/httpd-2.4.29"
echo ""
echo "==============================================================================="
fi