标签:系统 serve mkdir automake 自动编译 int 类型 cat load
说明:此脚本简单只适合centos系统,仅作参考#!/bin/bash
#判断系统类型是否为centos
SERVER_NAME=‘CentOS‘
OS_SERVER_NAME=$(hostnamectl | awk ‘NR==7 {print $3}‘)
echo "$OS_SERVER_NAME"
[ "$SERVER_NAME" != "$OS_SERVER_NAME" ] && echo "系统不是centos" && exit 1
#----------------------------------------------------------------------
#安装依赖软件
yum -y install wget gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel
#创建临时存放安装文件目录
rm -rf /tmp/nginx
mkdir /tmp/nginx
cd /tmp/nginx
#下载安装包
wget http://nginx.org/download/nginx-1.15.8.tar.gz
[ $? -ne 0 ] && echo "文件下载失败-19行" && exit 2
#解压安装包
tar -zxvf nginx-1.15.8.tar.gz
#进入目录
cd /tmp/nginx/nginx-1.15.8
#创建安装录音
mkdir /nginx
#编译安装
/tmp/nginx/nginx-1.15.8/configure --prefix=/nginx && make && make install
[ $? -ne 0 ] && echo "安装失败" && exit 3
echo "安装成功"
/nginx/sbin/nginx
[ $? -ne 0 ] && echo "启动失败" && exit 4
echo "启动成功"
cat <<EOF
安装目录:/nginx
html目录:/nginx/html
启动目录:/nginx/sbin
EOF
标签:系统 serve mkdir automake 自动编译 int 类型 cat load
原文地址:http://blog.51cto.com/kkk0558/2345797