CentOS下zabbix的安装指导能带给你简便的安装方法!
LAMP 环境,我选择用yum来装,如果有兴趣也可以编译安装,至于CentOS国内镜像,可以参考我的另外一篇文章,这样快多了。
mkdir /sourcecd /source
下载需要的包
- # dependenices for curl: e2fsprogs-devel zlib-devel libgssapi-devel krb5-devel openssl-devel
- yum -y install gcc mysql-devel curl-devel httpd php php-mysql php-bcmath php-gd net-snmp-devel fping e2fsprogs-devel zlib-devel libgssapi-devel krb5-devel openssl-devel libidn-devel
下载fping,这是个第三方工具,可以同时ping多个主机,它不在yum之列,所以要作如下修改
- wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.i386.rpm
- vi /etc/yum.conf gpgcheck=1 to gpgcheck=0yum -y install fping-2.4-1.b2.2.el5.rf.i386.rpmvi /etc/yum.conf gpgcheck=0 to gpgcheck=1
下载zabbix 1.6.1并安装
- wget http://prdownloads.sourceforge.net/zabbix/zabbix-1.6.1.tar.gz?downloadtar -zxvf zabbix-1.6.1.tar.gz
#建立zabbix数据库
- service mysqld startmysqladmin -u root -password "OOXX"mysql -p>create database zabbix>use mysql>grant all on zabbix.* to 'zabbix' identified by 'XXOO';cd zabbix-1.6.1cat create/schema/mysql.sql | mysql -u zabbix -p zabbix
- cat create/data/data.sql | mysql -u zabbix -p zabbix
- cat create/data/images_mysql.sql | mysql -u zabbix -p zabbix
#安装server
- ./configure --enable-server --with-mysql --with-net-snmp --with-libcurlmake installmake clean
#安装client
- ./configure -enable-agent -enable-staticmake install
#注解端口
- echo 'zabbix_agent 10050/tcp' >> /etc/servicesecho 'zabbix_trap 10051/tcp' >> /etc/services
#拷贝标准配置文件
- mkdir /etc/zabbixcp misc/conf/zabbix_agentd.conf /etc/zabbixcp misc/conf/zabbix_server.conf /etc/zabbix
#p#
#编辑配置文件
- vi /etc/zabbix/zabbix_server.conf
- DBUser=zabbixBPassword=XXOODBSocket=/var/lib/mysql/mysql.sockFpingLocation=/usr/sbin/fping
- vi /etc/zabbix/zabbix_agentd.confServer=127.0.0.1,Zabbix.Server.IPHostname=Unique_Hostname_for_agent
#设置自动启动脚本
- cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentdcp misc/init.d/redhat/zabbix_server_ctl /etc/init.d/zabbix_servervi /etc/init.d/zabbix_agentd #!/bin/sh# chkconfig: 345 95 95# description: Zabbix Agentd...# vi /etc/init.d/zabbix_server#!/bin/sh# chkconfig: 345 95 95# description: Zabbix Server...chkconfig --level 345 zabbix_server onchkconfig --level 345 zabbix_agentd onchkconfig --level 345 httpd onchkconfig --level 345 mysqld on
#设置apache 和 php
vi /etc/httpd/conf/httpd.conf #自己设置一个虚拟主机
- cp -r frontends/php /var/www/html/zabbixvi /etc/php.inimax_execution_time = 300…date.timezone = Asia/Shanghai
- service httpd startchmod 777 /var/www/html/zabbix/conf
#这时候你可以登录网页设置,也可以直接更改conf文件
#设置完mysql与php连接后改回权限,并启动相应服务
- chmod 755 /var/www/html/zabbix/confmv /var/www/html/zabbix/setup.php /var/www/html/zabbix/setup.php.cncservice zabbix_agentd startservice zabbix_server start
#修正该版本的BUG
1.网页登录后会在某个链接的页面显示如下错误
- Undefined index: show_events_status[/var/www/zabbix/tr_status.php:199]
解决方案:注释掉该行即可
2.service zabbix_agentd restart不正常工作
解决方案:vi /etc/init.d/zabbix_agentd
...
restart)
...
if kill $PID ; then
sleep 5 #加入这一行
通过上面一系列努力,终于搞定CentOS下zabbix的安装了,你们也快去试试吧!
【编辑推荐】