设为首页收藏本站

PHPWPS

 找回密码
 立即加入

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
公告:本站是个人博客站,非论坛,只不过为便于自己发文章,用的是discuz而已,请通管局及机房别乱封。
查看: 5960|回复: 1

更改CentOS镜像为国内镜像

[复制链接]

273

主题

324

帖子

1630

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1630
发表于 2015-9-27 16:47:22 | 显示全部楼层 |阅读模式
请参考http://mirrors.163.com/.help/centos.html
下面的内容为备份该操作步骤
比如centos在国内的网易镜像http://mirrors.163.com/centos/
首先备份/etc/yum.repos.d/CentOS-Base.repo
进入目录
  1. cd /etc/yum.repos.d/
复制代码

备份配置
  1. mv CentOS-Base.repo CentOS-Base.repo.backup
复制代码
下载配置
  1. wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
复制代码
更改配置名
  1. mv CentOS6-Base-163.repo   CentOS-Base.repo
复制代码
运行以下命令生成缓存
  1. yum clean all
  2. yum makecache
复制代码


回复

使用道具 举报

273

主题

324

帖子

1630

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1630
 楼主| 发表于 2015-9-27 16:48:28 | 显示全部楼层
附repo内容
  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client.  You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you, as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #

  12. [base]
  13. name=CentOS-$releasever - Base - 163.com
  14. baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
  15. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
  16. gpgcheck=1
  17. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

  18. #released updates
  19. [updates]
  20. name=CentOS-$releasever - Updates - 163.com
  21. baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
  22. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
  23. gpgcheck=1
  24. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

  25. #additional packages that may be useful
  26. [extras]
  27. name=CentOS-$releasever - Extras - 163.com
  28. baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
  29. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
  30. gpgcheck=1
  31. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

  32. #additional packages that extend functionality of existing packages
  33. [centosplus]
  34. name=CentOS-$releasever - Plus - 163.com
  35. baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
  36. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
  37. gpgcheck=1
  38. enabled=0
  39. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

  40. #contrib - packages by Centos Users
  41. [contrib]
  42. name=CentOS-$releasever - Contrib - 163.com
  43. baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
  44. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
  45. gpgcheck=1
  46. enabled=0
  47. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

本版积分规则

QQ|小黑屋|手机版|Archiver|phpwps Inc. ( 鄂ICP备14011625号-1 )  

GMT+8, 2021-1-28 06:43 , Processed in 0.128540 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表