centos7 安装部署zabbix

2019-04-25 来源: Carrie& 发布在  https://www.cnblogs.com/carriezhangyan/p/10768204.html

由于zabbix提供集中的web监控管理界面,因此服务在web界面的呈现需要LAMP架构支持。

php 连接mysql服务,因为7版本mysql要收费,所以我们安装mariadb,

一、安装LAMP环境包

  yum install -y httpd mariadb-server mariadb php php-mysql
启动服务:
  systemctl enable httpd
  systemctl start httpd
  systemctl enable mariadb
  systemctl start mariadb

二、安装zabbix

# rpm -ivh http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
# yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
# mysql
//创建一个zabbix库并设置为utf8的字符编码格式
mysql > create database zabbix character set utf8 collate utf8_bin; 

//创建账户并且授权设置密码
mysql > grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';  

//刷新
 mysql > flush privileges;  

// 退出
mysql > exit      

// 导入表
  # cd /usr/share/doc/zabbix-server-mysql-3.2.10/
  # gunzip create.sql.gz
  # mysql
  mysql > use zabbix;
  mysql > source create.sql;
  mysql > exit

//修改zabbix的配置文件
  # cat /etc/zabbix/zabbix_server.conf |grep -Evn "#|^$"
    38:LogFile=/var/log/zabbix/zabbix_server.log
    49:LogFileSize=0
    72:PidFile=/var/run/zabbix/zabbix_server.pid
    82:SocketDir=/var/run/zabbix
    91:DBHost=localhost
    100:DBName=zabbix
    116:DBUser=zabbix
    356:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    473:Timeout=4
    516:AlertScriptsPath=/usr/lib/zabbix/alertscripts
    527:ExternalScripts=/usr/lib/zabbix/externalscripts
    563:LogSlowQueries=3000
    678:StatsAllowedIP=127.0.0.1

//启动zabbix服务,设置开机自启

  # systemctl start zabbix-server

  # systemctl enable zabbix-server

// 配置http

  # grep -Evn "^$|#" /etc/httpd/conf.d/zabbix.conf
    5:Alias /zabbix /usr/share/zabbix
    7:<Directory "/usr/share/zabbix">
    8: Options FollowSymLinks
    9: AllowOverride None
    10: Require all granted
    12: <IfModule mod_php5.c>
    13: php_value max_execution_time 300
    14: php_value memory_limit 128M
    15: php_value post_max_size 16M
    16: php_value upload_max_filesize 2M
    17: php_value max_input_time 300
    18: php_value max_input_vars 10000
    19: php_value always_populate_raw_post_data -1
    21: php_value date.timezone Asia/Shanghai    //默认的是“# php_value date.timezone Europe/Riga”,需要修改将注释去掉,不然在浏览器上启动时会报时间错误
    22: </IfModule>

//启动http

  # systemctl restart httpd 

三、登陆zabbix网址

在浏览器上输入:http://服务器ip/zabbix ,即可进入zabbix设置界面

zabbix首次登陆的用户名是:Admin   密码是:zabbix

相关文章