以下是Zabbix的基本安装和配置步骤:
安装Apache、PHP和MySQL:
sudo apt-get install apache2
sudo apt-get install php mysql-server php-mysql
安装Zabbix服务器:
wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu18.04_all.deb
sudo dpkg -i zabbix-release_5.4-1+ubuntu18.04_all.deb
sudo apt-get update
sudo apt-get install zabbix-server-mysql
创建Zabbix数据库:
sudo mysql -u root -p
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
导入Zabbix数据库模式和数据:
sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
配置Zabbix服务器:
sudo nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
启动Zabbix服务器和Zabbix代理:
sudo systemctl start zabbix-server
sudo systemctl start zabbix-agent
配置Zabbix前端:
sudo cp -r /usr/share/zabbix /var/www/html/
sudo nano /etc/zabbix/apache.conf
php_value date.timezone Asia/Shanghai
配置防火墙:
访问Zabbix前端:
/zabbix
,例如:http://<server-ip>/zabbix
这就是Zabbix的基本安装和配置步骤。完成后,您应该能够使用Zabbix监控您的服务器和网络设备。