missing-cn 阅读(165) 评论(0)
yum和rpm安装zabbix 2.0.9,从2.0.4开始zabbix官方提供了从rpm包和yum仓库安装的方法,近来有空特地参考了官方文档进行了尝试,安装过程记录如下



1、安装zabbix 官方的软件配置仓库包




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


2、安装zabbix server  mysql php 等


yum install zabbix-server-mysql zabbix-web-mysql

结果如下(根据机型系统不同显示或有不同):


Installed:
  libjpeg-turbo.x86_64 0:1.2.1-1.el6         zabbix-server-mysql.x86_64 0:2.0.9-1.el6         zabbix-web-mysql.noarch 0:2.0.9-1.el6        


Dependency Installed:
  OpenIPMI-libs.x86_64 0:2.0.16-14.el6           fping.x86_64 0:2.4b2-16.el6                    iksemel.x86_64 0:1.4-2.el6                 
  libXpm.x86_64 0:3.5.10-2.el6                   lm_sensors-libs.x86_64 0:3.1.1-17.el6          net-snmp.x86_64 1:5.5-44.el6_4.4           
  net-snmp-libs.x86_64 1:5.5-44.el6_4.4          php.x86_64 0:5.3.3-23.el6_4                    php-bcmath.x86_64 0:5.3.3-23.el6_4         
  php-cli.x86_64 0:5.3.3-23.el6_4                php-common.x86_64 0:5.3.3-23.el6_4             php-gd.x86_64 0:5.3.3-23.el6_4             
  php-mbstring.x86_64 0:5.3.3-23.el6_4           php-mysql.x86_64 0:5.3.3-23.el6_4              php-pdo.x86_64 0:5.3.3-23.el6_4            
  php-xml.x86_64 0:5.3.3-23.el6_4                unixODBC.x86_64 0:2.2.14-12.el6_3              zabbix.x86_64 0:2.0.9-1.el6                
  zabbix-server.x86_64 0:2.0.9-1.el6             zabbix-web.noarch 0:2.0.9-1.el6               


Replaced:
  libjpeg.x86_64 0:6b-46.el6      
  
3、安装agent


 yum install zabbix-agent -y
 
 结果如下:
 
 Installed:
  zabbix-agent.x86_64 0:2.0.9-1.el6                                                                                                        


Complete!


4、创建zabbix 数据库(mysql)


4、1 安装mysql等(如果已安装请略过)
 
  yum -y install mysql-server mysql mysql-dev
 
  结果:
 
Installed:
  mysql-server.x86_64 0:5.1.69-1.el6_4                                                                                                     


Dependency Installed:
  perl-DBD-MySQL.x86_64 0:4.013-3.el6                                                                                                      


Updated:
  mysql.x86_64 0:5.1.69-1.el6_4                                                                                                            


Dependency Updated:
  mysql-devel.x86_64 0:5.1.69-1.el6_4                                  mysql-libs.x86_64 0:5.1.69-1.el6_4                                 


Complete!  
 
4、2 启动mysql


service mysqld start 

首次启动显示:

Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK


To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h h210 password 'new-password'


Alternatively you can run:
/usr/bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl


Please report any problems with the /usr/bin/mysqlbug script!


                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]


4、3 创建库和导入


创建
mysql -uroot
 
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> exit


导入模式和数据


cd /usr/share/doc/zabbix-server-mysql-2.0.9/create
mysql -uroot zabbix < schema.sql
mysql -uroot zabbix < images.sql
mysql -uroot zabbix < data.sql


5、启动zabbix-server 进程


编辑配置文件zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf


保证下列配置,保存退出
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


启动


service zabbix-server start




6、配置zabbix web前端
                         
6、1 配置php


vi /etc/httpd/conf.d/zabbix.conf


保证如下设置
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone  Asia/Shanghai


6、2 启动apache


service httpd start


6、3 登录zabbix web前端


浏览器输入 http://serverip/zabbix进入最后的检查和配置


配置完成登录系统默认admin/zabbix






7、启动zabbix server上的zabbix_agentd 


zabbix_agentd