先准备好mysql,创建zabbix数据库,并且把字符集改为utf8

MariaDB [(none)]> create database zabbix character set utf8;
Query OK, 1 row affected (0.09 sec)


授权一个远程用户,如果mysql与zabbix不在同一主机下,需要此步:

MariaDB [(none)]> grant all on zabbix.* to 'zbxuser'@'192.168.%.%' identified by 'zbxpass';
Query OK, 0 rows affected (0.07 sec)


再授权本机:

MariaDB [(none)]> grant all on zabbix.* to 'zbxuser'@'localhost' identified by 'zbxpass';
Query OK, 0 rows affected (0.00 sec)


ok,mysql配置完成:接下来配置zabbix

  1. 下载安装zabbix:

    本机直接下载官方yum源来进行安装。

  2. http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm


2,单独安装需要的软件包:

yum install zabbix-server-2.4.0-1.el6.x86_64.rpm zabbix-server-mysql-2.4.0-1.el6.x86_64.rpm zabbix-get-2.4.0-1.el6.x86_64.rpm zabbix-2.4.0-1.el6.x86_64.rpm zabbix-web-2.4.0-1.el6.noarch.rpm zabbix-web-mysql-2.4.0-1.el6.noarch.rpm zabbix-agent-2.4.0-1.el6.x86_64.rpm zabbix-sender-2.4.0-1.el6.x86_64.rpm


zabbix-server-2.4.0-1.el6.x86_64.rpm     #zabbix-server端主程序包

zabbix-server-mysql-2.4.0-1.el6.x86_64.rpm  #zabbix-server与mysql相关的程序包




3.导入文件到zabbix数据库:

文件路径在:/usr/share/doc/zabbix-server-mysql-2.4.0/create

第一步:

[root@localhost create]# mysql zabbix < schema.sql


第二步:

[root@localhost create]# mysql zabbix < p_w_picpaths.sql

 

第三步:

[root@localhost create]# mysql zabbix < data.sql


4.修改zabbix主配置文件:

[root@localhost zabbix]# vim /etc/zabbix/zabbix_server.conf


### Option: DBHost
#       Database host name.
#       If set to localhost, socket is used for MySQL.
#       If set to empty string, socket is used for PostgreSQL.
#
# Mandatory: no
# Default:
DBHost=localhost            #开启数据库,并且修改地址。比如DBHost=192.168.1.146


修改用户名,密码:

### Option: DBUser
#       Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zbxuser
### Option: DBPassword
#       Database password. Ignored for SQLite.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
DBPassword=zbxpass


修改数据库sock:

### Option: DBSocket
#       Path to MySQL socket.
#
# Mandatory: no
# Default:
# DBSocket=/tmp/mysql.sock
DBSocket=/tmp/mysql.sock


启动服务:

[root@localhost zabbix]# service zabbix-server start
Starting Zabbix server:                                    [  OK  ]