tester-technology

Centos的yum源更换为国内源

2017-08-27  本文已影响23人  testerzhang

1.备份旧yum源文件或移走到独立目录
$ cd /etc/yum.repos.d/
$ mkdir old
$ mv *.repo old

2.下载新的CentOS-Base.repo 到/etc/yum.repos.d/
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

3.修改下载的文件里的内容,替换成操作系统版本
以下以centos6举例
$ vim /etc/yum.repos.d/CentOS-Base.repo
:%s#$releasever#6

保存后退出。

  1. 生成缓存,此步可以不操作
    运行yum makecache生成缓存
上一篇 下一篇

猜你喜欢

热点阅读