标签:Shell
注意你的nginx版本和存放路径,做相应的改动#!/bin/bash
if [ $(ls /mnt | wc -l) -eq 0 ]; then
mount /dev/sr0 /mnt
fi
#declare totalNum=$(yum repolist | sed -n ‘/repolist/s/,//;s/repolist: //p‘)
declare totalNum=$(yum repolist | awk -F‘[: ]‘ ‘$1~/^repolist/{print $3}‘ | sed -n ‘s/,//p‘)
echo $totalNum
if [ $totalNum -eq 0 ]; then
echo "Please setup your yum first!!!"
exit
fi
if [ ! -d /usr/local/src/nginx-1.8.0 ]; then
tar xvz -f /tools/nginx-1.8.0.tar.gz -C /usr/local/src
fi
if [ -d /usr/local/nginx ];then
echo "you aleady install Nginx!!!"
exit
fi
declare -a yumList=‘gcc pcre-devel zlib-devel‘
for i in $yumList
do
if [ -z "$(rpm -qa $i)" ];then
yum -y install $i
fi
done
cd /usr/local/src/nginx-1.8.0
./configure --prefix=/usr/local/nginx 2>/scripts/nginx_install.log
make && make install 2>>/scripts/nginx_install.log
[ -d /usr/local/nginx ] && echo "install nginx sucessfully!!" || echo "install nginx fail!!!!"
标签:Shell
原文地址:http://blog.51cto.com/13765598/2120055