CentOS配置:將預設yum源更改為163源或阿里雲源
阿新 • • 發佈:2019-02-05
原因
CentOS預設的yum源可能不是國內映象源,導致使用yum進行線上安裝及更新時,速度不是很理想。此時需要將yum源設定為國內映象源。國內的開源映象站點主要有網易和阿里雲。
配置過程
- 首先備份系統自帶的yum源配置檔案
/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下載163或阿里雲的yum源配置檔案到
/etc/yum.repos.d/
,並命名為CentOS-Base.repo
CentOS7
// 163源 wget -O /etc/yum.repos
CentOS6
// 163源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo // 阿里雲源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun
執行以下命令生成快取
yum clean all
yum makecache
- 執行命令
yum repolist
,檢視當前yum源的地址,確認是否更改成功