1.下载安装zabbix配置文件
$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
2.安装zabbix系列组件
$sudo apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent mysql-server
3.登录数据库,进行授权等操作
$sudo mysql -uroot -p
Enter password: 输入zabbix Welcome to the
MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)Copyright © 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.00 sec)mysql> create user zabbix@localhost identified by ‘zabbix’;
Query OK, 0 rows affected (0.01 sec)mysql> grant all privileges on zabbix.* to zabbix@localhost;
Query OK,0 rows affected (0.00 sec)mysql> quit
Bye
4.导入初始模式和数据以初始化数据库
$sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 输入zabbix
5.Zabbix服务器数据库配置
$sudo vim /etc/zabbix/zabbix_server.conf
修改如下几个参数:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
6.启动zabbix服务器进程
service zabbix-server start
7.查看端口状态
$netstat -ntpl | grep zabbix
(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 47708/zabbix_agentd
tcp6 0 0 :::10050 :: LISTEN 47708/zabbix_agentd
8.配置PHP
$sudo vim /etc/zabbix/apache.conf
修改配置文件以下字段:(修改两处)
php_value date.timezone Asia/Shanghai
重启apache
service apache2 restart
9.访问zabbix端
在浏览器中输入:http://IP/zabbix
若均为OK说明配置正确生效,如果有红叉则需要查看之前相应的修改配置项
点击‘Next step’后出现配置数据库连接界面
Password处填写zabbix
点击‘Next step’后出现zabbix服务器信息界面
Name处填写zabbix
点击“Next step”后会展示之前安装的配置项,再次点击“Next step”即可进入安装。
安装完成后点击Finish
登录zabbix
Username: Admin Password: zabbix
修改语言