现以CENTOS 6.5 64位系统为例安装Zabbix,闲话少叙,开始!
配置好IP,掩码,网关(172.20.1.43 255.255.255.0 172.20.1.1)。设置好iptables、selinux。
第一步:安装zabbix官方源以及EPEL源
安装zabbix官方源:
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
安装epel源:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
第二步:安装Zabbix-Server
安装 zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-web zabbix-agent
yum install -y zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-web zabbix-agent
这个过程能长一些,耐心等待吧。
第三步:安装MYSQL数据库
安装mysql
yum -y install mysql-server
下载完毕后,修改配置文件:etc/my.cnf
在其中添加
character-set-server=utf8 #设置字符集utf8
innodb_file_per_table=1 #让innodb的每个表文件单独存储
my.cn的配置如下:
[root@ZabbixServer etc]# vi my.cnf
[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的每个表文件单独存储
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动mysql:
service mysqld start
chkconfig mysqld on
############################################################################################
1、创建Zabbix数据库
设置MySQL的root用户密码
[root@ZabbixServer mysql]# mysqladmin -uroot password admin
[root@ZabbixServer mysql]# mysql -uroot -padmin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.01 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
2、导入zabbix-server的数据库
[root@ZabbixServer log]# mysql -uzabbix -pzabbix
mysql> use zabbix;
Database changed
mysql> source /usr/share/doc/zabbix-server-mysql-2.2.15/create/schema.sql;
mysql> source /usr/share/doc/zabbix-server-mysql-2.2.15/create/images.sql;
mysql> source /usr/share/doc/zabbix-server-mysql-2.2.15/create/data.sql;
#################################################################################
第四步、配置zabbix_server.conf
1、参考配置参数:
2、启动zabbix-server服务
[root@ZabbixServer ~]# service zabbix-server start
[root@ZabbixServer ~]#service httpd start
[root@ZabbixServer ~]# chkconfig zabbix-server on
[root@ZabbixServer ~]# chkconfig httpd on
第五步、关闭防火墙、selinux、修改php.ini
关闭防火墙、selinux。。(省略)
修改php.ini
/etc/php.in 文件配置的主要参数如下,可视情况调整
data.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 16M
max_input_time = 300
memory_limit = 128M
mbstring.func_overload = 2
启动httpd
service httpd restart