1、更換yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache
2、開始yum安裝
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 會在/etc/yum.repos.d/生産一個zabbix.repo的檔案
3、安裝相關軟體包元件
yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb -y
4、修改php時區
sed -i 's@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g' /etc/httpd/conf.d/zabbix.conf
5、配置資料庫,建立zabbix資料庫及使用者
systemctl start mariadb mysql create database zabbix character set utf8 collate utf8_bin; grant all on zabbix.* to zabbix@'localhost' identified by '123456'; exit
6、導入資料庫
cd /usr/share/doc/zabbix-server-mysql-4.0.9/ zcat create.sql.gz |mysql -uzabbix -p123456 zabbix
7、修改zabbix配置檔案
vim /etc/zabbix/zabbix_server.conf DBHost=localhost #資料庫所在主機 DBName=zabbix #資料庫名 DBUser=zabbix #資料庫使用者 DBPassword=123456 #資料庫密碼
8、啟動zabbix及apache
systemctl start zabbix-server systemctl start httpd
通路zabbix
http://IP位址/zabbix