wyyy721 发表于 2019-1-21 06:50:44

1、CentOS6.5 LAMP平台安装Zabbix2.2.10

  1、安装LANMP环境
  yum -yinstall gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysqlhttpd-manual mod_ssl mode_perl mod_auth_mysql php-gd php-xml php-mbstringphp-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devellibdbi-dbd-mysql net-snmp-devel curl-devel unix0DBC-devel OpenIPMI-develjava-devel
  

  2、测试PHP
  cd /var/www/html/
  vim index.php
  
  chkconfig httpd on
  service http restart
  在网页输入服务器的IP地址,测试PHP是否正常:
  http://8.8.8.109/
http://s3.运维网.com/wyfs02/M01/74/D6/wKioL1YrNVHBeeNtAABgq6jsjrw275.jpg
  

  3、安装Zabbix-Server
  tar zxvf zabbix-2.2.10.tar.gz
  cd zabbix-2.2.10
  ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
  checking for main in -lodbc... yes
  checking whether unixodbc is usable... no
  configure: error: cannot use unixODBC library
  

  yuminstall unixODBC-devel
  ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
  checking for SSH2 support... no
  configure: error: SSH2 library not found
  

  yum install -y libssh2-devel
  ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java
  checking for LDAP support... no

  configure: error: Invalid LDAP directory - unable to find ldap.h
  

  yum install openldap
  yum install openldap-devel
  ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java

  make && make install
  

  4、配置MySQL,导入zabbix数据库
  useradd zabbix
  cd zabbix-2.2.10
  

  chkconfig mysqld on
  service mysqld restart
  

  修改root密码,创建名为zabbix的数据库及用户名和密码都是zabbix的用户
  

  mysqladmin -uroot password 'mysql_pass'
  mysql -uroot -p
  create database zabbix characer set utf8;
  grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
  flush privileges;
  

  导入数据库
  mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql
  mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
  mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql
  mkdir /var/log/zabbix
  chown zabbix.zabbix /var/log/zabbix/
  

  5、复制启动脚本

  cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
  chmod 755 /etc/init.d/zabbix_*
  sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_server
  sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
  

  6、服务器端配置,将数据库、用户名、密码修改为刚才新建的
  

  vim /etc/zabbix/zabbix_server.conf
  

  DBName=zabbix
  DBUser=zabbix
  DBPassword=zabbix
  
7、复制网页文件值apache目录
  cp -r ./frontends/php/ /var/www/html/zabbix
  chown -R apache.apache /var/www/html/zabbix
  

  chkconfig zabbix_server on
  service zabbix_server restart
  

  8、通过WEB配置Zabbix-Server
  http://8.8.8.109/zabbix
http://s3.运维网.com/wyfs02/M00/74/DA/wKiom1YrQg2jeh2vAAK7rNtcpFU849.jpg
http://s3.运维网.com/wyfs02/M00/74/D7/wKioL1YrQkOhp4Y9AANUbKWDXNE692.jpg
  修改/etc/php.ini后,重启httpd服务
  service httpd restart

  

http://s3.运维网.com/wyfs02/M01/74/DA/wKiom1YrQ8bg_XYPAAMp6MaH9JA066.jpg
http://s3.运维网.com/wyfs02/M01/74/D7/wKioL1YrQ_uBlNtzAALOMK3rf-4233.jpg
http://s3.运维网.com/wyfs02/M01/74/DA/wKiom1YrRIHjFVAsAAJYujQWJDE685.jpg
http://s3.运维网.com/wyfs02/M01/74/D7/wKioL1YrRLXB_3X4AAKp6lltU44769.jpg
http://s3.运维网.com/wyfs02/M02/74/DA/wKiom1YrRIrBSANRAAIHwc6yYaE878.jpg
http://s3.运维网.com/wyfs02/M02/74/DA/wKiom1YrRVrC0bPBAAF7MKNQjoc415.jpg
http://s3.运维网.com/wyfs02/M02/74/D7/wKioL1YrRYvBzIh0AALVylOLt9s985.jpg
  

  9、开启中文支持及更正中文乱码问题
  开启中文支持:
  vim /var/www/html/zabbix/include/locales.inc.php
zh_CN' => array('name' => _('Chinese (zh_CN)'),      'display' => true),
将false改为true
更正中文乱码问题:
  在Windows中找到所需的字体文件传到/var/www/html/zabbix/fonts目录下,修改zabbix的web端/var/www/html/zabbix/include/defines.inc.php将原来的字体替换掉.
  
  #define('ZBX_GRAPH_FONT_NAME',          'DejaVuSans'); // font file name
  define('ZBX_GRAPH_FONT_NAME',         'simkai'); // font file name
  
  #define('ZBX_FONT_NAME', 'DejaVuSans');
  define('ZBX_FONT_NAME', 'simkai');
  

  10、Linux客户端安装

  
  yum -y install gcc gcc-c++
  useradd zabbix
  tar zxvf zabbix-2.2.10.tar.gz
  cd zabbix-2.2.10
  ./configure --prefix=/usr --sysconfdir=/etc/zabbix --enable-agent
  make && make install
  mkdir /var/log/zabbix
  chown zabbix.zabbix /var/log/zabbix/
  cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
  chown 755 /etc/init.d/zabbix_agentd
  sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/#g" /etc/init.d/zabbix_agentd
  sed -i "s/Server\=127.0.0.1/Server\=127.0.0.1,8.8.8.109/g" /etc/zabbix/zabbix_agentd.conf
  sed -i "s/ServerActive\=127.0.0.1/ServerActive\=8.8.8.109/g" /etc/zabbix/zabbix_agentd.conf
  sed -i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g" /etc/zabbix/zabbix_agentd.conf
  sed -i "#UnsafeUserParameters=0#aUnsafeUserParameters=1\n" /etc/zabbix/zabbix_agentd.conf
  sed -i "s/Hostname\=Zabbix server/Hostname\=CentOS6.5/g" /etc/zabbix/zabbix_agentd.conf
  

  chkconfig iptables off
  service iptables off
  

  chkconfig zabbix_agentd on
  service zabbix_agentd restart
  

  测试客服端是否安装成功
  # zabbix_get -s 8.8.8.103 -k system.uname
  Linux Zabbxi_Client 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686
  

  11、Windows 7客户端安装
  将zabbix_agents_2.2.9.win.zip解压到C:\Program Files目录,修改C:\Program Files\zabbix_agentd.win里的三项内容如下
  Server=8.8.8.109
  ServerActive=8.8.8.109
  Hostname=Windows7
  

  注册、启动、停止服务
  C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"
  zabbix_agentd.exe : service installed successfully
  zabbix_agentd.exe : event source installed successfully
  

  C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -s -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"
  zabbix_agentd.exe : service started successfully
  

  C:\Program Files\zabbix_agents_2.2.9.win\bin\win32>zabbix_agentd.exe --install -x -c "C:\Program Files\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf"
  zabbix_agentd.exe : service stopped successfully
  

  测试客服端是否安装成功
  # zabbix_get -s 8.8.8.100 -k system.uname
  Windows PC 6.1.7601 Microsoft Windows 7 Ultimate Edition Service Pack 1 x86
  




页: [1]
查看完整版本: 1、CentOS6.5 LAMP平台安装Zabbix2.2.10