deles 发表于 2018-10-20 12:51:44

zabbix server服务安装与配置详情

  1.环境工具
  yum groupinstall "Development tools" -y
  yum install wget -y
  yum install gcc*
  yum install lrzsz -y
  2.安装扩展
  yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI net-snmp-devel OpenIPMI OpenIPMI-devel rpm-build
  wget http://202.206.32.136/public/H%20LinuxSoftwares/zabbix-2.4.4.tar.gz----------------------------快照
  3.搭建lnmp环境
  官网:http://lnmp.org
  wget -c http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz && tar zxf lnmp1.3-full.tar.gz && cd lnmp1.3-full && ./install.sh lnmp(最好使用高新版本)
  安装步骤https://lnmp.org/install.html   官网有安装教程
  4.tar -zxvf zabbix-2.4.4.tar.gz
  cd zabbix-2.4.4
  5.编译:./configure --prefix=/usr/local/zabbix --enable-server --with-net-snmp --with-libcurl --with-openipmi --enable-agent
  可能会提示找不到数据库再加一条 --with-mysql
  提示又提示:configure: error: MySQL library not found
  百度了一下,yum install mysql-devel mysql-server
  重试
  6.make install
  #make && make install
  7.创建用户
  #groupadd zabbix
  #useradd -g zabbix -s /sbin/nologin zabbix
  8.创建服务
  echo "zabbix-agent 10050/tcp #Zabbix Agent" >> /etc/services
  echo "zabbix-agent 10050/udp #Zabbix Agent" >> /etc/services
  echo "zabbix-trapper 10051/tcp #Zabbix Trapper" >> /etc/services
  echo "zabbix-trapper 10051/udp #Zabbix Trapper" >> /etc/services
  9.启动文件
  cp misc/init.d/fedora/core5/zabbix_* /etc/init.d/
  chmod 755 /etc/init.d/zabbix_*
  chkconfig --add zabbix_server
  chkconfig --add zabbix_agentd
  chkconfig --level 35 zabbix_server on
  chkconfig --level 35 zabbix_agentd on
  10.修改启动文件
  #vi /etc/init.d/zabbix_server
  ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
  #vi /etc/init.d/zabbix_agentd
  ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
  11.最重要(基础环境已经搭建好,有lnmp环境,就可以直接启动成功)
  启动服务的时候会提示你少lib文件,最简单的方法就是找一个有lampp集成环境的机器直接cp过来就行。
  Starting Zabbix Server: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
  Starting Zabbix Server: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
  Starting Zabbix Server: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
  12.上面的lib文件都cp全以后直接启动zabbix server 和 agentd
  #/etc/init.d/zabbix_server start
  Starting Zabbix Server: [ OK ]
  #/etc/init.d/zabbix_agentd start
  Starting Zabbix Agent: [ OK ]      -----------------------------快照             数据库0p;/9ol.
  13.查看是否启动
  # ps -ef | grep zabbix
  # netstat -apn | grep zabbix
  14.配置WEB界面
  # cp -R /zabbix-2.4.4/frontends/php/* /opt/wwwroot/    /opt/wwwroot这个是网站路径,但是nginx默认路径是可能不是这个。一:把nginx网站路径换成自己创建的;二:将/zabbix-2.4.4/frontends/php/*的文件copy到nginx默认wwwroot路径。nginx网站路径和文件copy路径一致
  # chmod -R 777 /opt/wwwroot/
  15.完成
  访问服务器ip如果显示一个lnmp页面,将wwwroot下的index.html删除,这个页面优先级高
  用户名 admin
  密码 zabbix
  创建数据库表
  mysql -uroot -p
  mysql> create database zabbix;
  mysql> exit
  # cd zabbix-2.4.4/database/mysql/
  mysql -uzabbix -pzabbix -f zabbix
页: [1]
查看完整版本: zabbix server服务安装与配置详情