1. 程式人生 > >在CentOS 7上搭建Zabbix

在CentOS 7上搭建Zabbix

先最小安裝CentOS7

安裝源:http://mirrors.163.com/centos/7/os/x86_64/

軟體選擇:最小安裝基本功能

 

新增epel源

yum install epel-release

 

命令自動補全

yum install bash-completion

 

更新系統

yum update

 

安裝資料庫

yum install mariadb-server

 

啟動資料庫

systemctl start mariadb.service

配置資料庫賬號

mysql_secure_installation

 

安裝web環境

yum install php php-mysql httpd

 

安裝zabbix庫及程式

# rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

 

建立初始資料庫

# mysql -uroot -p

password

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to [email protected] identified by 'password';

mysql> quit;

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

 

修改zabbix server配置檔案資料庫連線密碼

Edit file /etc/zabbix/zabbix_server.conf

DBPassword=password

 

修改前端PHP配置檔案的時區

Edit file /etc/httpd/conf.d/zabbix.conf, uncomment and set the right timezone for you.

# php_value date.timezone Asia/Shanghai

 

啟動服務程式

systemctl start mariadb.service

systemctl enable mariadb.service

systemctl start zabbix-server.service

systemctl enable zabbix-server.service

systemctl start zabbix-agent.service

systemctl enable zabbix-agent.service

systemctl start httpd.service

systemctl enable httpd.service

 

允許防火牆http訪問

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --reload

 

進行web控制檯設定

http://zabbixhost/zabbix/

填寫資料庫連線資訊等完成設定

 

setsebool -P httpd_can_network_connect on selinux 允許它通過httpd服務