linux编译c 自动化,Linux7 自动化编译安装nginx-1.17.1

https://blog.51cto.com/14101466

#mail:[email protected]

##################################################

#!/bin/bash

[ -f /etc/init.d/functions ] && . /etc/init.d/functions

Install_path=/home/applications

Code_path=/home/usr

echo "------------------------start install nginx------------------------"

sleep 3

for soft in "gcc-c++" "zlib" "zlib-devel" "pcre" "pcre-devel" "openssl" "openssl-devel"

do

if [[ ! `rpm -qa $soft|wc -l` -eq 1 ]];then

yum install $soft -y

else

rpm -e $soft -y

yum install $soft -y

fi

done

if [ ! `grep nginx /etc/passwd|wc -l` -eq 1 ];then

echo "adding user nginx....."

useradd nginx -s /sbin/nologin -M

else

echo "user nginx exsits"

fi

echo "------------environment installation c``ompleted------------"

sleep 2

echo "--------------------------download nginx-------------------------"

sleep 3

[ -d $Code_path ] && cd $Code_path||mkdir $Code_path && cd $Code_path

wget http://nginx.org/download/nginx-1.17.1.tar.gz

tar -xf nginx-1.17.1.tar.gz

cd nginx-1.17.1

echo "--------------------download completed-----------------------"

sleep 2

echo "-------------------------- install nginx----------------------------"

sleep 3

[ -d $Install_path ]||mkdir $Install_path

./configure --prefix=$Install_path/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module

if [ $? -ne 0 ];then

echo "configure failed ,please check it out!"

exit 2

else

echo "make nginx, please wait for 20 minutes"

make

fi

if [ $? -ne 0 ];then

echo "make failed ,please check it out!"

exit 3

else

echo "install nginx, please wait for 20 minutes"

make install

if [ $? -ne 0 ];then

echo "make install error,please check it out"

exit 4

else

echo "make install succeed!!!"

fi

fi

chown -R nginx.nginx $Install_path/nginx

ln -s $Install_path/nginx/sbin/nginx /usr/local/sbin/

/usr/local/sbin/nginx

sleep 3

echo "-----------------nginx install succeed---------------------"

原文:https://blog.51cto.com/14101466/2416102

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值