代码语言:javascript复制
#!/bin/bash
#解压压缩包
yum -y install gcc gcc-c unzip
unzip lamp.zip
mv lamp /
cd /lamp
for i in `ls *.tar.gz`
do
tar -xf $i
done
unzip $(ls *.zip)
YANZHENG () {
if [ $? -ne 0 ]
then
echo "$1 安装失败" >> /root/jieguo
exit
else
echo "$1 安装成功" >> /root/jieguo
fi
}
#安装apache
cp -a /lamp/apr-1.4.6 /lamp/httpd-2.4.7/srclib/apr
cp -a /lamp/apr-util-1.4.1 /lamp/httpd-2.4.7/srclib/apr-util
cd /lamp/pcre-8.34
./configure && make && make install
yum -y install openssl-devel
yum -y install expat-devel
cd /lamp/httpd-2.4.7
./configure --prefix=/usr/local/apache2 --sysconfdir=/usr/local/apache2/etc --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-ssl && make -j 4 && make install
YANZHENG apache2
#需要提前加入执行权限chmod x /etc/rc.d/rc.local
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local
chmod x /etc/rc.local
#给rc.local加上可执行权限