复制到脚本./执行 即可:wq
#!/bin/bash
hostnamectl set-hostname zabbix-server
systemctl stop firewalld
systemctl disable firewalld
sed -i ‘s/=enforcing/=disabled/’ /etc/sysconfig/selinux
sed -i ‘s/=enforcing/=disabled/’ /etc/selinux/config
setenforce 0
yum install net-tools bash-completion wget vim ntpdate -y
ntpdate cn.pool.ntp.org
hwclock -w
yum install httpd mariadb mariadb-server php php-mysql php-gd -y
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
cd /etc/pki/rpm-gpg
wget https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
yum clean all
yum makecache
yum makecache -y
cd
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
sed -i ‘s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g’ /etc/httpd/conf.d/zabbix.conf
systemctl start mariadb
systemctl enable mariadb
mysql -e “create database zabbix character set utf8;”
mysql -e “grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;”
mysqladmin flush-privileges
cd /usr/share/doc/zabbix-server-mysql-4.0.14/
zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix
mysql -uzabbix -pzabbix -e ‘use zabbix;show tables;’
sed -i ‘s/DBName=.*$/DBName=zabbix/g’ /etc/zabbix/zabbix_server.conf
echo “DBUser=zabbix” >>/etc/zabbix/zabbix_server.conf
echo “DBPassword=zabbix” >>/etc/zabbix/zabbix_server.conf
systemctl restart zabbix-server.service httpd.service
systemctl enable zabbix-server.service httpd.service