zyk198500 发表于 2019-1-25 10:20:03

centos6一键安装lnmp+zabbix服务端

#!/bin/bash  
# install Nginx 1.8.x + mysql5.5.x + PHP-FPM 5.4.x + Zabbix 2.4.7 automatically.
  
# Tested on CentOS 6.5
  
##############################################
  
# 变量
  
##############################################
  
err_echo(){
  
    echo -e "\e: $1 33[0m"
  
    exit 1
  
}
  

  
info_echo(){
  
    echo -e "\e: $1 33[0m"
  
}
  

  
warn_echo(){
  
    echo -e "\e: $1 33[0m"
  
}
  

  
check_exit(){
  
    if [ $? -ne 0 ]; then
  
      err_echo "$1"
  
      exit1
  
    fi
  
}
  

  
##############################################
  
# check
  
##############################################
  
if [ $EUID -ne 0 ]; then
  
    err_echo "please run this script as root user."
  
    exit 1
  
fi
  

  
if [ "$(awk '{if ( $3 >= 6.0 ) print "CentOS 6.x"}' /etc/redhat-release 2>/dev/null)" != "CentOS 6.x" ];then
  
    err_echo "This script is used for RHEL/CentOS 6.x only."
  
fi
  
##############################################
  
# Useradd deploy nginx程序运行账号
  
##############################################
  
info_echo "Useradd deploy"
  
useradd deploy
  

  
##############################################
  
# yum repo
  
##############################################
  
info_echo "配置yum源......"
  
if [ ! -f LNMP+zabbix.repo ]; then
  
cat> /etc/yum.repos.d/LNMP+zabbix.repo
页: [1]
查看完整版本: centos6一键安装lnmp+zabbix服务端