1. 程式人生 > >解決 "Couldn't resolve host 'apt.sw.be'" 錯誤

解決 "Couldn't resolve host 'apt.sw.be'" 錯誤

解決  "Couldn't resolve host 'apt.sw.be'" 錯誤

使用 yum 命令時,出錯如下:

Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://apt.sw.be/redhat/el6/en/mirrors-rpmforge error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'apt.sw.be'"
http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'apt.sw.be'"
Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge. Please verify its path and try again

解決辦法:

 進入目錄 cd /etc/yum.repos.d/

將 rpmforge.repo為 rpmforge.repo.bak  問題解決

如果沒有解決,或引發

Loading mirror speeds from cached hostfile   

No Packages marked for Update

這個問題

最好的辦法,換成國內的源

將上面的操作還原 即  mv  rpmforge.repo.bak 為 rpmforge.repo

進入目錄   cd /etc/yum.repos.d/

[1] 首先備份/etc/yum.repos.d/CentOS-Base.repo 

cp CentOS-Base.repo CentOS-Base.repo.bak
[2] 進入yum源配置檔案所在資料夾


[[email protected] yum.repos.d]# cd /etc/yum.repos.d/
[3] 下載163的yum源配置檔案,放入/etc/yum.repos.d/(操作前請做好相應備份)


[[email protected]

yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

[4]將下載的CentOS6-Base-163.repo 重新命名

[[email protected] yum.repos.d]# mv CentOS6-Base-163.repo CentOS6-Base.repo

[5] 清除快取 並更新

[[email protected] yum.repos.d]# yum clean all

[[email protected] yum.repos.d]# yum makecache 

yum update更新時不升級核心

[[email protected] yum.repos.d]# yum --exclude=kernel* update

同理換成阿里的源 也是一樣操作,附阿里的地址

CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--------------------- 
作者:朱志飛 
來源:CSDN 
原文:https://blog.csdn.net/feiz3020/article/details/79812798 
版權宣告:本文為博主原創文章,轉載請附上博文連結!

相關推薦

no