1)配置mysql
[root@linux-node1 tools]# \cp /usr/share/mysql/my-medium.cnf
/etc/my.cnf
[root@linux-node1 tools]# vim /etc/my.cnf
在[mysqld](第26行)标签下增加如下三行后保存
[mysqld]
character-set-server = utf8
init-connect = 'SET NAMES utf8'
collation-server = utf8_general_ci
[root@linux-node1 tools]# /etc/init.d/mysqld
start
2)初始化数据库环境
创建数据库
mysql> create database zabbix character
set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
授权数据库
mysql> grant all on zabbix.* to zabbix@localhost
identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
导入表结构
[root@linux-node1 tools]# cd /usr/share/doc/zabbix-server-mysql-2.4.6/create/
[root@linux-node1 create]# mysql -u root -p
zabbix < schema.sql
[root@linux-node1 create]# mysql -u root -p
zabbix < images.sql
[root@linux-node1 create]# mysql -u root -p
zabbix < data.sql
[root@linux-node1 create]# mysqladmin -uroot
password 123456
3)设置apache时区
sed -i 's#\# php_value date.timezone Europe/Riga#php_value
date.timezone Asia/Shanghai#g' /etc/httpd/conf.d/zabbix.conf
grep Shanghai /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
4)更改zabbix server配置
[root@linux-node1 ~]# cp /etc/zabbix/zabbix_server.conf
/etc/zabbix/zabbix_server.conf.bak
[root@linux-node1 ~]# sed -i 's@# DBPassword=@DBPassword=zabbix@g'
/etc/zabbix/zabbix_server.conf
[root@linux-node1 ~]# sed -i 's@# DBHost=localhost@DBHost=localhost@g'
/etc/zabbix/zabbix_server.conf
-------------------------------------------------
vim /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
5)启动相关服务
[root@linux-node1 ~]# /etc/init.d/zabbix-server
start
Starting Zabbix server: [确定]
[root@linux-node1 ~]# /etc/init.d/httpd start
正在启动 httpd: [确定]
[root@linux-node1 ~]# lsof -i:10051|wc -l
55
[root@linux-node1 ~]# lsof -i:80|wc -l
1 |