您的位置:首页 > 运维架构 > Linux

在Centos 5.6上修改yum 源

2011-05-04 15:43 731 查看
yum源设置路径
/etc/yum.repos.d/
新建或复制一个文件  后缀名为repo再倒入key即可
以中国科技大学源为例
新建ustc.repo
内容为
#centos-ustc-edu-cn.repo
#
# 中国科技大学,速度不错
# rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#
# 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-5 - Base
repo=os
baseurl=http://centos.ustc.edu.cn/centos/5.6/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5.6/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5.6/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5.6/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5.6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5.6/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
导入key rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
源都添加完了之后,再装个插件,yum install yum-fastestmirror -y,这个会自动选择快的那个源。
如果我在那个目录里放了很多源,怎么知道当前用的是那个呢?如果你没有改yum.conf,那么看/var/cache/yum/文件夹里的一个time开头的文件,就知道了
如果在使用yum install安装找不到某些包的时候,可以使用下面办法试试
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
我原来使用系统默认的yum源,能够使用,但感觉不太快,好些软件找不到,所以在网上搜索新的yum源,找到网友发布的:
 
都是使用这个时,出现了一个小问题,
我是直接在windows 下复制上面的源内容放在记事里保存的,保存时没有注意编码保存成gb2312的了,复制到centos里系统不认,出现好多的乱码,
最后用centos的记事一打开,另存为UTF-8的才认出来
这个yum可以使用,
另外出现这个问题,也是转换系统里常出来的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  大学 中国 新建