CentOS使用163镜像

在使用RedHat企业版的时候,用yum install软件的时候指向的是RedHat的官方地址,如果没有注册是不能使用的,所以当时就想换成CentOS的镜像,后来重新安装了CentOS系统,又觉得163的源比较快,所以就又将默认的源换成了163的镜像。按照163镜像官网上的提示进行操作即可:

http://mirrors.163.com/.help/centos.html)。

1、  首先备份/etc/yum.repos.d/CentOS-Base.repo: mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup

       2、下载对应版本的repo文件,放入/etc/yum.repo.d/中,我安装的是CentOS6的系统,所以下载的是6版本的文件。文件内容如下,可以将其拷贝并保存为CentOS-Base.repo。CentOS6-Base-163

#CentOS-Base.repo

#

# Themirror system uses the connecting IP address of the client and the

# updatestatus of each mirror to pick mirrors that are updated to and

#geographically close to the client.  Youshould use this for CentOS updates

# unlessyou are manually picking other mirrors.

#

# If themirrorlist= does not work for you, as a fall back you can try the

# remarkedout baseurl= line instead.

#

#

 

[base]

name=CentOS-$releasever- Base - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#releasedupdates

[updates]

name=CentOS-$releasever- Updates - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additionalpackages that may be useful

[extras]

name=CentOS-$releasever- Extras - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#additionalpackages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever- Plus - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

#contrib -packages by Centos Users

[contrib]

name=CentOS-$releasever- Contrib - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

       将上面的文件放入/etc/yum.repos.d/中之后,分别执行以下指令:

       yum clean all

       yum makecache

       完成之后再执行yumupdate,如果全部成功执行,则此时已经可以使用163的镜像了。

      

       PS:我在使用163镜像的过程中,因为CentOS6系统是安装在VM虚拟机中的,在更换163镜像时,网络设置的是hostonly模式,后来为了使用SSH远程登录,我将网络切换到了NAT模式,这个时候发现yum用不了了,这时将网络切回到hostonly即可重新使用yum,具体原因不是很清楚。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值