配置CentOS的源

原文地址:  http://www.utnubu.cn/config-centos-yum-update.html

要更改源,需要编辑源配置文件CentOS-Base.repo:
vi /etc/yum.repos.d/CentOS-Base.repo

把所有"mirrorlist="一整行注释掉:
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

更改所有"bashurl="那一行为:
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/os/$basearch/
改好以后:wq保存

导入GPG KEY:
rpm --import http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5

更新升级列表:
yum update

这样就完成了.

附 CentOS Public Mirror List: (只列出Asia部分地区)

China - Beijing
http://centos.candishosting.com.cn/

China - Hong Kong
http://mirror.vpshosting.com.hk/pub/linux/centos/
http://centos.mirrors.firstnetcom.com/centos/
http://ftp.hostrino.com/pub/centos/
http://centos.yubis.org/

Taiwan
ftp://ftp.chu.edu.tw/Linux/CentOS/
http://ftp.stu.edu.tw/Linux/CentOS/
http://ftp.twaren.net/Linux/CentOS/
http://ftp.ncnu.edu.tw/Linux/CentOS/
http://ftp.cs.pu.edu.tw/Linux/CentOS/
http://ftp.tcc.edu.tw/Linux/CentOS/
http://ftp.cse.yzu.edu.tw/pub/CentOS/

下面大概解释一下CentOS-Base.repo这个文件:
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#

[base]
name=CentOS-$releasever - Base
#操作系统的"名称"和"版本", "Base"是指寻找的是Base包信息
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/os/$basearch/
#代表yum在互连网上所查找的链接地址
gpgcheck=1
#1表示打开gpg校验,下面语句就是注明GPG-RPM-KEY的位置
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
gpgkey=http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5
#指定GPG KEY的地址

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#Addons部分目前并未释出的包
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#这是附加包部分
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#Plus是扩展已存在软件包的功能
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://ftp.hostrino.com/pub/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
#是否使用Plus,1表示使用,0即反之
gpgkey=http://ftp.hostrino.com/pub/centos/RPM-GPG-KEY-CentOS-5


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卷边书_王诣

您的鼓励,是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值