一、环境准备
[root@ltt01 ~]# ip a
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN qlen
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
link/ether :0c::c5::c5 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.11/ brd 192.168.11.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80:::afb1:2dac:e78a/ scope link
valid_lft forever preferred_lft forever
[root@ltt01 ~]# hostname
ltt01.bg.com
[root@ltt01 ~]# getenforce
Disabled
[root@ltt01 ~]# firewall-cmd --state
not running
[root@ltt01 ~]# cat /etc/redhat-release
CentOS Linux release 7.4. (Core)
[root@ltt01 ~]# uname -r
3.10.-.el7.x86_64
#解决yum 旧版本的GPG keys 问题
[root@ltt01 ~]# rpm --import /etc/pki/rpm-gpg/RPM*
二、安装步骤
1、安装zabbix源
[root@ltt01 ~]# rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2、安装zabbix server
[root@ltt01 ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
3、安装启动 mariadb数据库
[root@ltt01 ~]# yum install -y mariadb-server
[root@ltt01 ~]# systemctl start mariadb.service
4、创建数据库并分配权限
[root@ltt01 ~]# mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
[root@ltt01 ~]# mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
5、建立zabbix相关库表结构并导入数据
[root@ltt01 ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4./create.sql.gz | mysql -uzabbix -pzabbix zabbix
6、配置zabbix server 连接mysql数据库
[root@ltt01 ~]# sed -i.ori '126a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
7、修改zabbix的时区
[root@ltt01 ~]# sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
8、解决中文乱码
[root@ltt01 ~]# yum -y install wqy-microhei-fonts
[root@ltt01 ~]# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
cp: overwrite ‘/usr/share/fonts/dejavu/DejaVuSans.ttf’? y
9、设置开机自启动
[root@ltt01 ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@ltt01 ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@ltt01 ~]# systemctl enable zabbix-service.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
10、启动服务
[root@ltt01 ~]# systemctl start zabbix-server
[root@ltt01 ~]# systemctl start httpd
11、安装zabbix agent
[root@ltt01 ~]# yum install -y zabbix-agent
12、在agent上配置上server ip
[root@ltt01 ~]# sed -i.ori 's#Server=127.0.0.1#Server=192.168.11.11#' /etc/zabbix/zabbix_agentd.conf
13、agent设置开机启动
[root@ltt01 ~]# systemctl enable zabbix-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
14、开启agent
[root@ltt01 ~]# systemctl start zabbix-agent.service
三、访问web
http://192.168.11.11/zabbix/setup.php
点击下一步
以上检测项,哪些有问题可根据提示信息进行解决,所有项目都OK 点击下一步
选择mysql数据库,输入密码即可
默认即可,点击下一步
清单,点击下一步
点击完成就进入zabbix页面了。
进入配置 ----》 主机,点击zabbix server,修改可见名称和 agent ip
更新即可。
到此zabbix安装配置成功。