##########安装zabbix-3.0.19##########
wget https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
rpm -ivh zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql;
##########配置apache##########
#需要修改主机名和时区
sed -i "s@^#ServerName www.example.com:80@ServerName localhost:80@g" /etc/httpd/conf/httpd.conf
sed -i "s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g" /etc/httpd/conf.d/zabbix.conf
systemctl start httpd
^start^enable
##########配置数据库##########
yum -y install mariadb-server mariadb
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
mysql -uroot -pmariadb00 -e "create database zabbix character set utf8 collate utf8_bin;grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix00';"
##########导入zabbix数据库##########
zcat /usr/share/doc/zabbix-server-mysql-3.0.19/create.sql.gz | mysql -uzabbix -pzabbix00 zabbix
mysql -uzabbix -pzabbix00 -e "use zabbix;show tables;" | wc -l #114行
##########修改zabbix-server配置文件##########
sed -ir -e "s@^# DBHost=.*@DBHost=localhost@g" \
-e "s@^# DBPassword=.*@DBPassword=zabbix00@g" \
-e "s@^DBName=.*@DBName=zabbix@g" \
-e "s@DBUser=.*@DBUser=zabbix@g" /etc/zabbix/zabbix_server.conf
systemctl start zabbix-server #监听端口10051
^start^enable
systemctl start httpd
^start^enable
#浏览器开始配置 http://localhost/zabbix
#默认zabbix账号: Admin 密码 : zabbix