Rocky Linux镜像
简介
Rocky Linux是CentOS的一个分支,它位于Red Hat Enterprise Linux(RHEL)的下游。与CentOS一样,它提供了非常适合服务器的稳定版Linux。它旨在作为CentOS的完全兼容替代品。
下载地址:rockylinux安装包下载_开源镜像站-阿里云
配置方法
执行以下命令替换默认源
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
-i.bak \
/etc/yum.repos.d/Rocky-*.repo
dnf makecache
1、执行yum clean all清除原有yum缓存。
2、执行yum makecache(刷新缓存)或者yum repolist all(查看所有配置可以使用的文件,会自动刷新缓存)。
相关链接
-
官方主页:Rocky Linux
为您的平台安装和配置 Zabbix 服务器
关闭nftables和selinux
一、关闭防火墙:
systemctl stop firewalld.service #停止firewalld服务
systemctl disable firewalld.service #设置开机默认不启动
二、关闭selinux:
getenforce #查看状态
————————————————
systemctl disable --now firewalld.service
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
安装 Zabbix 存储库
-
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-2.el8.noarch.rpm
-
dnf clean all
安装Zabbix server,Web前端,agent
-
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agentc.
创建初始数据库
确保您已启动并运行数据库服务器。
注意:zabbix6.0版本所要求的的mariadb软件包的版本10.05.00较高,系统自带的mariadb软件包最高只有10.03.28不能满足需要,部署后会出现无法启动zabbix-server的问题,
-
dnf module list mariadb 查询 mariadb版本绑定
-
dnf module reset mariadb 重置mariadb版本绑定
-
dnf module enable mariadb:10.5 选定mariadb版本绑定
安装数据库
-
yum install mariadb-server -y
启动数据库,并配置开机自动启动:
-
systemctl enable --now mariadb
使用以下命令初始化 mariadb 并配置 root 密码:password
执行命令:mysql_secure_installation
直接回车,空
是否设置密码:y
输入设置密码:password
再次输入密码:password
是否移除anonymous用户:y
是否不允许root远程登录:n
是否移除test数据库:y
是否更新:y
使用 root 用户进入 mysql,并建立 zabbix 数据库,注意数据库编码:
第三行,配置zabbix的用户名为zabbix密码为zabbix:
mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
使用以下命令导入 zabbix 数据库,zabbix 数据库用户为 zabbix,密码为zabbix :
-
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
输入密码为:zabbix
为Zabbix前端配置PHP
编辑配置文件 /etc/zabbix/zabbix_server.conf
编辑配置文件vi /etc/nginx/conf.d/zabbix.conf
写成如下,将前面的#去掉:
listen 80;
server_name 本服务器电脑的IP地址(重点);
#比如为10.8.8.91 就应该改为server_name 10.8.8.91;
为Zabbix server配置数据库
编辑配置文件 /etc/nginx/conf.d/zabbix.conf
修改 zabbix server 配置文件vi /etc/zabbix/zabbix_server.conf 里的数据库密码为zabbix
找到DBPassword一行,在下面添加:
DBPassword=zabbix
启动相关服务,并配置开机自动启动
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
————————————————
中文乱码
字体文件目录:
zabbix6.0:/usr/share/zabbix/assets/fonts
php 脚本文件位置:
/usr/share/zabbix/include/defines.inc.php
将Win10操作系统 C:\Windows\Fonts目录下的任意字体,拷贝到/usr/share/zabbix/assets/fonts/目录下(如果是zabbix4.0请拷贝到/usr/share/zabbix/fonts/这个目录下),更改后缀为’.ttf’
修改php脚本文件
vim /usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'msyh'); // font file name
define('ZBX_FONT_NAME', 'msyh');
重启zabbix服务
systemctl restart zabbix-server
————————————————