zabbix 安装
一、 关闭防火墙和 关闭selinux防火墙1
2
3sudo systemctl stop firewalld.service
sudo setenforce 0
reboot
二、安装Zabbix rpm包仓库1
sudo rpm -vhi http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
三、安装zabbix-server-mysql和zabbix-web-mysql1
sudo yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
四、安装并且启动mysql5.6及初始化数据库信息1
2
3
4
5sudo rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm
sudo yum install -y mysql-community-server
sudo systemctl start mysqld
sudo /sbin/chkconfig mysqld on 或者 sudo systemctl enable mysqld
sudo mysql_secure_installation #初始化数据库信息
或者安装Mariadb1
2
3sudo yum -y install mariadb mariadb-devel mariadb-server # centos7下安装的是mariadb
sudo systemctl enable mariadb
sudo systemctl start mariadb
五、创建zabbix数据库,创建zabbix账号1
2
3
4
5
6
7
8
9
10mysql -uroot -p
...
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
六、导入默认的zabbix数据库信息1
2cd /usr/share/doc/zabbix-server-mysql-3.0.12/
zcat create.sql.gz | mysql zabbix -uzabbix -pzabbix
七、修改zabbix_server.conf的配置文件1
2
3
4
5sudo vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
数据库连不上报[Z3005]错误
解决方法:1
2
3
4sudo systemctl stop zabbix-server
sudo zcat /usr/share/doc/zabbix-server-mysql-*/create.sql.gz | mysql -uzabbix -pDBPassword zabbix
systemctl start zabbix-server
sudo cat /var/log/zabbix/zabbix_server.log
八、修改配置文件/etc/httpd/conf.d/zabbix.conf,时区改成 Asia/Shanghai
1 | sudo vim /etc/httpd/conf.d/zabbix.conf |
九、启动apache/zabbix-server服务并设置为开机启动
1 | sudo systemctl start httpd |
查看日志1
sudo tailf /var/log/zabbix/zabbix_server.log