环境以及前期准备:

·系统版本:Ubuntu 20.04.4 LTS

·安装mysql (apt-get install mysql-server)

·生成数据库随机密码ai6GdROlHLo (openssl rand -base64 8)

1,点击官网链接,根据选择的平台官网生成安装步骤

https://www.zabbix.com/cn/download

2,安装zabbix源(更快的安装zabbix组件)

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_6.4-1+ubuntu20.04_all.deb
apt update

3,安装zabbix server、web前端、agent

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

4、初始化数据库

# mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'ai6GdROlHLo';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;

5、导入初始架构和数据,会提示输入初始化数据库设置的密码。

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

6、导入数据库后禁用log_bin_trust_function_creators

# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;

7、zabbix server配置数据库

sudo vim /etc/zabbix/zabbix_server.conf
DBPassword=ai6GdROlHLo

8、重启zabbix服务并设置开机自启

systemctl restart zabbix-server zabbix-agent apache2
 systemctl enable zabbix-server zabbix-agent apache2

https://ip/zabbix 访问wen界面

注意:

zabbix默认字体图形显示会有乱码,从windows字体库中找到一个中文字体复制到 /usr/share/zabbix/assets/fonts路径,替换掉zabbix默认的graphfont.ttf