在下載文件出現(xiàn)以下錯(cuò)誤
[root@server ~]# yum install gcc
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
RHEL8.5-BaseOS??????????????????????????????????????????????????????????????????????????????????????? 0.0? B/s |?? 0? B???? 00:00?? ?
Errors during downloading metadata for repository 'BaseOS':
? - Curl error (37): Couldn't read a file:// file for file:///mnt/BaseOS/repodata/repomd.xml [Couldn't open file /mnt/BaseOS/repodata/repomd.xml]
Error: Failed to download metadata for repo 'BaseOS': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
原因:CentOS 8操作系統(tǒng)版本結(jié)束了生命周期
解決方案:
1、刪除或者備份 /etc/yum.repos.d 路徑下的本地yum文件,我這里的是base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、訪問阿里云官網(wǎng)centos鏡像_centos下載地址_centos安裝教程-阿里巴巴開源鏡像站,根據(jù)官方步驟,將yum源切換成阿里云的。
1)下載新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
2)運(yùn)行 yum makecache 生成緩存
yum makecache
3)CentOS 8 結(jié)束生命周期切換源
公網(wǎng)用戶:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
阿里云ecs用戶:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.aliyuncs.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/CentOS-Base.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/CentOS-Base.repo &&
sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
3、非阿里云ECS用戶會(huì)出現(xiàn) Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影響使用。用戶也可自行修改相關(guān)配置: eg:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
?至此安裝成功
如果下載速度過慢,訪問阿里云容器鏡像服務(wù)->鏡像工具->鏡像加速器,進(jìn)行里面的配置(阿里云登錄 - 歡迎登錄阿里云,安全穩(wěn)定的云計(jì)算服務(wù)平臺(tái))文章來源:http://www.zghlxwxcb.cn/news/detail-638003.html
如果出現(xiàn)報(bào)錯(cuò)Failed to restart docker.service: Unit docker.service not found. 這是因?yàn)檩斎雂ocker命令會(huì)自動(dòng)將docker變成podman,所以需要用systemctl restart podman命令文章來源地址http://www.zghlxwxcb.cn/news/detail-638003.html
到了這里,關(guān)于centos8.5本地yum源報(bào)錯(cuò)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!