1、安装zabbix
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum makecache fast
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server
2、创建数据库和zabbix用户
systemctl start mariadb
mysql_secure_installation
mysql -uroot -p123456
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
flush privileges;
3、导入初始架构和数据
zcat /usr/share/doc/zabbix-server-mysql-4.0.13/create.sql.gz | mysql -uzabbix -pzabbix zabbix
4、为Zabbix server配置数据库
vim /etc/zabbix/zabbix_server.conf
#修改配置文件
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
5、为Zabbix前端配置PHP
vim /etc/httpd/conf.d/zabbix.conf
#修改配置文件
php_value date.timezone Asia/Shanghai
6、启动Zabbix server
systemctl start zabbix-server
systemctl start httpd
PS:
解决中文乱码
解决方法:安装字体并替换现有字体
yum install wqy-microhei-fonts -y
cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf
7、登录zabbix配置、使用
ip地址/zabbix
账号:Admin
密码:zabbix