could not resolve host:mirrors.cloud.aliyuncs.com;Unknown error----使用 yum安裝的時候
阿新 • • 發佈:2021-10-17
1.執行命令後報如下錯誤
解決方案
1.首先進入 /etc/yum.rebpos.d 目錄備份檔案 CentOS-Base.repo,執行
cp CentOS-Base.repo CentOS-Base.repo.bak
2.修改CentOS-Base.repo檔案
http://mirrors.cloud.aliyuncs.com/centos/批量替換為 http://mirrors.aliyun.com/centos
執行:(這裡不懂得可以直接手動,注意不要刪多了,反正也沒幾個可以替換的)
%s#http://mirrors.cloud.aliyuncs.com/centos/#http://mirrors.aliyun.com/centos#g
3.備份epel.repo檔案
http://mirrors.cloud.aliyuncs.com/centos/批量替換為http://mirrors.aliyun.com/centos,執行
cp epel.repo epel.repo.bak
4.修改epel.repo檔案
執行:(這裡不懂得可以直接手動,注意不要刪多了,反正也沒幾個可以替換的)
%s#http://mirrors.cloud.aliyuncs.com#http://mirrors.aliyun.com#g
5.執行
yum -y update
轉自:
https://blog.csdn.net/qq_38018165/article/details/93666428
注:此博主不錯,解決了困擾我半年的問題(頭大)