如何在CentOS 8上安装moreutils?解决依赖与仓库报错问题
CentOS 8 安装moreutils报错解决方案
问题原因
两个报错分别对应两个核心问题:
- 直接安装时缺少
perl(IPC::Run)依赖:该依赖包默认存放在powertools仓库中,CentOS 8默认未启用该仓库 - 启用仓库时报错
Unknown repo: 'PowerTools':CentOS 8中该仓库的官方ID为全小写的powertools,不是首字母大写格式
解决步骤
- 先安装dnf配置管理插件(未安装的情况下执行):
dnf install -y dnf-plugins-core
- 启用powertools仓库:
dnf config-manager --set-enabled powertools
- 重新安装moreutils即可:
dnf install -y moreutils
- 验证安装成功(以sponge工具为例):
sponge --version
异常兜底(如找不到powertools仓库)
如果执行上述步骤仍提示找不到powertools仓库,说明你的CentOS 8系统默认源已失效(CentOS 8已于2021年底停止官方支持),可先执行以下命令替换为vault源后再走上述安装步骤:
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* dnf clean all && dnf makecache
内容的提问来源于stack exchange,提问作者user1079703
相关产品推荐
相关产品推荐

