一、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