centos6.*lnmp下安装zabbix

#安装依赖库

yum -y install mysql-devel libcurl-devel net-snmp-devel Percona-Server-devel-55

#因为我的mysql使用的是percona55 所以这里需要装 Percona-Server-devel-55


#给zabbix在mysql中创建库和用户

create database zabbix character set utf8;

grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';



#创建zabbix运行的独立用户

groupadd zabbix

useradd zabbix -g zabbix -s /sbin/nologin


#下载编译安装zabbix

wget -O zabbix.tar.gz -c "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.4/zabbix-2.2.4.tar.gz/download"


tar zxvf zabbix.tar.gz

cd zabbix-2.2.4/


./configure --prefix=/usr/local/zabbix --enable-server --enable-agent \

--with-mysql --with-net-snmp --with-libcurl

make install


##编译错误解决

#checking for mysql_config... /usr/bin/mysql_config

#checking for main in -lmysqlclient... no

#configure: error: Not found mysqlclient library

ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib64/mysql/libmysqlclient.so

ln -s /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 /usr/lib64/mysql/libmysqlclient_r.so

ln -s /usr/lib64/libmysqlclient.so.16.0.0 /usr/lib64/libmysqlclient.so

ln -s /usr/lib64/libmysqlclient_r.so.16.0.0 /usr/lib64/libmysqlclient_r.so


#导入zabbix的数据库

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


#修改配置文件

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/wwwroot/zabbix  #复制web文件到网站目录,替换成你自己的

sed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf

sed -i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf

sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server

sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd


#增加服务端口<br>

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


#启动服务

/etc/init.d/zabbix_server start

/etc/init.d/zabbix_agentd start

chkconfig zabbix_server on   #开机启动启动服务

#chkconfig zabbix_agentd on  #被控端

#echo "/etc/init.d/zabbix_server start" >> /etc/rc.local

#echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local


你可能感兴趣的:(mysql,database,character,create,identified)