安装 Zabbix repository
root@Zabbix-Server:~#wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_6.0+ubuntu22.04_all.deb
root@Zabbix-Server:~#dpkg -i zabbix-release_latest_6.0+ubuntu22.04_all.deb
#建议更改为国内镜像源
root@Zabbix-Server:~#sed -i.bak 's#https://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#' /etc/apt/sources.list.d/zabbix.list
root@Zabbix-Server:~#apt update安装Zabbix server,Web前端,agent
root@Zabbix-Server:~#apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent安装Mysql,创建初始数据库
##这里忽略安装方式;注意如果使用mysql8.0的话,可能还需更改密码验证插件
root@Zabbix-Server:~#bash install_mysql.sh
root@Zabbix-Server:~#mysql -uroot
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by '123456';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;导入初始架构和数据,系统将提示您输入新创建的密码。
root@Zabbix-Server:~#zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix -h 10.0.0.100Disable log_bin_trust_function_creators option after importing database schema.
root@Zabbix-Server:~#mysql -uroot
mysql> set global log_bin_trust_function_creators = 0;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
root@Zabbix-Server:~#vim /etc/zabbix/zabbix_server.conf
DBPassword=123456为Zabbix前端配置PHP
root@Zabbix-Server:~#vim /etc/zabbix/nginx.conf
listen 80;
server_name zabbix.xiaopohai.icu;启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
root@Zabbix-Server:~#systemctl restart zabbix-server zabbix-agent nginx php8.1-fpm
root@Zabbix-Server:~#systemctl enable zabbix-server zabbix-agent nginx php8.1-fpm