zaibbix RPM包下载地址:http://repo.zabbix.com/zabbix/
根据需求下载不同的版本。我这里以Zabbix 2.2.10为例,服务器系统为CentOS6.75
安装Zabbix源
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
安装完成后,在/etc/yum.repos.d目录下会生成一个zabbix.repo的yum源
1
2
3
4
5
6
7
8
|
[root@dnsserver yum.repos.d]
# ll
total 28
-rw-r--r--. 1 root root 1991 Aug 4 00:13 CentOS-Base.repo
-rw-r--r--. 1 root root 647 Aug 4 00:13 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 Aug 4 00:13 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Aug 4 00:13 CentOS-Media.repo
-rw-r--r--. 1 root root 6259 Aug 4 00:13 CentOS-Vault.repo
-rw-r--r-- 1 root root 401 Nov 12 2013 zabbix.repo
|
安装前的准备:
1、关闭防火墙
service iptables stop
2、禁用selinux
setenforce 0 ##设置为告警模式,只给出提示,不会阻止操作,不用重启就生效
getenforce ##获取当前SElinux的运行状态
永久关闭selinux
1
2
3
4
5
6
7
8
9
10
11
|
vim
/etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
|
3、安装mysql
yum -y install mysql-server
安装Zabbix Server
1
|
#yum -y install zabbix zabbix-agent zabbix-get zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql zabbix-sender
|
修改MySQL配置文件
vim /etc/my.cnf
1
2
3
4
5
6
7
8
9
|
[mysqld]
datadir=
/var/lib/mysql
socket=
/var/lib/mysql/mysql
.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-
set
-server = utf8
##设置字符集为utf8
innodb_file_per_table = 1
##让innodb的每个表文件单独存储
default_table_type = InnoDB
##设置MySQL表引擎为InnoDB
|
启动mysql
1
2
|
chkconfig mysqld on
service mysqld start
|
创建Zabbix数据库
设置MySQL数据库的root密码
1
|
mysql -uroot password 123456
|
登录数据库,创建zabbix数据库和用户
1
|
#mysql -uroot -p 123456
|
1
2
3
4
|
mysql>create database zabbix character
set
utf8 collate utf8_bin;
mysql>grant all privileges on zabbix.* to zabbix@localhost identified by
'zabbix'
;
mysql>flush privileges;
mysql>\q
|
注意:这里容易出现的问题是创建Zabbix的数据库字符集不为utf8,这会导致web界面切换到中文时出现乱码。
导入zabbix数据
注意:版本不同,路径也不相同
1
2
3
4
|
cd
/usr/share/doc/zabbix-server-mysql-2
.2.13
/create/
mysql -uroot -p123456 zabbix < schema.sql
mysql -uroot -p123456 zabbix < images.sql
mysql -uroot -p123456 zabbix < data.sql
|
配置zabbix_server.conf中的数据库配置
vim /etc/zabbix/zabbix_server.conf
1
2
3
4
|
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
|
1
|
mkdir
-p
/etc/zabbix/alertscripts
/etc/zabbix/externalscripts
|
php配置
vim /etc/httpd/conf.d/zabbix.conf
1
2
3
4
5
6
|
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
date
.timezone Asia
/Shanghai
|
更改php的timezone(此处如果步更改会报错)
1
2
|
vim
/etc/php
.ini
date
.timezone = Asia
/Shanghai
|
启动apache
1
2
|
chkconfig httpd on
service httpd start
|
启动zabbix和agent
1
2
3
4
5
|
chkconfig zabbix-server on
service zabbix-server start
chekconfig zabbix-agent on
service zabbix-agent start
|
浏览器输入http://172.16.206.131/zabbix配置
点击下一步依次检测php组件,数据库等配,最后输入默认账号密码Admin/zabbix登陆