此脚本是LAMP环境搭建Zabbix监控平台自动化安装脚本,有需要朋友可以参考,脚本内容如下:
系统环境:CentOS 7.4
软件版本:
Apache:2.4.29
Mysql:5.7.29
PHP:7.3.7
Zabbix:4.4.3
[root@localhost ~]# vim auto_install_lamp_zabbix.sh
代码语言:javascript复制#!/bin/bash
#Date:2018-5-20 14:08:55
#Author Blog:
# https://www.yangxingzhen.com
#Author WeChat:
# 微信公众号:小柒博客
#Author mirrors site:
# https://mirrors.yangxingzhen.com
#About the Author
# BY:YangXingZhen
# Mail:xingzhen.yang@yangxingzhen.com
#Auto Install LAMP Environment And Zabbix
source /etc/rc.d/init.d/functions
#Define APR path variables
APR_URL=https://mirrors.yangxingzhen.com/apr
APR_FILES=apr-1.6.5.tar.gz
APR_FILES_DIR=apr-1.6.5
APR_PREFIX=/usr/local/apr
#Define APR-util path variables
APR_UTIL_URL=https://mirrors.yangxingzhen.com/apr-util
APR_UTIL_FILES=apr-util-1.6.1.tar.gz
APR_UTIL_FILES_DIR=apr-util-1.6.1
APR_UTIL_PREFIX=/usr/local/apr-util
#Define PCRE path variables
PCRE_URL=https://mirrors.yangxingzhen.com/pcre
PCRE_FILES=pcre-8.41.tar.gz
PCRE_FILES_DIR=pcre-8.41
PCRE_PREFIX=/usr/local/pcre
#Define Apache path variables
APACHE_URL=https://mirrors.yangxingzhen.com/apache
APACHE_FILES=httpd-2.4.39.tar.gz
APACHE_FILES_DIR=httpd-2.4.39
APACHE_PREFIX=/usr/local/apache
APACHE_INIT_FILE=/etc/init.d/httpd
#Define Boost path variables
Boost_URL=https://mirrors.yangxingzhen.com/mysql
Boost_File=boost_1_59_0.tar.gz
#Define Mysql path variables
MYSQL_URL=http://mirrors.163.com/mysql/Downloads/MySQL-5.7
MYSQL_FILES=mysql-5.7.29.tar.gz
MYSQL_FILES_DIR=mysql-5.7.29
MYSQL_PREFIX=/usr/local/mysql
MYSQL_DIR=/data/mysql
MYSQL_USER=mysql
#Define ZIP path variables
ZIP_URL=https://nih.at/libzip
ZIP_FILE=libzip-1.2.0.tar.gz
ZIP_FILE_DIR=libzip-1.2.0
#Define PHP path variables
PHP_URL=http://mirrors.sohu.com/php
PHP_FILE=php-7.3.7.tar.gz
PHP_FILE_DIR=php-7.3.7
PHP_PREFIX=/usr/local/php
USER=apache
#Define Zabbix path variables
ZABBIX_URL=http://mirrors.yangxingzhen.com/zabbix
ZABBIX_FILES=zabbix-4.4.3.tar.gz
ZABBIX_FILES_DIR=zabbix-4.4.3
ZABBIX_PREFIX=/usr/local/zabbix
function Install_Apache (){
#Install APR
if [ ! -d ${APR_PREFIX} ];then
yum -y install gcc gcc-c wget
cd ${HOME} && wget -c ${APR_URL}/${APR_FILES}
tar zxf ${APR_FILES}
cd ${APR_FILES_DIR}
./configure --prefix=${APR_PREFIX}
if [ $? -eq 0 ];then
make && make install
action "The APR Install Sussess..." /bin/true
else
aciton "The APR Install Failed..." /bin/false
exit 1
fi
else
echo -e "