注:這次是採用的rpm包方式安裝,因此服務器必需要能鏈接互聯網經過yum方式解決依賴關係php
①系統:mysql
[root@zabbix ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
②軟件:linux
zabbix-3.4.0web
關閉防火牆和SElinuxsql
[root@zabbix ~]# systemctl stop firewalld.service [root@zabbix ~]# systemctl disable firewalld.service [root@zabbix ~]# vim /etc/selinux/config SELINUX=enforcing改成SELINUX=disabled [root@zabbix ~]# reboot
[root@zabbix ~]# wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm [root@zabbix ~]# rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm 警告:zabbix-release-3.4-2.el7.noarch.rpm: 頭V4 RSA/SHA512 Signature, 密鑰 ID a14fe591: NOKEY 準備中... ################################# [100%] 正在升級/安裝... 1:zabbix-release-3.4-2.el7 ################################# [100%]
下載地址:http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/數據庫
各類包的做用:vim
服務端瀏覽器
zabbix-server-mysql-3.4.0-1.el7.x86_64.rpm //zabbix鏈接mysql的程序包 zabbix-web-3.4.0-1.el7.noarch.rpm //web界面程序包 zabbix-web-mysql-3.4.0-1.el7.noarch.rpm //web程序鏈接mysql的程序包 zabbix-get-3.4.0-1.el7.x86_64.rpm //獲取agent端信息的程序包
被監控端安全
zabbix-agent-3.4.0-1.el7.x86_64.rpm //zabbix的agent程序 zabbix-sender-3.4.0-1.el7.x86_64.rpm //agent端主動發送信息的程序
安裝 [root@zabbix ~]# yum install mariadb-server -y [root@zabbix ~]# systemctl start mariadb [root@zabbix ~]# ss -tnl | grep 3306 LISTEN 0 50 *:3306 *:* #安全初始化數據庫 [root@zabbix ~]# mysql_secure_installation Enter current password for root (enter for none): Set root password? [Y/n] y New password: Re-enter new password: Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] n Reload privilege tables now? [Y/n] y #編輯my.cnf加入如下兩項參數 innodb_file_per_table=1 skip_name_resolve=1 [root@zabbix ~]# systemctl restart mariadb [root@zabbix ~]# systemctl enable mariadb
MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix123'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)
2.6 測試數據庫是否能登陸服務器
[root@zabbix ~]# mysql -u zabbix -p Enter password: MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | test | | zabbix | +--------------------+ 3 rows in set (0.00 sec)
由於服務端自身也要被監控(如若否則誰來監控錦衣衛?)因此也須要安裝agent端的程序,後面的被監控點就只須要安裝agnet便可,另外還提一點就是 web展現的服務不必定非要和zabbixserver端裝在一塊兒,也能夠分離。
[root@zabbix ~]# cd zabbix3.4.0/ [root@zabbix zabbix3.4.0]# ll 總用量 5384 -rw-r--r-- 1 root root 361136 8月 22 2017 zabbix-agent-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 247312 8月 22 2017 zabbix-get-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 258700 8月 22 2017 zabbix-sender-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2046168 8月 22 2017 zabbix-server-mysql-3.4.0-1.el7.x86_64.rpm -rw-r--r-- 1 root root 2577060 8月 22 2017 zabbix-web-3.4.0-1.el7.noarch.rpm -rw-r--r-- 1 root root 5972 8月 22 2017 zabbix-web-mysql-3.4.0-1.el7.noarch.rpm [root@zabbix zabbix3.4.0]# yum localinstall *.rpm -y //會自動解決依賴關係
編譯安裝的ZABBIX的sql文件會在web程序的文件夾中,可是咱們這裏是rpm方式安裝,因此sql文件並不是和tar包同樣而且再也不是3個.sql文件,而是一個create.sql.gz的壓縮文件
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.0/ [root@zabbix zabbix-server-mysql-3.4.0]# ll 總用量 2028 -rw-r--r-- 1 root root 98 8月 21 2017 AUTHORS -rw-r--r-- 1 root root 777403 8月 21 2017 ChangeLog -rw-r--r-- 1 root root 17990 8月 21 2017 COPYING -rw-r--r-- 1 root root 1263114 8月 21 2017 create.sql.gz [root@zabbix zabbix-server-mysql-3.4.0]# gunzip -c create.sql.gz > create.sql [root@zabbix zabbix-server-mysql-3.4.0]# mysql -uzabbix -pzabbix123 -Dzabbix < create.sql 導入完成後檢查數據庫,成功導入的話一共是140張表 | users_groups | | usrgrp | | valuemaps | | widget | | widget_field | +----------------------------+ 140 rows in set (0.00 sec) MariaDB [zabbix]>
[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf 改以下幾項,有註釋的就去掉註釋 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix123
[root@zabbix ~]# vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1,192.168.116.137 //被動讓server端採集數據的,服務器地址能夠有多個,使用逗號隔開 ServerActive=127.0.0.1,192.168.116.137 //主動向zabbix-server發送數據,注意這是server端,因此127.0.0.1不能刪除不然會報錯 Hostname=Zabbix server //agent名稱,若是是採用主動發送數據這個名稱必須全局惟一
[root@zabbix ~]# systemctl enable zabbix-server.service [root@zabbix ~]# systemctl enable zabbix-agent.service [root@zabbix ~]# systemctl enable httpd.service
[root@zabbix ~]# systemctl start zabbix-server [root@zabbix ~]# systemctl start zabbix-agent [root@zabbix ~]# systemctl start httpd
[root@zabbix ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 *:3306 *:*LISTEN 0 128 *:10050 *:* LISTEN 0 128 *:10051 *:*LISTEN 0 128 :::80 :::*LISTEN 0 128 :::10050 :::* LISTEN 0 128 :::10051 :::*
[root@zabbix ~]# vim /etc/php.ini ;date.timezone = 改成 date.timezone = Asia/Shanghai
瀏覽器訪問 http://192.168.116.137/zabbix
下一步後會進行條件檢查,符合後才能下一步
這個地方的參數和上面改zabbix-server配置文件的參數同樣
用戶名 Admin (必定要大寫A)
密碼 zabbix
改成中文顯示
至此zabbix的安裝已經完成,下一篇文件將介紹zabbix的使用