CentOS安装zabbix

putative 2011-11-15

CentosZabbix安装

1,建用户,不建议用root及有特殊权限的用户,会不安全

#groupadd-g130zabbix

#useradd-u130-gzabbix-c'Zabbixmonitoring'zabbix

2,需要安装以下组件:

•ZabbixServer(收集数据)

•ZabbixAgent(监视)

•Net-SNMP(为了支持SNMP(简单网络管理协议))

•Jabber(支持消息通知)

•OpenIPMI(监视)

•cURL(网页监视)

3,安装依赖包

#yuminstallzlib-develmysql-develglibc-develcurl-develgccautomakemysqllibidn-developenssl-develnet-snmp-develrpm-develOpenIPMI-devel

安装Jabber需要依赖于iksemel包的iksemel-devel包,但是在CentOS的Repo里没有,所以我们要用EPEL(ExtraPackagesforEnterpriseLinux)

配置EPEL库从http://fedoraproject.org/wiki/EPEL/FAQ#howtouse:

#rpm-Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

安装iksemel-devel包和iksemel包

#yum--enablerepo=epelinstalliksemeliksemel-devel

4,下载zabbix-1.8.1.tar.gz从http://www.zabbix.com/download.php

5,编译安装

#tarzxvfzabbix-1.8.8.tar.gz

#cdzabbix-1.8.1

#./configure--prefix=/usr/local/zabbix--enable-server--with-mysql--with-net-snmp--with-jabber--with-libcurl--with-openipmi--enable-agent

出现:

***********************************************************

*Nowrun'makeinstall'*

**

*ThankyouforusingZabbix!*

*<http://www.zabbix.com>*

***********************************************************

#makeinstall

6,生成rpm

#wgethttp://pkgs.repoforge.org/checkinstall/checkinstall-1.6.0-3.rh7.rf.i386.rpm

#rpm-ivhcheckinstall-1.6.0-3.rh7.rf.i386.rpm

#yuminstallrpm-build

#cdzabbix-1.8.8

#checkinstall--nodoc--install=yes

**********************************************************************

Done.Thenewpackagehasbeeninstalledandsavedto

/usr/src/redhat/RPMS/i386/zabbix-1.8.8-1.i386.rpm

Youcanremoveitfromyoursystemanytimeusing:

rpm-ezabbix-1.8.8-1

**********************************************************************

表示安装完成

参考地址:http://www.zabbix.com/wiki/howto/install/centos/centosinstall

----------------------以下是原文------------------------------

Zabbix1.8.xonCentOSusingsource(manual)

WorksalsowithZabbix1.8.1-1.8.5andCentOS5.4-6.0.IhavealsotestedthiswithZabbix1.9.5onRHEL5.7

ThisGuideisforinstallingZabbix1.8.1onCentOS5.4usingaMySQLDatabase,IassumeyouhaveinstalledCentOSwithApache,MySQL,PHP,andaMailServerduringtheSetup.

#willindicatethatweareusingthepromptastherootuser

$willindicatethatweareusingthepromptasadifferentuser

Settinguptheuseraccounts

TheZabbixserverandclientbothneedauseraccountthattheycanrunon,somayaswellsetthisupfirst.ThisalsoneedstobedoneoneverymonitoredmachinethatisrunningtheZabbixagent:

#groupadd-g130zabbix

#useradd-u130-gzabbix-c'Zabbixmonitoring'zabbix

Ihaveaddedthe”-u130”parameter–thisensuresthatthezabbixusergetscreatedwiththesameuserIDoneveryserverthatwecreatediton,aswellaswiththezabbixgroup(whichwillbegroupid130).

ZabbixInstallation

Wewillbeinstallingfollowingcomponents:

•ZabbixServer(forgatheringdata)

•ZabbixAgent(formonitoring)

•Net-SNMP(forSNMPSupport)

•Jabber(fornotifications)

•OpenIPMI(formonitoring)

•cURL(forwebmonitoring)

Allthesecommandsaredonewiththeuserroot,startingoffromtheroothomefolder/root

Dependencies

Firstinstallallthedependencieswithyumusingthecommand

#yuminstallzlib-develmysql-develglibc-develcurl-develgccautomakemysqllibidn-developenssl-develnet-snmp-develrpm-develOpenIPMI-devel

CentOSshouldfindallpackagesinitsRepo'sanddotherestforyou.ForJabberwewillneedthepackagesiksemel-develwichdependsoniksemel,howevertheseRPM'saren'tintheCentOSRepo'ssowewillbeusethemfromEPELinstead.

ConfiguretheEPELrepositoryfromhttp://fedoraproject.org/wiki/EPEL/FAQ#howtouse:

#rpm-Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Thanwecaninstallthefollowingpackageswithyum

#yum--enablerepo=epelinstalliksemeliksemel-devel

CompileandInstallSource

Nowthatwehaveourdependenciessetupweneedtodownloadtheactualsource,thiscanalsobedonewiththewgetcommand.

#wgethttp://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8.1/zabbix-1.8.1.tar.gz?use_mirror=freefr

Afterithasdownloadedthefilewecanunzipanduntarwithfollowingcommand.

#gunzipzabbix-1.8.1.tar.gz&&tar-xvfzabbix-1.8.1.tar

Thisshouldhavecreatedafoldercalledzabbix-1.8.1inyourhomedirectory.Nextweneedtobrowsetothedirectoryandconfigureoursetup.

#cdzabbix-1.8.1

#./configure--enable-server--with-mysql--with-net-snmp--with-jabber--with-libcurl--with-openipmi--enable-agent

Ifyouencounteranyproblemsyoushouldreadtheerrormessagescarefullyandchecktheconfig.loglocatedinthesamedirectory.Ifallgoeswellitwillprintoutyourconfiguration,pleasemakesurefollowingisset:

Enableserver:yes

Withdatabase:MySQL

WEBMonitoringvia:cURL

NativeJabber:yes

SNMP:net-snmp

IPMI:openipmi

Enableagent:yes

Ifeverythingmatchestheabovewecancarryonwiththecommandmake

#make

AftermakehascompiledallthestuffwecanuseCHECKINSTALLasdescribedinthenextchapter-OR-wecouldsimplyproceedasusualwith:

#makeinstall

checkinstall

Aftermakehascompiledwewon'tbeusingmakeinstall,butcheckinstallwhichgivesustheoptiontofirstmakeaRPMoutoftheinstallationandthaninstallit.ThisgivesustheadvantagetobeabletodeinstallZabbixagainwithrpm.Becausecheckinstallalsoisn'tontheCentOSRepowewilldownloaditusingwgettoourhomedirectory.

#cd..

#wgethttp://dag.wieers.com/rpm/packages/checkinstall/checkinstall-1.6.0-3.el5.rf.i386.rpm

andthaninstallcheckinstallwithrpmandrpmbuildwithyum

#rpm-ivhcheckinstall-1.6.0-3.el5.rf.i386.rpm

#yuminstallrpm-build

NowwecanusecheckinstalltomakeaRPMandinstallit.

#cdzabbix-1.8.1

#checkinstall--nodoc--install=yes-y

YouShouldbeabletochoosewhatkindofpackagethatyouwishyoucreate,becauseCentOSisbasedonRedHatwearegoingfor[R],typeRandpressEnter.

Ifyoudon'tencounteranyerrorsyoushouldgetfollowingoutput:

**********************************************************************

Done.Thenewpackagehasbeeninstalledandsavedto

/usr/src/redhat/RPMS/i386/zabbix-1.8.1-1.i386.rpm

Youcanremoveitfromyoursystemanytimeusing:

rpm-ezabbix-1.8.1-1

**********************************************************************

NowZabbixisinstalled.

相关推荐