CentOS 7.2安装Zabbix 3.2图文详解
这篇文章主要介绍了CentOS 7.2下安装Zabbix 3.2图文教程的相关资料,非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下。
1、安装环境:VMware虚拟机
[root@localhost ~]# cat /etc/RedHat-release
CentOS Linux release 7.2.1511 (Core)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
2、为方便你参考,发一下官方文档:
https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
3、安装zabbix需要epel源,因为需要一款名叫fping的软件(这款软件你下载源码编译安装貌似行不通!),然后其他的yum源将mysql全部识别为mariadb了,所以想yum安装mysql的小伙伴请安装mysql社区版官方源,或者你编译安装吧
wget https://mirrors.tuna.tsinghua.edu.cn/epel//epel-release-latest-7.noarch.rpm
yum安装
yum install -y epel-release-latest-7.noarch.rpm
rpm安装
rpm -ivh epel-release-latest-7.noarch.rpm
4、下载zabbix安装包rpm格式,根据这个网址选择需要安装包下载
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.1-1.el7.x86_64.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-get-3.2.1-1.el7.x86_64.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-proxy-mysql-3.2.1-1.el7.x86_64.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-sender-3.2.1-1.el7.x86_64.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-server-mysql-3.2.1-1.el7.x86_64.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-web-3.2.1-1.el7.noarch.rpm
http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-web-mysql-3.2.1-1.el7.noarch.rpm
5、查看zabbix需要的安装包
yum install zabbix-*
Dependencies Resolved
===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Installing:
zabbix-agent x86_64 3.2.1-1.el7 /zabbix-agent-3.2.1-1.el7.x86_64 1.1 M
zabbix-get x86_64 3.2.1-1.el7 /zabbix-get-3.2.1-1.el7.x86_64 862 k
zabbix-proxy-mysql x86_64 3.2.1-1.el7 /zabbix-proxy-mysql-3.2.1-1.el7.x86_64 2.2 M
zabbix-release noarch 3.2-1.el7 /zabbix-release-3.2-1.el7.noarch 21 k
zabbix-sender x86_64 3.2.1-1.el7 /zabbix-sender-3.2.1-1.el7.x86_64 885 k
zabbix-server-mysql x86_64 3.2.1-1.el7 /zabbix-server-mysql-3.2.1-1.el7.x86_64 3.4 M
zabbix-web noarch 3.2.1-1.el7 /zabbix-web-3.2.1-1.el7.noarch 32 M
zabbix-web-mysql noarch 3.2.1-1.el7 /zabbix-web-mysql-3.2.1-1.el7.noarch 0.0
Installing for dependencies:
OpenIPMI-libs x86_64 2.0.19-11.el7 base 501 k
OpenIPMI-modalias x86_64 2.0.19-11.el7 base 15 k
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
fping x86_64 3.10-4.el7 epel 46 k
httpd x86_64 2.4.6-40.el7.centos.4 updates 2.7 M
httpd-tools x86_64 2.4.6-40.el7.centos.4 updates 83 k
iksemel x86_64 1.4-6.el7 epel 50 k
libXpm x86_64 3.5.11-3.el7 base 54 k
libtool-ltdl x86_64 2.4.2-21.el7_2 updates 49 k
libzip x86_64 0.10.1-8.el7 base 48 k
mailcap noarch 2.1.41-2.el7 base 31 k
net-snmp-libs x86_64 1:5.7.2-24.el7_2.1 updates 747 k
php x86_64 5.4.16-36.3.el7_2 updates 1.4 M
php-bcmath x86_64 5.4.16-36.3.el7_2 updates 56 k
php-cli x86_64 5.4.16-36.3.el7_2 updates 2.7 M
php-common x86_64 5.4.16-36.3.el7_2 updates 563 k
php-gd x86_64 5.4.16-36.3.el7_2 updates 126 k
php-ldap x86_64 5.4.16-36.3.el7_2 updates 51 k
php-mbstring x86_64 5.4.16-36.3.el7_2 updates 504 k
php-mysql x86_64 5.4.16-36.3.el7_2 updates 100 k
php-pdo x86_64 5.4.16-36.3.el7_2 updates 97 k
php-xml x86_64 5.4.16-36.3.el7_2 updates 124 k
t1lib x86_64 5.1.2-14.el7 base 166 k
unixODBC x86_64 2.3.1-11.el7 base 413 k
Transaction Summary
===================================================================================================================================
Install 8 Packages (+25 Dependent packages)
Total size: 52 M
Total download size: 12 M
Installed size: 81 M
6、安装这些包
7、yum安装mysql
安装mysql社区版官方源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
查看可以安装的mysql版本
yum repolist enabled|grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community 24
mysql-tools-community/x86_64 MySQL Tools Community 38
mysql56-community/x86_64 MySQL 5.6 Community Server 289
安装
yum install -y mysql-community-server
8、启动mysql
systemctl enable mysqld
systemctl start mysqld
尝试进入mysql
mysql -uroot -p
密码为空
9、创建zabbix数据库并授权
mysql -uroot -p
mysql>create database zabbix character set utf8 collate utf8_bin;
mysql>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';<br>mysql>flush privileges;
mysql>quit;
10、导入zabbix数据库
zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz |mysql -uzabbix -pzabbix -b zabbix
11、修改zabbix配置,主要是zabbix数据库用户名和密码的设定
配置默认数据库用户名
DBUser=zabbix
如果你创建zabbix数据库的时候不一样,请更改
配置默认的数据库密码没有设定,改成你设定的密码
DBPassword=zabbix
其他可以默认
12、启动zabbix服务,并设置开机自启
systemctl start zabbix-server
systemctl enable zabbix-server
13、编辑zabbix前端的php配置,更改下时区
vim /etc/httpd/conf.d/zabbix.conf
去掉时区前的#号,改一下位置
php_value date.timezone Asia/Shanghai
其他默认
14、启动apache服务,并设置开机自启
systemctl start httpd
systemctl enable httpd
15、登录zabbix
http://10.0.0.12/zabbix
16、zabbix基本配置,这里直接上图了
zabbix数据库的密码是你设定的,我这里是zabbix
这里的Name可以空着不填,其他默认
这是汇总的信息
看到这张图,说明已经安装成功了
登录你的zabbix吧,用户名默认为Admin,密码默认为zabbix
17、zabbix简单配置
17.1 修改界面为中文
17.2 解决图形显示中文乱码,在仪表板的常用的图形栏目里随意添加一个图形,我这里添加的是cpu负载,进入图形界面会看到乱码
17.2.1 Win+R打开运行,输入fonts,回车进入Windows字体目录,找到微软雅黑-常规字体,复制出来将文件名修改为msyh.ttf,然后上传到/usr/share/zabbix/fonts
17.2.2 上传成功以后,修改defines.inc.php的第45行,将graphfont改为msyh
vim /usr/share/zabbix/include/defines.inc.php
17.2.3 保存后,刷新界面,文字就出来了
一些Zabbix相关教程集合:
ZABBIX 的详细介绍:请点这里
ZABBIX 的下载地址:请点这里