地址: https://www.zabbix.com/download
# wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4%2Bubuntu22.04_all.deb
# dpkg -i zabbix-release_6.0-4+ubuntu22.04_all.deb
# apt update
用su root
登录后在执行命令
如果不知道root密码,执行命令sudo passwd root
设置root密码
apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent
Make sure you have database server up and running
首先查看Ubuntu中是否安装过mysql
dpkg -l | grep mysql
没有则安装mysql-server
sudo apt install mysql-server
# mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
无报错说明导入正常。
导入完成后,进入数据库查看
mysql> show databases;
mysql>show variables like 'port';
mysql> use zabbix;
mysql> show tables;
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)
异常可以drop重建
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> drop database zabbix;
Query OK, 173 rows affected (6.03 sec)
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.02 sec)
mysql> create user zabbix@localhost identified by 'password';
ERROR 1396 (HY000): Operation CREATE USER failed for 'zabbix'@'localhost'
mysql> select host,user from user;
ERROR 1046 (3D000): No database selected
mysql> drop user zabbix@localhost;
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> create user zabbix@localhost identified by 'password';
Query OK, 0 rows affected (0.03 sec)
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
编辑配置文件 /etc/zabbix/zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
//在129行找到 替换为zaabix数据库密码,注意需要取消该行注释
#DBPassword=password
有问题查看文件权限ls /etc/zabbix/zabbix_server.conf -l
和修改权限chmod 777 /etc/zabbix/zabbix_server.conf
编辑配置文件 /etc/zabbix/nginx.conf uncomment and set ‘listen’ and ‘server_name’ directives.
# listen 8080;
# server_name example.com;
有问题查看文件权限ls /etc/zabbix/zabbix_server.conf -l
和修改权限chmod 777 /etc/zabbix/nginx.conf
启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent nginx php8.1-fpm
# systemctl enable zabbix-server zabbix-agent nginx php8.1-fpm
查看启动的网络netstat -antlp
无法执行命令则安装net-toolsapt install net-tools
验证进程是否启动
ps aux|grep zabbix
ps aux|grep nginx
ps aux|grep php-fpm
http://192.168.79.133:8080
进入安装zabbix安装页面