Linux使用CentOS 7內(nèi)核修改鏡像源解決“Could not resolve host: mirrorlist.centos.org;未知的錯誤“問題
更新時間:2025年07月17日 17:22:37 作者:努力的雅木茶
解決yum安裝問題需檢查網(wǎng)絡(luò)、備份配置、下載新源、生成緩存及更新源,以恢復(fù)正常使用
解決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、首先確保虛擬機(jī)網(wǎng)絡(luò)暢通
2、備份系統(tǒng)自帶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
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Linux 創(chuàng)建子進(jìn)程執(zhí)行任務(wù)的實現(xiàn)方法
下面小編就為大家分享一篇Linux 創(chuàng)建子進(jìn)程執(zhí)行任務(wù)的實現(xiàn)方法,具有很好的參考價值,希望對大家有所幫助,一起跟隨小編過來看看吧2018-01-01Linux主機(jī)登錄abrt-cli status timed out的問題及解決
這篇文章主要介紹了Linux主機(jī)登錄abrt-cli status timed out的問題及解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-09-09Linux防火墻配置及iptables與firewalld的使用解讀
防火墻是一種網(wǎng)絡(luò)安全設(shè)備,通過規(guī)則控制進(jìn)出網(wǎng)絡(luò)的訪問行為,它分為硬件防火墻和軟件防火墻兩大類,iptables是Linux系統(tǒng)中用于配置防火墻的工具,具有4個表和5個鏈,firewall命令用于配置和管理防火墻,有drop、block、public、external、dmz等不同的區(qū)域配置2025-01-01Linux使用vim編輯文件保存時報E514:write error (file system full?)問題解決
最近在用vi編輯文檔,保存的時候,提示如下錯誤:E514: write error (file system full?),所以這篇文章主要給大家介紹了關(guān)于Linux使用vim編輯文件保存時報E514:write error (file system full?)問題的解決方法,需要的朋友可以參考借鑒,下面隨著小編來一起看看吧。2018-02-02在VM虛擬機(jī)中CentOS7安裝VMware Tools全過程
這篇文章主要介紹了在VM虛擬機(jī)中CentOS7安裝VMware Tools全過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-03-03詳解CentOS8更換yum源后出現(xiàn)同步倉庫緩存失敗的問題
這篇文章主要介紹了詳解CentOS8更換yum源后出現(xiàn)同步倉庫緩存失敗的問題,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-03-03Linux系統(tǒng)設(shè)置tomcat開機(jī)自啟介紹
大家好,本篇文章主要講的是Linux系統(tǒng)設(shè)置tomcat開機(jī)自啟介紹,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽2021-12-12