2019年12月29日 星期日

zabbix安裝

https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#

https://www.zabbix.com/download




1.先安裝nginx跟mysql資料庫

yum install -y epel-release

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm


yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent




2.到mysql新增 zabbix資料庫+給予權限

# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
然後再輸入zabbix的資料庫密碼


3.修改設定檔 變更資料庫密碼
vim /etc/zabbix/zabbix_server.conf
DBPassword=password

4.安裝好nginx之後,在/etc/nginx/conf.d/底下會產生一個zabbix.conf的vhost設定檔,請編輯
vim /etc/nginx/conf.d/zabbix.conf
把以下兩個設定註解拿掉,記得給一個server name這樣才不會跟其他vhost衝突
listen 80;
server_name example.com;

5.修改時區
vim /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Taipei

6.重啟相關服務
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm


7.之後請打開網頁,就照著網頁指示完成