官方文档:https://www.zabbix.com/documentation/3.0/manual/installation/install_from_packages
系统要求:Red Hat Enterprise Liunx/CentOS 7
Zabbix安装:
# rpm -ivh
zabbix 官方源中包含了fping,iksemel,libssh2,在non-supported中
Server端
# yum install zabbix-server-mysql zabbix-web-mysql
Agent端
# yum install zabbix-agent
数据库安装:
centos 7的yum 源默认没有mysql
需要先下载mysql的repo源
# wget
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-server
安装完成后默认没有密码
登陆mysql时提示ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:
#chown -R root:root /var/lib/mysql
重启
#systemctl restart mysqld
导入数据结构
正常方式:
shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
shell> cd database/mysql
shell> mysql -uzabbix -p<password> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -uzabbix -p<password> zabbix < images.sql
shell> mysql -uzabbix -p<password> zabbix < data.sql
取巧方式:
shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
# cd /usr/share/doc/zabbix-server-mysql-3.0.0
# zcat create.sql.gz | mysql -uroot zabbix
编辑Zabbix-Server 配置文件
# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动,注意关闭selinux setenforce 0 和防火墙
# systemctl start zabbix-server
修改php的“date.timezone”
# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga 打开注释,修改时区
启动http
# systemctl start httpd
登陆网页设置zabbix-web 默认账号密码是Admin/zabbix
中文支持:
通过修改web端源文件来开启中文语言
vim /usr/share/zabbix/include/locales.inc.php
'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true], #也就是把false改为true
更换语言后,图形会出现乱码,需要修改配置文件
vim /usr/share/zabbix/include/defines.inc.php
#修改第93行
define('ZBX_FONT_NAME', 'msyh');
#修改第45行改为
define('ZBX_GRAPH_FONT_NAME', 'msyh')
下载微软雅黑字体,改名为msyh传入/usr/share/zabbix/fonts 目录下即可。
Python版本默认为3.5.1
一些Zabbix相关教程集合:
Ubuntu 14.04下Zabbix2.4.5 源码编译安装 .com/Linux/2015-05/117657.htm