Centos6.3 X64 安装zabbix2.0.3


 

Centos6.3 X64 安装zabbix2.0.3

首先安装lnmp环境,我有个习惯修改yum源为国内比较快的yum源,这里我选择的是ustcyum

cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo.bak

vim CentOS-Base.repo

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

 

[base]

name=CentOS-$releasever - Base - mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#released updates

[updates]

name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn

baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6

保存退出

yum makecache

我用的是一键安装包lnmp,具体安装过程这里就不说了,下面我们开始编译安装zabbix

安装编译所依赖的环境

yum ?y install gcc gcc-c++ automake autoconf ncurses-devel net-snmp net-snmp-devel net-snmp-utils curl curl-devel libgcc mysql-devel mysql-server

下载zabbix安装包

wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.3/zabbix-2.0.3.tar.gz

tar zxf zabbix-2.0.3.tar.gz

cd zabbix-2.0.3

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl

make install

--prefix指定zabbix安装目录,--enable-server 支持zabbix服务器,--enable-agent支持zabbix代理,--enable-proxy 支持zabbix代理服务器,--with-mysql 使用MySQL客户端库可以选择指定路径mysql_config--with-net-snmp 使用net - snmp软件包,择性地指定路径NET - SNMP配置, --with-libcurl 使用curl

zabbix建立数据库及数据库登录名

mysqladmin -u root password ’123456’  #初始化数据库密码

mysql -u root -p #登录MySQL数据库

mysql> create database zabbix;

zabbix库导入数据(数据导入时有先后顺序)

 

[root@localhost conf]# cd /usr/src/zabbix-2.0.3/

 

[root@localhost zabbix-2.0.3]# cd database/mysql/

 

[root@localhost mysql]# mysql -h localhost -uroot -p’123456’ zabbix <schema.sql

 

[root@localhost mysql]# mysql -h localhost -uroot -p’123456’ zabbix <images.sql

 

[root@localhost mysql]# mysql -h localhost -uroot -p’123456’ zabbix <data.sql

启动服务

 

拷贝启动脚本

cp /usr/local/zabbix/sbin/zabbix_agentd /etc/init.d

拷贝启动脚本到/etc/init.d

chmod a+x /etc/init.d/zabbix_agentd

/etc/init.d下的启动添加可执行权限 

启动zabbix客户端并添加开机自启动

service zabbix_agentd start               #启动zabbix客户端

echo "service zabbix_agentd start" >>/etc/rc.local     #开机自启动 

查看进程,确实zabbix客户端是否启动

ps -ef | grep zabbix 

在客户端上添加zabbix的监控端口

vim /etc/services

添加如下内容

zabbix_agent    10050/tcp

zabbix_agent    10050/udp

zabbix-trapper  10051/tcp  Zabbix Trapper

zabbix-trapper  10051/udp  Zabbix Trapper

保存退出

建立zabbix用户

 groupadd zabbix

 useradd -g zabbix -M zabbix

 

配置nginx中的zabbix项目

 

[root@localhost zabbix]# cd /usr/src/zabbix-2.0.3/

 

[root@localhost zabbix-2.0.3]# cd frontends/

 

[root@localhost frontends]# mv php/ /home/wwwroot/

 

[root@localhost frontends]# chown -R zabbix:zabbix /home/wwwroot/php

 

 

配置php

 

[root@localhost frontends]# vi /usr/local/php/etc/php.ini

max_execution_time = 300

 

max_input_time = 300

 

memory_limit = 128M

 

#在初始配置时,会有提示。

WEB访问:

 

http://172.18.85.131/php/

进入初始配置向导:

下一步

设置数据库连接信息,下一步

Mysql

Localhost

0是使用默认端口

Zabbix

Zabbix

123456

设置zabbix服务信息,下一步

主机iplocalhost

端口号:可以按照自己的需要设置

服务名称:yunvn

有可能会提示Unable to create the configuration file.

Please install it manually, or fix permissions on the conf directory.

Press the "Download configuration file" button, download the configuration file and save it as

"/home/wwwroot/php/conf/zabbix.conf.php"

直接下载zabbix.conf.php放到/home/wwwroot/php/conf/下就好了或者修改/home/wwwroot/php/conf/的权限

Zabbix前端是准备好了!默认的用户名是Admin,密码zabbix

Ok,到此已安装成功。

下载附件图文版Centos6.3安装Zabbix2.0.3.rar


Whatever is worth doing is worth doing well.