自動(dòng)化編譯安裝httpd的腳本盯蝴!
FUNDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Make sure you are ready for installing apache!"
read -p "Please input the dir wher you want to download these packages!" pkg
declare -a numberlists
echo "Current dirpath is $FUNCDIR"
( cd $pkg &&
echo "apr-1.5.2.tar.bz2 is downloading please be patient!"
wget http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.bz2 &>/dev/null && echo "apr-1.5.2.tar.bz2 has downloaded successfully!"
echo "apr-util-1.5.4.tar.bz2 is downloading please be patient!"
tar xf $pkg/`ls $pkg |grep "httpd"` -C /usr/local
fi
# "/usr/local/`ls /usr/local |grep apr-1`"
#aprutildir= "/usr/local/`ls /usr/local |grep "apr-util"`"
#httpddir= "/usr/local/`ls /usr/local |grep httpd `"
(cd /usr/local/`ls /usr/local | grep apr-[0-9].[0-9].[0-9]`
if [ -z `ls /usr/local | grep "apr$"` ] ;then
./configure --prefix=/usr/local/apr | tee /tmp/apr.out
make
make install
else echo "apr has installed early!"
fi )
(cd /usr/local/`ls /usr/local |grep "apr-util"`
[ -z "`ls /usr/local | grep "apr-util$"`" ] &&
(./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr |tee /tmp/apr-util.out && make && make install
echo "Apr-util is installed sucessfully!") || echo "apr-util has installed early!")
(cd /usr/local/`ls /usr/local | grep "httpd"`
[ -z `ls /usr/local | grep "apache" ` ] && ( ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewrite --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util |tee /tmp/httpd.out && make && make install echo "Httpd is installed successfully!") || echo "httpd has installed early" )
( cd $FUNDIR && sed -n "p" httpd_conf_default |tee /etc/httpd/httpd.conf >/dev/null && sed -n "p" httpd_server_default |tee /etc/init.d/httpd24 >/dev/null && chkconfig --add httpd24 && chkconfig httpd24 on )
(rm -rf /etc/httpd/conf.d/httpd.conf > /dev/null && echo "export PATH=$PATH:/usr/local/`ls /usr/local | grep httpd`" > /etc/profile.d/apache.sh && chmod +x /etc/init.d/httpd24 && echo "/usr/local/apache/lib" > /etc/ld.so.conf.d/apache.conf && ldconfig &&
echo "Configuration is ok!" && [ -z "/usr/include/apache" ] && ln -s /usr/local/apache/include/ /usr/include/apache )
( echo "export PATH=$PATH:/usr/local/apache/bin" > /etc/profile.d/httpd.sh
echo "It works!! " )
;;
${numberlists[1]})
break
esac
done
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者