1 配置yum源
[root@node1 ~]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.C71vCh: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-1.el7 ################################# [100%]
[root@node1 ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
2 安装zabbix 相关组件
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb mariadb-server
#启动数据库
systemctl enable mariadb.service
systemctl start mariadb.service
#登录MySQL
[root@node1 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
#创建名为zabbix的库
MariaDB [(none)]> create database zabbix default character set utf8;
Query OK, 1 row affected (0.00 sec)
#授权zabbix用户在 任意主机访问zabbix库
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
3.导入zabbix初始数据库
zcat /usr/share/doc/zabbix-server-mysql-4.0.15/create.sql.gz |mysql -uzabbix -p123 zabbix
4.编辑zabbix-server配置文件,配置数据库信息
[root@node1 ~]# vim /etc/zabbix/zabbix_server.conf
#给DBPassword去掉注释加上密码
DBPassword=123
[root@node1 ~]# cat /etc/zabbix/zabbix_server.conf |grep "^DB"
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123
[root@node1 ~]# vim /etc/php.ini
date.timezone=Aaia/Shanghai
5.启动所有服务
[root@node1 ~]# systemctl enable httpd zabbix-server zabbix-agent
[root@node1 ~]# systemctl start httpd zabbix-server zabbix-agent
#查看相关端口是否监听:
[root@node1 ~]# netstat -ntlp | grep 10051 (server监听)
[root@node1 ~]# netstat -ntlp | grep 10050 (client监听)
6.浏览器访问:
使用默认管理员登录
账号:admin
密码:zabbix
7.修改语言
中文乱码解决:
将我们选择的字体文件上传到zabbix web服务,/usr/share/zabbix/assets/fonts目录下(rpm安装目录)
rm -rf graphfont.ttf
mv simkai.ttf graphfont.ttf
权限是644
chmod 644 graphfont.ttf
(graphfont.ttf是上传的文件包)