温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos 8系统下安装zabbix4.5的方法

发布时间:2020-05-21 13:49:05 来源:亿速云 阅读:579 作者:鸽子 栏目:系统运维
1安装mariadb数据库
1. 配置阿里云源
参考链接: https://developer.aliyun.com/mirror
2. 使用阿里云源安装mariadb
dbf -y install mariadb-server mariadb-client
1.1 .1 使用systemctl进行mariadb服务管理
systemctl start mariadb  #启动MariaDB
systemctl stop mariadb  #停止MariaDB
systemctl restart mariadb  #重启MariaDB
systemctl enable mariadb  #设置开机启动
1.1.2 初始化mariadb
mysql_secure_installation
1.2  配置zabbix仓库
[root@m01 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/8/x86_64/zabbix-release-4.5-2.el8.noarch.rpm
或
[root@m01 ~]# rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.5/rhel/8/x86_64/zabbix-release-4.5-2.el8.noarch.rpm

[root@m01 ~]# dnf clean all
1.3 安装Zabbix程序包, 以及Mysql, 前端,代理
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
如果出现以下报错;
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
Last metadata expiration check: 0:00:45 ago on Fri 13 Mar 2020 04:29:48 PM CST.
Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides libssh3.so.1()(64bit) needed by zabbix-server-mysql-5.0.0-0.2alpha2.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

解决方法:
    手动安装libssh3
    dnf -y install http://mirror.centos.org/centos/8.0.1905/AppStream/x86_64/os/Packages/libssh3-1.8.0-8.module_el8.0.0+189+f9babebb.1.x86_64.rp

注意:nginx软件包在官方存储库中不可用。可以在epel资料库中找到。

dnf -y install epel-release
1.4 创建Zabbix数据库及用户
[root@centos8 ~]# mysql -u root -p 
Enter password: 
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
Query OK, 0 rows affected (0.008 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.008 sec)
1.5 导入 Zabbix数据至数据库中
[root@centos8 ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:
1.6 配置Zabbix服务器数据库

编辑/etc/zabbix/zabbix_server.conf 文件, 修改数据库配置

[root@centos8 ~]# cat /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
1.7 为zabbix前端配置php

编辑/etc/nginx/conf.d/zabbix.conf,取消注释并设置'listen'和'server_name'指令

listen 80;
server_name 192.168.0.111;
进入配置文件/etc/nginx/nginx.conf里面, 注释掉server所有代码块

编辑文件/etc/php-fpm.d/zabbix.conf,取消注释并设置正确的时区

php_value[date.timezone] = Asia/Shanghai

注意: 必须关闭防火墙firewalld和selinux**(非常重要)**

1.8 启动Zabbix 服务进程,并加入开机自启动
[root@centos8 ~]# systemctl restart zabbix-server zabbix-agent nginx php-fpm
[root@centos8 ~]# systemctl enable zabbix-server zabbix-agent nginx php-fpm
2 WEB安装步骤
2.1 浏览器打开地址:http://192.168.0.111/setup.php
2.2 配置zabbix连接数据库

centos 8系统下安装zabbix4.5的方法

2.3  配置 ZabbixServer 服务器的信息

centos 8系统下安装zabbix4.5的方法

2.4 确认检查

centos 8系统下安装zabbix4.5的方法

2.5 安装成功

提示已成功地安装了 Zabbix 前端。配置文件/etc/zabbix/web/zabbix.conf.php 被创建。

centos 8系统下安装zabbix4.5的方法

2.6 登录zabbix

默认登录zabbixweb的用户名:Admin, 密码:zabbix

2.7 调整字符集为中文并修复中文乱码

如果没有安装中文字体包,使用dnf安装"langpacks-zh_CN.noarch"

centos 8系统下安装zabbix4.5的方法

修复中文乱码的解决方法:

安装字体并替换现有字体

[root@centos8 ~]# dnf -y install wqy-microhei-fonts
[root@centos8 ~]# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf

3. 安装zabbix监控主机

3.1 安装zabbix-agent

我这里使用的监控主机是ubuntu18.04

root@ubuntu:~# apt-get install zabbix-agent
3.2 配置zabbix-agent
root@ubuntu:~# vim /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.0.111
ServerActive=192.168.0.111
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
3.3 启动zabbix-agent并检查
root@ubuntu:~# systemctl start zabbix-agent.service
root@ubuntu:~# systemctl enable zabbix-agent.service
root@ubuntu:~# netstat -ntlp |grep 10050
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      5662/zabbix_agentd  
tcp6       0      0 :::10050                :::*                    LISTEN      5662/zabbix_agentd  
3.4 zabbix-web界面,添加主机

centos 8系统下安装zabbix4.5的方法

centos 8系统下安装zabbix4.5的方法

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI