文章目录
zabbix5.0 安装
系统环境
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
Install Zabbix repository
# wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+focal_all.deb
# sudo dpkg -i zabbix-release_5.0-1+focal_all.deb
# sudo apt update
Install Zabbix server, frontend, agent
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent
Create initial database
Make sure you have database server up and running.
Run the following on your database host.
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
# 如果数据库没有安装在本机,需要指定 ip 地址
DBHost=host
DBPassword=password
# 如果数据库没有增加 zabbix 用户,需要单独设置用户名和密码
DBUser=user
Configure PHP for Zabbix frontend
Edit file /etc/zabb ix/apache.conf, uncomment and set the right timezone for you.
# php_value date.timezone Europe/Riga 修改为
php_value date.timezone Asia/Shanghai
Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
# systemctl restart zabbix-server zabbix-agent apache2
# systemctl enable zabbix-server zabbix-agent apache2
Configure Zabbix frontend
Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix Follow steps described in Zabbix documentation: Installing frontend
安装后无法设置中文
// 安装中文语言包
# sudo apt-get install language-pack-zh-hant language-pack-zh-hans
设置中文后仍然乱码
将 window 操作系统的字体上传到 zabbix web 所在服务器(上传 .ttf 文件),这里我们选择楷体 simkai.ttf
上传文件到 /usr/share/zabbix/assets/fonts 目录下,然后替换字体
[[email protected] /usr/share/zabbix/assets/fonts]# sed -r -i 's#graphfont#simkai#' /usr/share/zabbix/include/defines.inc.php
刷新界面,字体显示正常