当前位置: > Linux发行版 > Fedora >

更新Fedora yum源

时间:2014-12-30 13:01来源:linux.it.net.cn 作者:IT
配置yum

使用yum安装相关软件包时一直提示以下错误:

repodata/repomd.xml:[Errno 4] IOError: <urlopen error (113>Error:Cannot retrieve repository metadata (repomd.xml) for repository:base. Please verify its path and try again

这是由于fedora系统找不到yum源所导致的,所以我们需要重新设置yum源。之前自己也看过比较多的人介绍yum源的设置,他们大多都是使用上海交大/163/sohu等的yum源,具体做法是将.repo文件存放到/etc/yum.repos.d目录,然后再运行“yum makecache”即可。但是这种方法我试过很多次,我的系统就是没有反应。原因有二:要么就是yum源有问题;要么就是除了更改/etc/yum.repos.d目录下的.repo文件,还需要修改其他配置文件,这是其他人没有注意到的。事实证明,第一种推测是正确的。用的是中国科学技术大学(ustc)的yum源,具体配置如下:

1.删除/etc/yum.repos.d目录下所有.repo文件

[root@jiangdongguo yum.repos.d]# rm *.repo

2./etc/yum.repos.d目录下创建一个fedora.repo文件和fedora_update.repo(可有可无)

[root@jiangdongguo yum.repos.d]# vim fedora.repo

内容:

[fedora]

name=Fedora $releasever - $basearch

failovermethod=priority

baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/$releasever/Everything/$basearch/os/

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch

enabled=1

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-debuginfo]

name=Fedora $releasever - $basearch -Debug

failovermethod=priority

baseurl=http:http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/$releasever/Everything/$basearch/debug/

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch

enabled=0

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[fedora-source]

name=Fedora $releasever - Source

failovermethod=priority

baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/$releasever/Everything/source/SRPMS/

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch

enabled=0

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

 

[root@jiangdongguo yum.repos.d]# vim fedora_update.repo

 

[updates]
name=Fedora $releasever -$basearch - Updates -ustc
failovermethod=priority
baseurl=http://mirrors.ustc.edu.cn/fedora/linux/updates/$releasever/$basearch/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[updates-debuginfo]
name=Fedora$releasever - $basearch - Updates - Debug-ustc
failovermethod=priority
baseurl=http://mirrors.ustc.edu.cn/fedora/linux/updates/$releasever/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[updates-source]
name=Fedora$releasever - Updates Source -ustc
failovermethod=priority
baseurl=http://mirrors.ustc.edu.cn/fedora/linux/updates/$releasever/SRPMS/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
3.清除原有信息,再生成缓存
[root@jiangdongguoyum.repos.d]#yum clean all
[root@jiangdongguo yum.repos.d]#yum makecache

 
(责任编辑:IT)
------分隔线----------------------------