以下是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監控您的服務器和網絡設備。