在 CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库

如何在 CentOS 8 和 RHEL 8 服务器上启用和使用 EPEL 存储库

代表 “Extra Packages for Enterprise Linux”,它是一个自由开源的附加软件包仓库,可用于 CentOS 和 服务器。顾名思义,EPEL 仓库提供了额外的软件包,这些软件在 CentOS 8 和 RHEL 8 的默认软件包仓库中不可用。
在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 服务器上启用和

EPEL 仓库的先决条件

  • 最小化安装的 CentOS 8 和 RHEL 8 服务器
  • root 或 sudo 管理员权限
  • SSH网络连接

在 RHEL 8.x 服务器上安装并启用 EPEL 仓库
登录或 SSH 到你的 RHEL 8.x 服务器,并执行以下 dnf 命令来安装 EPEL rpm 包,

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

复制代码上面命令的输出将如下所示,

EPEL rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 dnf 或 yum 命令,以验证是否启用了 EPEL 仓库,

dnf repolist epel

或者

dnf repolist epel -v

在 CentOS 8.x 服务器上安装并启用 EPEL 仓库
登录或 SSH 到你的 CentOS 8 服务器,并执行以下 dnf 或 yum 命令来安装 epel-release rpm 软件包。在 CentOS 8 服务器中,EPEL rpm 在其默认软件包仓库中。

dnf install epel-release -y

或者

yum install epel-release -y

执行以下命令来验证 CentOS 8 服务器上 EPEL 仓库的状态,

dnf repolist epel

已经成功启用了 EPEL 仓库。让我们在 EPEL 仓库上执行一些基本操作。
列出 EPEL 仓库种所有可用包
如果要列出 EPEL 仓库中的所有的软件包,请运行以下 dnf 命令,

dnf repository-packages epel list

从 EPEL 仓库中搜索软件包
假设我们要搜索 EPEL 仓库中的 Zabbix 包,请执行以下 dnf 命令,

dnf repository-packages epel list | grep -i zabbix

从 EPEL 仓库安装软件包
假设我们要从 EPEL 仓库安装 htop 包,运行以下 dnf 命令,
语法:

dnf –enablerepo=”epel” install <包名>

例如:

dnf --enablerepo="epel" install htop -y

注意:如果我们在上面的命令中未指定 –enablerepo=epel,那么它将在所有可用的软件包仓库中查找 htop 包。

评分

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注