一、基本信息
Zabbix 官网 https://www.zabbix.com
Zabbix 中文社区 http://www.zabbix.org.cn/
下载 https://www.zabbix.com/download?zabbix=4.2&os_distribution=centos&os_version=7&db=mysql
二、系统、工具配置信息
1、系统版本:CentOS-7-x86_64-Minimal-1708
2、工具:xshell5
3、VMware 版本:VMware Workstation Pro15
4、数据库:Mysql (MariaDB)
5、httpd
三、安装部署
1、安装基本工具
[root@localhost ~]# yum install -y lrzsz vim wget rpm
2、安装 httpd
参考 https://blog.csdn.net/llwy1428/article/details/93907895
3、安装mysql数据库
参考 https://blog.csdn.net/llwy1428/article/details/84965680
4、安装 php 环境
[root@localhost ~]# yum install -y php php-mysql
5、安装 Zabbix
下载安装包
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
6、安装 Zabbix server, frontend, agent
[root@localhost ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
7、创建 zabbix 数据库并设置其密码 (此处我设置的密码是: root )
[root@localhost ~]# mysql -uroot -proot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'root';
[root@localhost ~]# mysql -uroot -proot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.60-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.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'root';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit;
Bye
8、系统初始化,系统将提示您输入新创建的密码(此处我设置的密码是: root )
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
9、为Zabbix服务器配置数据库
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
10、为Zabbix前端配置PHP,并设置时区 此处我改为了 Asia/Shanghai
[root@localhost ~]# vim /etc/httpd/conf.d/zabbix.conf
11、修改(关闭)SELinux
[root@localhost ~]# vim /etc/selinux/config
SELINUX="" 为 disabled ,然后重启。
如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
12、重启服务,并设置开机启动
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
13、浏览器配置 Zabbix 前端,配置 Zabbix
http://节点IP/zabbix
默认用户 Admin 默认密码 zabbix
基本信息配置完毕。
四、修改平台的语言
五、解决中文乱码无法显示的问题
在点击查看各个页面的过程中,可能会发现有中文乱码问题。
找到文件(根据自己的需要进行选择字体):
[root@localhost ~]# cd /etc/alternatives/
[root@localhost alternatives]# ll
可以看到最后一行:
zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
查看目录
[root@localhost ~]# cd /usr/share/fonts/dejavu/
[root@localhost dejavu]# ll
上传并修改文件名
重启web server
[root@localhost ~]# systemctl restart zabbix-server
[root@localhost ~]# service httpd restart
此时再去查看各个页面,发现乱码问题已解决
至此,记一次 Centos7 搭建 Zabbix 4.2 操作完毕!