1. 配置阿里云源
参考链接: https://developer.aliyun.com/mirror
2. 使用阿里云源安装mariadb
dbf -y install mariadb-server mariadb-client
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb #设置开机启动
MySQL_secure_installation
[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
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资料库中找到。
创新互联建站是专业的海兴网站建设公司,海兴接单;提供成都网站设计、成都网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行海兴网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
dnf -y install epel-release
[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)
[root@centos8 ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:
编辑/etc/zabbix/zabbix_server.conf 文件, 修改数据库配置
[root@centos8 ~]# cat /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
编辑/etc/nginx/conf.d/zabbix.conf,取消注释并设置'listen'和'server_name'指令
listen 80;
server_name 192.168.0.111;
编辑文件/etc/php-fpm.d/zabbix.conf,取消注释并设置正确的时区
php_value[date.timezone] = Asia/Shanghai
注意: 必须关闭防火墙firewalld和selinux**(非常重要)**
[root@centos8 ~]# systemctl restart zabbix-server zabbix-agent nginx php-fpm
[root@centos8 ~]# systemctl enable zabbix-server zabbix-agent nginx php-fpm
提示已成功地安装了 Zabbix 前端。配置文件/etc/zabbix/web/zabbix.conf.php 被创建。
默认登录zabbixweb的用户名:Admin, 密码:zabbix
如果没有安装中文字体包,使用dnf安装"langpacks-zh_CN.noarch"
修复中文乱码的解决方法:
安装字体并替换现有字体
[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
我这里使用的监控主机是ubuntu18.04
root@ubuntu:~# apt-get install 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
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