1.保證你的網絡是正常的,能夠正常訪問外網(網絡yum源)vim
2.下載wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo網絡
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo(redhat 7.2)測試
3.設置修改 (6.8是最新的,可能後面還要跟新) sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo url
(redhat 7.2)sed -i 's/$releasever/7.2.1511/g' /etc/yum.repos.d/CentOS-Base.repospa
4.執行下面命令 yum clean all yum list(redhat 會提示沒有註冊,但不影響)get
5.設置本地yum源sed
5.1 掛載光盤,設置啓動自動掛載,刪除原有的yum文件,編輯rhel6.repo(後綴必須是repo應該是倉庫的意思)file
> [rhel6-source]下載
> name=rhel6-sourcegc
> baseurl=file:///mnt
> enabled=1
> gpgcheck=0
> EOF
執行下面命令 yum clean all yum list (搞定)
第二種辦法:我測試過好用
二、替換Centos-Base.repo
[root~]#cd/etc/yum.repos.d
[root~]#mv ./CentOS-Base.repo ./CentOS-Base.repo.bak
[root~]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root~]#mv CentOS6-Base-163.repo CentOS-Base.repo
[root~]#yum makecache