zabbix服务端一键安装脚本
#!/bin/bash
# Zabbix-Server 5.0
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#禁用SELINUX
setenforce 0
#安装zabbix源、修改为aliyun源
cd /etc/yum.repos.d/
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i.bak 's#repo.zabbix.com#mirrors.aliyun.com/zabbix#' zabbix.repo
sed -i 's#enabled=0#enabled=1#' zabbix.repo
yum clean all
#安装zabbix
yum -y install zabbix-server-mysql zabbix-agent
yum -y install centos-release-scl
yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
#安装启动 mariadb数据库
yum -y install mariadb mariadb-server httpd
systemctl start mariadb.service
#创建数据库
mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e 'create user zabbix@localhost identified by "zabbix"' ##这里是zabbix账户密码,我设置的是zabbix
mysql -e 'grant all privileges on zabbix.* to zabbix@localhost;'
mysql -e 'flus