cxg518 发表于 2019-1-21 09:17:32

Centos 7.0 安装Zabbix (随手记)

  测试系统环境
  ## uname -a
  localhost 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
  #cat /etc/redhat-release
  CentOS Linux release 7.0.1406 (Core)
  # systemctl stop firewalld.service#关闭防火墙
  (1、关闭firewall:
  systemctl stop firewalld.service #停止firewall
  systemctl disable firewalld.service #禁止firewall开机启动
  )
  1、配置LAMP环境
  2、下载 最新版Zabbix
  #wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.2/zabbix-2.4.2.tar.gz
  解压缩
  # tar zxvf zabbix-2.4.2.tar.gz
  3、安装所需的组件
  #yum install -y curl curl-devel net-snmp snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath php-mbstring
  4、创建Zabbix数据库及数据库用户
  # systemctl start mariadb.service
  # systemctl start httpd.service
  # mysql -u root -p   
Enter password:   
Welcome to the MariaDB monitor. Commands end with ; or \g.   
Your MariaDB connection id is 2   
Server version: 5.5.40-MariaDB MariaDB Server   
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.   
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   
MariaDB [(none)]>
  MariaDB [(none)]> create database zabbix;
  MariaDB [(none)]> use zabbix;
  Reading table information for completion of table and column names
  You can turn off this feature to get a quicker startup with -A
  Database changed
  MariaDB > grant all privileges on zabbix.* to zabbix@'%' identified by '12345';
  MariaDB > flush privileges;
  MariaDB > source /root/zabbix-2.4.2/database/mysql/schema.sql
  MariaDB > source /root/zabbix-2.4.2/database/mysql/data.sql
  MariaDB > source /root/zabbix-2.4.2/database/mysql/images.sql
  5、编译安装
  # ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql --enable-net-snmp --with-libcurl
  #make && make install
  6、.添加zabbix服务对应的端口(可以省略),一般系统中都已经存在了,若没有可以如下添加
  #vim /etc/service
  zabbix-agent    10050/tcp    //客户端
  zabbix-agent    10050/udp
  zabbix-trapper10051/tcp    //服务端
  zabbix-trapper10051/udp
  7、为zabbix提供启动脚本和配置文件
  (1)测试zabbix服务启动
  #/usr/local/zabbix/sbin/zabbix_agentd    //客户端
  #/usr/lcoal/zabbix/sbin/zabbix_server    //服务端
  查看端口:
  #netstart -tnlp | grep zabbix
  停止zabbix服务:
  #pkill zabbix
  (2)为zabbix提供开机启动脚本:
  #mkdir -v /etc/zabbix
  #cp /root/zabbix-2.2.2/misc/init.d/tru64/zabbix_agentd /etc/init.d/    //客户端
  #cp /root/zabbix-2.2.2/misc/init.d/tru64/zabbix_server /etc/init.d/    //服务端
  #chmod 777 /etc/init.d/zabbix*
  (3)修改zabbix_agentd、zabbix_server程序目录的位置:
  #vim /etc/init.d/zabbix_agentd
  DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
  #vim /etc/init.d/zabbix_server
  DAEMON=/usr/local/zabbix/sbin/zabbix_server
  启动zabbix服务:
  #service zabbix_agentd start
  #service zabbix_server start
  添加开启启动
  #chkconfig --add zabbix_server
  #chkconfig --add zabbix_agentd
http://s3.运维网.com/wyfs02/M00/59/32/wKioL1TKQt_w02qhAABy6_UbX2g671.jpg
  修改php配置文件
  # vim /etc/php.ini   修改对应的项
  # egrep -v "#|^%" /etc/php.ini
  重启Apache服务
  # systemctl restart httpd.service
http://s3.运维网.com/wyfs02/M01/59/32/wKioL1TKQt-CcBZvAABoBVPITZA048.jpg
http://s3.运维网.com/wyfs02/M02/59/32/wKioL1TKQt_B4ElLAABbYpPCp4c417.jpg
http://s3.运维网.com/wyfs02/M00/59/32/wKioL1TKQt-zlxNAAABbyG4xBes638.jpg
  创建 zabbix.conf.php文件
  # cd /var/www/html/zabbix/conf/   
# vim zabbix.conf.php
  
http://s3.运维网.com/wyfs02/M00/59/35/wKiom1TKQf6jleEEAABJk1TY8Qo448.jpg
  登录
http://s3.运维网.com/wyfs02/M01/59/35/wKiom1TKQf7y8_ITAABEdMSlgc0874.jpg
  默认用户名 admin密码:zabbix
http://s3.运维网.com/wyfs02/M02/59/35/wKiom1TKQf7BSjLqAABdW-gohYY246.jpg
  设置中文界面
  修改胚子文件
  # vim locales.inc.php
http://s3.运维网.com/wyfs02/M00/59/35/wKiom1TKQf6BSNzdAABSOrHRHNw300.jpg、
http://s3.运维网.com/wyfs02/M01/59/35/wKiom1TKQf6xcBYwAAA7GIwd-_0458.jpg



页: [1]
查看完整版本: Centos 7.0 安装Zabbix (随手记)