标签:安装nginx 软件包 pre Opens evel usr else 一键安装 open
一键安装 nginx脚本
#!/bin/bash
#定义函数,检查软件包是否安装
check_packet()
{
rpm -qa $1 | wc -l
}
#安装依赖包
packet_install()
{
for i in "pcre-devel zlib zlib-devel openssl openssl-deve"
do
a=`check_packet $i`
if [ $a == 0 ]
then
yum -y install $i
fi
done
}
#安装nginx函数
nginx_install()
{
b=`check_packet nginx`
if [ $b == 0 ]
then
cd /usr/src
wget -c http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxf nginx-1.4.2.tar.gz
cd /usr/src/nginx-1.4.2
./configure --prefix=/usr/local/nginx && make && make install 2> /tmp/nginx_install.err
if [ $? == 0 ]
then
./usr/local/nginx/sbin/nginx
else
exit
fi
fi
}
systemctl disable firewalld
systemctl stop firewalld
setenforce 0
sed -i ‘/^SELINUX/c SELINUX=disabled‘ /etc/selinux/config
packet_install
nginx_install
标签:安装nginx 软件包 pre Opens evel usr else 一键安装 open
原文地址:https://blog.51cto.com/13667909/2506208