CentOS修改各大yum源(centos5,centos6,centos7)

備份原配置文件

進入yum源配置目錄: cd /etc/yum.repos.dcentos

若是沒有先安裝wget: sudo yum install wget緩存

修改yum源,就是修改CentOS-Base.repo的內容,因此咱們要先備份一下原來的: sudo mv CentOS-Base.repo CentOS-Base.repo.backupbash

下載新配置文件

而後用wget下載國內的yum源(即CentOS-Base.repo文件),新的在哪呢?目前國內主要有三個yum源:ui

我的比較推薦中科大,不論是centos仍是Ubuntu

阿里雲

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
複製代碼

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
複製代碼

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
複製代碼

網易

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
複製代碼

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
複製代碼

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo
複製代碼

中科大

CentOS7

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3
複製代碼

CentOS6

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
複製代碼

CentOS5

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1
複製代碼

更新元數據

先清除原來的元數據緩存阿里雲

sudo yum clean all
複製代碼

更新新的元數據緩存

sudo yum makecache
複製代碼
相關文章
相關標籤/搜索