CentOS yum鏡像改爲阿里雲的鏡像

詳情請查看 阿里雲官方網站: https://opsx.alibaba.com/mirro  幫助信息

修改步驟:

1、備份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下載新的CentOS-Base.repo 到/etc/yum.repos.d/ 

 

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -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

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、清除緩存

yum makecache

如果遇到

Loaded plugins: fastestmirror, refresh-packagekit, security
Existing lock /var/run/yum.pid: another copy is running as pid 28006.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  20 M RSS (759 MB VSZ)
    Started: Mon Feb 17 03:06:47 2020 - 00:13 ago
    State  : Traced/Stopped, pid: 28006

執行

rm -f /var/run/yum.pid  

轉載 https://my.oschina.net/u/2357619/blog/1925984

關注公衆號:TalkNewClass 免費閱讀pulsar 專欄文章,下載電子書籍以及進羣討論交流學習。
電子書籍都是作者從程序員到架構師閱讀過的書籍.

 

 

發佈了147 篇原創文章 · 獲贊 41 · 訪問量 72萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章