Centos更换为阿里源

1.备份
 
   
  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/
 
   
  1. #CentOS 5
  2. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
  3. #CentOS 6
  4. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  5. #CentOS 7
  6. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更改CentOS-Media.repo使其为不生效:
 
   
  1. vim /etc/yum.repos.d/CentOS-Media.repo

 
   
  1. # CentOS-Media.repo
  2. #
  3. # This repo can be used with mounted DVD media, verify the mount point for
  4. # CentOS-6. You can use this repo and yum to install items directly off the
  5. # DVD ISO that we release.
  6. #
  7. # To use this repo, put in your DVD and use it with the other repos too:
  8. # yum --enablerepo=c6-media [command]
  9. #
  10. # or for ONLY the media repo, do this:
  11. #
  12. # yum --disablerepo=\* --enablerepo=c6-media [command]
  13. [c6-media]
  14. name=CentOS-$releasever - Media
  15. baseurl=file:///media/CentOS/
  16. file:///media/cdrom/
  17. file:///media/cdrecorder/
  18. gpgcheck=1
  19. enabled=1
  20. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  21. ~

3.运行yum makecache生成缓存

 
   
  1. yum clean all
  2. yum makecache

猜你喜欢

转载自blog.csdn.net/zp_00000/article/details/55683456