zabbix 安装

1、在已有的LAMP或者LNMP的基础上安装zabbix,安装一些依赖包:

yum -y install mysql-devel libcurl-devel net-snmp-devel

2、添加用户:

groupadd zabbix
useradd zabbix -g zabbix

3、创建数据库,添加授权账号

mysql -uxxx  -pxxx

mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.*  to zabbix@要连接的数据库的IP identified by 'zabbix';

4、编译安装zabbix

cd  /usr/local/src

wget  http://fossies.org/linux/misc/zabbix-2.4.6.tar.gz

tar -zxvf   zabbix-2.4.6.tar.gz

cd  zabbix-2.4.6

./configure --prefix=/usr/local/zabbix-2.4.6/ --enable-server

--enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make install
5、将默认安装的3个库还原至zabbix数据库
cd  /usr/local/src/zabbbix-2.4.6
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql
6、修改配置文件
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cp -R frontends/php/*  /data/www1/zabbix
sed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix-2.4.6/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix-2.4.6/etc/zabbix_server.conf
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix-2.4.6/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix-2.4.6/g' /etc/init.d/zabbix_agentd
7、添加服务端口:
cat >>/etc/services <<EOF
zabbix-agent 10050/tcp     #Zabbix Agent
zabbix-agent 10050/udp     #Zabbix Agent
zabbix-trapper 10051/tcp   #Zabbix Trapper
zabbix-trapper 10051/udp   #Zabbix Trapper
EOF
8、启动服务
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
echo "/etc/init.d/zabbix_server start" >> /etc/rc.local
echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local

9、web页面配置,配置http访问好了后web登陆:http://ip/zabbix

确认每个Required都是ok的才会显示Next按钮,如果有Fail的需要完善系统要求

 
 
 
 
posted @ 2015-09-01 23:21  dantes博客  阅读(164)  评论(0编辑  收藏  举报