操作系统:Ubuntu22.04.02LTS zabbix版本:6.0LTS mysql版本:8.0.33,webserver:apache
1、更新系统 apt-get update 、apt-get upgrade
2、安装mysql。apt-get install mysql-server、apt-get install mysql-client、apt-get install libmysqlclient-dev
检查安装是否成功apt-get install net-tools,netstat -tap | grep mysql
mysql安装后,初始修改root密码 mysql -u root -p ,use mysql; update user set password =password('123456') where user ='root' and host='localhost'; flush privileges;
设置数据库开机自启动systemctl enable mysqld.server
3、安装Apache2:apt-get install apache2;
4、安装zabbix服务器,完全按照zabbix给出
来的方案。zabbix官网下载页面有安装说明
a. Install Zabbix repository
# wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu22.04_all.deb
# dpkg -i zabbix-release_6.0-4+ubuntu22.04_all.deb
# apt update
b. Install Zabbix server, frontend, agent
# apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
c. Create initial database
Make sure you have database server up and running.
Run the following on your database host.
# 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;
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Disable log_bin_trust_function_creators option after importing database schema.
# mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
d. Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password
e. Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
# systemctl restart zabbix-server zabbix-agent apache2
# systemctl enable zabbix-server zabbix-agent apache2
f. Open Zabbix UI web page
The default URL for Zabbix UI when using Apache web server is http://host/zabbix
注意事项:mysql数据库错误的话需要反复重新配置,用命令删除database操作等等。
最后,zabbix的默认账号Admin,初始密码zabbix。