Zabbix 2.2的架设

一、安装前的准备

1关闭防火墙和SELinux

service iptables stop

2安装依赖包:

    yum update

    yum install gcc,gcc-c++

yum  install libxml2*

yum install net-snmp*

yum install libcurl*

3安装mysql

yum install mysql mysql-server mysql-devel

数据库字符集设置:

    mysql配置文件/etc/my.cnf中加入default-character-set=utf8

启动mysql服务:

        service mysqld start或者/etc/init.d/mysqld start

开机启动chkconfig -add mysqld

         创建root管理员密码:mysqladmin -u root password 123456

         登录:mysql -u root -p输入密码即可。

   4安装apache php

       yum install zlib-devel libtool ncurses-devel libxml2-devel  

       yum install httpd httpd-devel   

       /etc/init.d/httpd start

yum install php php-mysql php-common php-gd php-mbstring php-mcrtpt php-devel php-xml  php-bcmath

/etc/init.d/httpd restart

chkconfig httpd on 

 5.下载 zabbix 2.2

    http://www.zabbix.com/download.php

    tar -zxvf zabbix-2.2.0.tar.gz

6.新建用户和组

   groupadd zabbix

useradd -g zabbix zabbix

7.利用脚本新建zabbix需要用到的表

地址如下

   https://www.zabbix.com/documentation/2.4/manual/appendix/install/db_scripts

这里写下针对mysql的方法:

cd zabbix-2.2.2

shell> mysql -u -p

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> CREATE USER 'zabbix'@'hostIDENTIFIED BY '1234';

mysql>grant all privileges on zabbix.* to zabbix@localhost identified by '1234';

mysql> quit;

shell> mysql -u -p zabbix < database/mysql/schema.sql

# stop here if you are creating database for Zabbix proxy

shell> mysql -u -p zabbix < database/mysql/images.sql

shell> mysql -u -p zabbix < database/mysql/data.sql

8.安装zabbix  

 cd zabbix-2.2

 ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net./configure --enable-agent

make install

9.配置 /usr/local/etc/zabbix_server.conf

DBName=zabbix   

DBUser=zabbix

   DBPassword=

10.启动zabbix_serverzabbix_agentdzabbix_proxy如果是的话)

      cp /root/zabix-2.2.2/misc/init.d/fedora/core/zabbix_server /etc/init.d/

      cp /root/zabix-2.2.2/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/

      /etc/init.d/zabbix_server start

      /etc/init.d/zabbix_agentd start

      zabbix_proxy

11.拷贝网页文件至/var/www/html

  cd /var/www/html/

  mkdir zabbix

  cd /root/zabbix-2.2.2/frontends/php

  cp  -rf * /var/www/html/zabbix

12.安装前台

  a. 浏览器打开:http://127.0.0.1/zabbix/setup.php

   b.Vim /etc/php.ini

  post_max_size = 16M

  max_execution_time = 300

max_input_time = 300

service httpd restart

c.数据库用户名改为zabbix

d.下载zabbix.conf.php 拷贝至/var/www/html/zabbix/conf/zabbix.conf.php

e.重要:默认的用户名为Admin(注意是大写)

 

 

                                                     2014-4-1

                                                        By bsbforever