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