[root@localhost src]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@localhost src]# pwd
/usr/local/src
配置zabbix的yum源
[root@localhost src]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
安裝zabbix程序包,安裝mysql、zabbxi-agent
[root@localhost src]# yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server
這個時候有可能會報報錯:“zabbix-web-3.4.15-1.el7.noarch: [Errno 256] No more mirrors to try”
解決辦法:更換yum源,具體步驟如下:
[root@localhost src]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -P /etc/yum.repos.d/
[root@localhost src]# yum clean all
[root@localhost src]# yum makecache
啟動mariadb並設置開機啟動,創建數據庫實例,授權
[root@localhost src]# systemctl start mariadb
[root@localhost src]# systemctl enable mariadb
登陸mysql
[root@localhost src]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; #創建數據庫實例
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix'; #授權所有主機訪問數據庫實例zabbix,用戶名/密碼:zabbix/Zabbix
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #授權localhost主機名訪問數據庫實例zabbix,用戶名/密碼:zabbix/Zabbix
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost.localdomain identified by 'zabbix'; #授權localhost.localdomain主機訪問數據庫實例zabbix,用戶名/密碼:zabbix/Zabbix
導入初始模式和數據
進入create.sql.gz所在目錄:
[root@localhost src]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/
導入初始模式:
[root@localhost zabbix-server-mysql-3.4.15]# zcat create.sql.gz |mysql -uroot zabbix
啟動zabbix-server服務
配置zabbix-server的配置文件zabbix_server.conf:
[root@localhost zabbix-server-mysql-3.4.15]# grep -n "^DB" /etc/zabbix/zabbix_server.conf
91:DBHost=localhost
98:DBName=zabbix
113:DBUser=zabbix
122:DBPassword=zabbix
啟動zabbix-server服務:
[root@localhost zabbix-server-mysql-3.4.15]# systemctl start zabbix-server
[root@localhost zabbix-server-mysql-3.4.15]# systemctl enable zabbix-server
編輯Apache的配置文件,消注釋設置正確的時區
[root@localhost zabbix-server-mysql-3.4.15]# grep -n "date.timezone" /etc/httpd/conf.d/zabbix.conf
20: php_value date.timezone Asia/Shanghai
啟動httpd服務 ,設置開機啟動httpd服務
[root@localhost zabbix-server-mysql-3.4.15]# systemctl start httpd
[root@localhost zabbix-server-mysql-3.4.15]# systemctl enable httpd
啟動zabbix-agent並設置開機自啟動
[root@localhost zabbix-server-mysql-3.4.15]# systemctl start zabbix-agent
[root@localhost zabbix-server-mysql-3.4.15]# systemctl enable zabbix-agent
Zabbix Web網頁安裝
在瀏覽器輸入地址http://服務器ip/zabbix/setup.php,出現歡迎界面,點擊下一步
出現必要條件檢測界面,正常都是OK,點擊下一步
配置DB連接,與zabbix_server.conf文件中主機、數據庫名稱、用戶名、密碼保持一致,點擊下一步
zabbix服務器詳細信息,點擊下一步
安裝前匯總,檢查信息無誤,點擊下一步安裝
安裝成功會出現提示成功的界面。
然后點擊“Finish“按鈕。結束安裝。
zabbix網頁登錄
在瀏覽器輸入http://zabbix服務器ip/zabbix/index.php,輸入管理員用戶名Admin(區分大小寫),默認密碼zabbix,點擊登入即可。
接下來就是開啟各種監控配置研究了!!!