首页 帮助中心 常见问题 CentOS 8和RHEL8配置EPEL仓库具体有什么方法
CentOS 8和RHEL8配置EPEL仓库具体有什么方法
时间 : 2024-08-22 15:31:58 编辑 : 华纳云 阅读量 : 66

  CentOS源包含的大多数的库都是比较旧的。并且,很多流行的库也不存在。EPEL 在其基础上不仅全,而且还够新,重点为大家讲解一下CentOS8和RHEL8配置EPEL仓库具体方法。
  EPEL 仓库的先决条件
  最小化安装的 CentOS 8 和 RHEL 8 服务器 root 或 sudo 管理员权限 网络连接
  在 RHEL 8.x 服务器上安装并启用 EPEL 仓库
  登录或 SSH 到你的 RHEL 8.x 服务器,并执行以下 dnf 命令来安装 EPEL rpm 包,
  [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
  上面命令的输出将如下所示,/uploads/images/202408/22/bb4c10eebe200a600458b196ea34caa0.jpg  
  CentOS8和RHEL8配置EPEL仓库具体方法插图CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法
  EPEL rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 dnf 或 yum 命令,以验证是否启用了 EPEL 仓库,
  [root@linuxtechi ~]# dnf repolist epel
  或者
  [root@linuxtechi ~]# dnf repolist epel -v
  CentOS8和RHEL8配置EPEL仓库具体方法插图1CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法
  在 CentOS 8.x 服务器上安装并启用 EPEL 仓库
  登录或 SSH 到你的 CentOS 8 服务器,并执行以下 dnf 或 yum 命令来安装 epel-release rpm 软件包。在 CentOS 8 服务器中,EPEL rpm 在其默认软件包仓库中。
  [root@linuxtechi ~]# dnf install epel-release -y
  或者
  [root@linuxtechi ~]# yum install epel-release -y
  执行以下命令来验证 CentOS 8 服务器上 EPEL 仓库的状态,
  [root@linuxtechi ~]# dnf repolist epel
  Last metadata expiration check: 0:00:03 ago on Sun 13 Oct 2019 04:18:05 AM BST.
  repo id              repo name                                               status
  *epel                Extra Packages for Enterprise Linux 8 - x86_64          1,977
  [root@linuxtechi ~]#
  [root@linuxtechi ~]# dnf repolist epel -v
  ……………………
  Repo-id      : epel
  Repo-name    : Extra Packages for Enterprise Linux 8 - x86_64
  Repo-status  : enabled
  Repo-revision: 1570844166
  Repo-updated : Sat 12 Oct 2019 02:36:32 AM BST
  Repo-pkgs    : 1,977
  Repo-size    : 2.1 G
  Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos
  Updated    : Sun 13 Oct 2019 04:28:24 AM BST
  Repo-baseurl : rsync://repos.del.extreme-ix.org/epel/8/Everything/x86_64/ (34 more)
  Repo-expire  : 172,800 second(s) (last: Sun 13 Oct 2019 04:28:24 AM BST)
  Repo-filename: /etc/yum.repos.d/epel.repo
  Total packages: 1,977
  [root@linuxtechi ~]#
  以上命令的输出说明我们已经成功启用了 EPEL 仓库。让我们在 EPEL 仓库上执行一些基本操作。
  列出 EPEL 仓库种所有可用包
  如果要列出 EPEL 仓库中的所有的软件包,请运行以下 dnf 命令,
  [root@linuxtechi ~]# dnf repository-packages epel list
  ……………
  Last metadata expiration check: 0:38:18 ago on Sun 13 Oct 2019 04:28:24 AM BST.
  Installed Packages
  epel-release.noarch                   8-6.el8                @epel
  Available Packages
  BackupPC.x86_64                       4.3.1-2.el8            epel
  BackupPC-XS.x86_64                    0.59-3.el8             epel
  CGSI-gSOAP.x86_64                     1.3.11-7.el8           epel
  CGSI-gSOAP-devel.x86_64               1.3.11-7.el8           epel
  Field3D.x86_64                        1.7.2-16.el8           epel
  Field3D-devel.x86_64                  1.7.2-16.el8           epel
  GraphicsMagick.x86_64                 1.3.33-1.el8           epel
  GraphicsMagick-c++.x86_64             1.3.33-1.el8           epel
  …………………………
  zabbix40-web-mysql.noarch             4.0.12-1.el8           epel
  zabbix40-web-pgsql.noarch             4.0.12-1.el8           epel
  zerofree.x86_64                       1.1.1-3.el8            epel
  zimg.x86_64                           2.8-4.el8              epel
  zimg-devel.x86_64                     2.8-4.el8              epel
  zstd.x86_64                           1.4.2-1.el8            epel
  zvbi.x86_64                           0.2.35-9.el8           epel
  zvbi-devel.x86_64                     0.2.35-9.el8           epel
  zvbi-fonts.noarch                     0.2.35-9.el8           epel
  [root@linuxtechi ~]#
  从 EPEL 仓库中搜索软件包
  假设我们要搜索 EPEL 仓库中的 Zabbix 包,请执行以下 dnf 命令,
  [root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix
  上面命令的输出类似下面这样,
  CentOS8和RHEL8配置EPEL仓库具体方法插图2CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库方法
  从 EPEL 仓库安装软件包
  假设我们要从 EPEL 仓库安装 htop 包,运行以下 dnf 命令,
  语法:
  # dnf –enablerepo=”epel” install
  [root@linuxtechi ~]# dnf --enablerepo="epel" install htop -y
  如果我们在上面的命令中未指定 –enablerepo=epel,那么它将在所有可用的软件包仓库中查找 htop 包。本文就是这些内容了,我希望上面的步骤能帮助你在 CentOS 8 和 RHEL 8 服务器上启用并配置 EPEL 仓库,请在下面的评论栏分享你的评论和反馈。

华纳云 推荐文章
Netlify部署一个网站的完整演示 如何服务器上搭配大模型docker+ollama+langchain工具运行环境 Linux /etc/group的文件解析步骤 docker快速部署Stirling-PDF的一般流程 盘点使用中MySQL出现报错情况有哪些 Linux系统文件操作提示Read-only file system解决方法 如何更换Linux Windows多IP云服务器出口IP地址 Linux必备技能SRC与补丁的应用 Ubuntu Postfix配置TLS加密的方法 Linux VPS服务器CPU负载及内存占用自动重启bash shell脚本
客服咨询
7*24小时技术支持
技术支持
渠道支持