一 安装Mysql 8.03
test@test:~$ mysqld --version
/usr/sbin/mysqld Ver 8.0.36-2ubuntu3 for Linux on x86_64 ((Ubuntu))
#mysql 大于8.03.x ,启动zabbix-server会报错如下
Unable to start Zabbix server due to unsupported MySQL database version (8.04.00).
Must not be higher than (8.03.x).
Use of supported database version is highly recommended.
Override by setting AllowUnsupportedDBVersions=1 in Zabbix server configuration file at your own risk.
二 安装Zabbix
1 安装Zabbix repository
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_7.0-1+ubuntu24.04_all.deb
sudo apt update
2 安装Zabbix server,Web前端,agent
sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-agent php8.3-fpm zabbix-nginx-conf
3 查看版本
#test@test:~$ zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 7.0.0
Revision 49955f1fb5c 3 June 2024, compilation time: Jun 3 2024 05:55:33
Copyright (C) 2024 Zabbix SIA
License AGPLv3: GNU Affero General Public License version 3 <https://www.gnu.org/licenses/>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Compiled with OpenSSL 3.0.13 30 Jan 2024
Running with OpenSSL 3.0.13 30 Jan 2024
#test@test:~$ zabbix_server -V
zabbix_server (Zabbix) 7.0.0
Revision 49955f1fb5c 3 June 2024, compilation time: Jun 3 2024 05:55:33
Copyright (C) 2024 Zabbix SIA
License AGPLv3: GNU Affero General Public License version 3 <https://www.gnu.org/licenses/>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).
Compiled with OpenSSL 3.0.13 30 Jan 2024
Running with OpenSSL 3.0.13 30 Jan 2024
4 创建数据库和导入数据库
#sudo mysql -uroot -p
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.01 sec)
mysql> create user zabbix@'%' IDENTIFIED WITH mysql_native_password BY '密码';
Query OK, 0 rows affected (0.02 sec)
mysql> grant all privileges on zabbix.* to zabbix@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit
#导入数据
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
#
mysql -uroot -p
mysql> set global log_bin_trust_function_creators = 0;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> quit
5 Zabbix server配置数据库
sudo vim /etc/zabbix/zabbix_server.conf
# DBPassword= --> DBPassword="密码"
6 修改nginx 配置文件
sudo vim /etc/nginx/conf.d/zabbix.conf
# listen 8080; --> listen 80;
# server_name example.com; --> server_name 192.168.50.1 example.com;
7 启动Zabbix server和agent 服务
sudo systemctl restart zabbix-server zabbix-agent nginx php8.3-fpm
sudo systemctl enable zabbix-server zabbix-agent nginx php8.3-fpm
8 访问web安装
三 登录配置(默认用户密码Admin:zabbix)
1 中文支持
sudo apt-get install language-pack-zh-hant language-pack-zh-hans
#
reboot
#上传windows 的字体,解决图形界面中文乱码问题
cd /usr/share/zabbix/assets/fonts
sudo cp graphfont.ttf graphfont.ttf_bak
sudo mv /home/test/STSONG.TTF graphfont.ttf
#重新启动服务
sudo systemctl restart zabbix-server
2 修改默认密码