随笔 - 148  文章 - 3  评论 - 2  阅读 - 11万

CentOS 7 安装 Zabbix Server 5.0

返回目录

Pre-setup:已经安装好 mysql

返回目录

1. 关闭防火墙及 selinux

# systemctl disable firewalld
# systemctl stop firewalld
# firewall-cmd --state
not running
# reboot

 

# vi /etc/selinux/config

 

返回目录

2. 安装 Zabbix Server

参考链接: 

https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=apache

 

1)ADDING ZABBIX REPOSITORY

# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all

 如果1)安装有问题,连接国外的服务器 repo.zabbix.com 经常连接失败,可参照 https://www.cnblogs.com/bruce-he/p/14385216.html

2)SERVER/PROXY INSTALLATION

# yum install zabbix-server-mysql zabbix-agent

 3)SERVER FRONTED

# yum install centos-release-scl

Edit file /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.

[zabbix-frontend]
...
enabled=1
...

Install Zabbix frontend packages.

# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

4)Run the following on your database host.

复制代码
# mysql -uroot -p
<password1>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by '<password2>';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges; mysql
> quit;

备注: password1为 mysql root用户的密码; password2为设置的 zabbix 用户的密码
复制代码

5)On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

解决 mysql command not found

# ln -s /mnt/software/mysql/bin/mysql /usr/bin
# ln -s /mnt/data/mysql3307/mysql.sock /tmp/mysql.sock

备注:将 mysql 的bin 目录和 data的 sock 软连接到系统默认

 

6)CONFIGURE DATABASE FOR ZABBIX SERVER/PROXY

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>

7)Configure PHP for Zabbix frontend

# vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

php_value[date.timezone] = Asia/Shanghai

8)STARTING ZABBIX SERVER PROCESS

# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

 

返回目录

3. 配置 front

      登录 http://zabbixserverip/zabbix,用户名密码为 Admin/zabbix

    

返回目录

4. 安装 Zabbix agent 并启动

安装zabbix agent
# yum install zabbix-agent

启动 zabbix agent
# systemctl restart zabbix-agent
# systemctl enable zabbix-agent

 

 

返回目录

问题

1. Zabbix server is running, value = No

 # tailf  /var/log/zabbix/zabbix_server.log
  connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

  解决办法:

 

# vi /etc/zabbix/zabbix_server.conf

   DBSocket=/tmp/mysql.sock

   备注: 配置 DBSocket

# systemctl stop zabbix-server
# systemctl start zabbix-server

 

2. Zabbix front php 配置有问题,需要重新配置时, http://ip/zabbix/setup.php

 

3. 安装zabbix之后登陆报错:Error connecting to database: No such file or directory

  修改php.ini文件

[root@office_zabbix4_007117 etc]#vim /usr/local/php/etc/php.ini

mysqli.default_socket = /mnt/data/mysql3307/mysql.sock

    添加上面一行,指向mysql 真正运行的 socket

 

posted on   bruce_he  阅读(320)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示

目录导航