如何在CentOS 8本地安装xorg-x11-apps-7.7-21.el8.x86_64.rpm?
在CentOS 8.5.2111上安装xorg-x11-apps(含xeyes)的解决方案
问题场景
尝试在CentOS 8.5.2111上安装并运行xeyes,此前在CentOS Stream 9上使用以下命令成功安装对应RPM包:
dnf localinstall ./xorg-x11-apps-7.7-21.el8.x86_64.rpm
但在CentOS 8执行相同命令时,出现域名解析错误:
[root@localhost apps]# dnf localinstall ./xorg-x11-apps-7.7-21.el8.x86_64 CentOS Linux 8 - AppStream 0.0 B/s | 0 B 00:01 Errors during downloading metadata for repository 'appstream': - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
原因分析
CentOS 8已停止官方维护,mirrorlist.centos.org针对CentOS 8的镜像列表服务已下线;而CentOS Stream 9仍在维护周期内,官方镜像服务正常,因此同一条命令在两个系统上表现不同。dnf localinstall默认会尝试从官方仓库拉取依赖或元数据,触发域名解析失败的报错。
解决方法
直接使用rpm命令安装本地RPM包,通过--nodeps参数跳过依赖检查(需确认本地包已满足运行所需依赖,或可接受忽略依赖的风险):
rpm -ivh --nodeps xorg-x11-apps-7.7-21.el8.x86_64
内容的提问来源于stack exchange,提问作者jstack100
相关产品推荐
相关产品推荐

