一、Zabbix安裝部署環境準備
Zabbix-server:192.168.0.70
Zabbix-agent:192.168.0.71,192.168.0.72
[root@shijie70 ~]# cat /etc/redhat-release // 查看系統版本
CentOS Linux release 7.4.1708 (Core)
[root@shijie70 ~]# uname -r // 查看內核版本
3.10.0-693.el7.x86_64
[root@shijie70 ~]# getenforce // 檢測selinux是否關閉
Enforcing
[root@shijie70 ~]# vim /etc/selinux/config // 關閉selinux
[root@shijie70 ~]# setenforce 0
[root@shijie70 ~]# systemctl stop firewalld // 關閉防火牆
[root@shijie70 ~]# systemctl disable firewalld // 關閉防火牆開機自啓動
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
二、安裝MySQL,並初始化
1)安裝數據庫
[root@shijie70 ~]# yum install -y mariadb-server
2)設root用戶密碼
方式一:
[root@shijie70 ~]# mysqladmin -u root password bigdata
方式二:
[root@shijie70 ~]# mysql
MariaDB [(none)]> GRANT ALL PRIVILEGES on *.* to 'root'@'%' IDENTIFIED BY 'bigdata' WITH GRANT OPTION;
初始化zabbix庫、表用戶
[root@shijie70 ~]# mysql -u root -pbigdata
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@shijie70 identified by 'zabbix';
三、安裝zabbix
1)安裝zabbix的yum源
[root@shijie70 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo
[root@shijie70 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.xkX1TU: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-3.4-2.el7 ################################# [100%]
[root@shijie70 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo zabbix.repo
[root@shijie70 ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
2)安裝:
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
3)初始化zabbix數據
[root@shijie70 ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.9/create.sql.gz |mysql -u zabbix -pzabbix zabbix
[root@shijie70 ~]# mysql -uroot -pbigdata -e "use zabbix;show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
+--------------------+
4)在Zabbix_server.conf編輯數據庫配置
[root@shijie70 ~]# vim /etc/zabbix/zabbix_server.conf
[root@shijie70 ~]# grep -vE "^#|^$" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
5)啓動zabbix服務器進程
[root@shijie70 ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@shijie70 ~]# systemctl start zabbix-server
[root@shijie70 ~]# systemctl status zabbix-server
6)編輯zabbix前端php配置
7)改變配置文件後,啓動Apache Web服務器
[root@shijie70 ~]# systemctl start httpd
[root@shijie70 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
四、配置zabbix web
1)http://192.168.0.70/zabbix/setup.php
安裝嚮導一:
安裝嚮導二:
安裝嚮導三:
安裝嚮導四:
安裝嚮導五,回顧概要:
安裝嚮導,成功提示:
Zabbix登錄準備。默認用戶名/密碼爲Admin/zabbix