Linux使用CentOS 7內核修改鏡像源解決“Could not resolve host: mirrorlist.centos.org;未知的錯誤“問題
更新時間:2025年07月17日 17:22:37 作者:努力的雅木茶
解決yum安裝問題需檢查網絡、備份配置、下載新源、生成緩存及更新源,以恢復正常使用
解決yum安裝工具時提示以下錯誤信息
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的錯誤"
One of the configured repositories failed (未知),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
1、首先確保虛擬機網絡暢通

2、備份系統自帶yum源配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back
3、通過curl下載yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4、運行yum makecache生成緩存
yum makecache

5、更新yum源,等待完成即可使用yum下載命令
yum -y update

總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
Linux 創(chuàng)建子進程執(zhí)行任務的實現方法
下面小編就為大家分享一篇Linux 創(chuàng)建子進程執(zhí)行任務的實現方法,具有很好的參考價值,希望對大家有所幫助,一起跟隨小編過來看看吧2018-01-01
Linux主機登錄abrt-cli status timed out的問題及解決
這篇文章主要介紹了Linux主機登錄abrt-cli status timed out的問題及解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-09-09
Linux防火墻配置及iptables與firewalld的使用解讀
防火墻是一種網絡安全設備,通過規(guī)則控制進出網絡的訪問行為,它分為硬件防火墻和軟件防火墻兩大類,iptables是Linux系統中用于配置防火墻的工具,具有4個表和5個鏈,firewall命令用于配置和管理防火墻,有drop、block、public、external、dmz等不同的區(qū)域配置2025-01-01
Linux使用vim編輯文件保存時報E514:write error (file system full?)問題解決
最近在用vi編輯文檔,保存的時候,提示如下錯誤:E514: write error (file system full?),所以這篇文章主要給大家介紹了關于Linux使用vim編輯文件保存時報E514:write error (file system full?)問題的解決方法,需要的朋友可以參考借鑒,下面隨著小編來一起看看吧。2018-02-02
在VM虛擬機中CentOS7安裝VMware Tools全過程
這篇文章主要介紹了在VM虛擬機中CentOS7安裝VMware Tools全過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-03-03

