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

设置fedora的yum国内源

时间:2014-12-30 13:03来源:linux.it.net.cn 作者:IT

设置fedora的yum国内源

just try these:

http://mirrors.163.com/.help/fedora.html
http://mirrors.sohu.com/help/fedora.html


=================================================================
外国的yum源很慢,而且国内有很好的,因此这个源最好是设置国内的,国内的最好的有北邮的,清华的,上海交大的。
步骤如下:
首先是先安装yum-fastestmirror插件,选择自动选择最快的源 
#yum install yum-fastestmirror -y
其次:
在/etc/yum.repos.d下,新建文件sjtuedu.repo内容如下:
[sjtuedu]
name=Fedora $releasever - $basearch-Updates
baseurl=ftp://ftp.sjtu.edu.cn/freshrpms/ayo/fedora/linux/$releasever/i386/tupdates/
ftp://ftp.bupt.edu.cn/pub/mirror/fedora/linux/updates/$releasever/$basearch/
ftp://ftp.bupt.edu.cn/pub/mirror/fedora/linux/updates/$releasever/SRPMS/
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch&country=us
ftp://ftp3.tsinghua.edu.cn/mirror/livna/fedora/updates/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY file:///etc/pki/rpm-gpg/RPM-LIVNA-GPG-KEY

这个RPM-LIVNA-GPG-KEY文件放在/etc/pki/rpm-gpg/下,内容可自己到
ftp://ftp3.tsinghua.edu.cn/mirror/livna就可下载
而RPM-GPG-KEY文件放在/etc/pki/rpm-gpg/下,内容在ftp://ftp.sjtu.edu.cn/freshrpms就可找到,但是会覆盖原来的,不过没有关系。
而北邮电的好像不用KEY的。
至此一切OK。

再尝试在终端输入如下命令,
yum install fuse
就发现很快了。

有的时候提示说什么新建的文件有问题,要用http,ftp等的url,仔细检查一下自己的文件,一般是没有问题的

修改fedora自带的更新源:
然后修改这2个文件。
# gedit fedora.repo
弹出文本编辑器后,把所有内容删除。替换成下列内容。根据你自己的网速也可以精简解个最快的源。

内容如下:
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
baseurl=  
http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.usc.edu/pub/linux ... ora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.cat.pdx.edu/fedora/linux/releases/$releasever/Everything/$basearch/os/      
http://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
$releasever/Everything/$basearch/os/
http://mirror.aarnet.edu.au/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.internode.on.net/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://gulus.usherbrooke.ca/pub/distro/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.karneval.cz/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://sunsite.mff.cuni.cz/MIRRO ... com/linux/releases/$releasever/Everything/$basearch/os/
http://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://fedora.tu-chemnitz.de/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.fraunhofer.de/down ... ora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.uni-bayreuth.de/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.funet.fi/pub/mirrors/ ... ora/linux/releases/$releasever/Everything/$basearch/os/
$releasever/Everything/$basearch/os/
http://limestone.uoregon.edu/ftp/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://fedora.mirror.iweb.ca/releases/$releasever/Everything/$basearch/os/
$releasever/Everything/$basearch/os/
http://mirror.cc.vt.edu/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.tummy.com/pub/fed ... ora/linux/releases/$releasever/Everything/$basearch/os/
http://mirrors.kernel.org/fedora/releases/$releasever/Everything/$basearch/os/
http://www.gtlib.gatech.edu/pub/fedora.redhat/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.linux.ncsu.edu/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.iij.ad.jp/pub/linux/fedora/releases/$releasever/Everything/$basearch/os/
$releasever/Everything/$basearch/os/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://ftp.rhnet.is/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
http://mirror.pacific.net.au/linux/fedora/linux/releases/$releasever/Everything/$basearch/os/


#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

然后修改 fedora-updates.repo这个文件

# gedit fedora-updates.repo

弹出编辑器后,将内容替换为如下内容:

[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=
http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
http://mirrors.usc.edu/pub/linux ... dora/linux/updates/$releasever/$basearch/
http://mirrors.cat.pdx.edu/fedora/linux/updates/$releasever/$basearch/      
http://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
$releasever/$basearch/
http://mirror.aarnet.edu.au/pub/fedora/linux/updates/$releasever/$basearch/
http://mirror.internode.on.net/pub/fedora/linux/updates/$releasever/$basearch/
http://gulus.usherbrooke.ca/pub/distro/fedora/linux/updates/$releasever/$basearch/
http://mirror.karneval.cz/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://sunsite.mff.cuni.cz/MIRRO ... .com/linux/updates/$releasever/$basearch/
http://ftp-stud.hs-esslingen.de/pub/fedora/linux/updates/$releasever/$basearch/
http://fedora.tu-chemnitz.de/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://mirror.fraunhofer.de/down ... dora/linux/updates/$releasever/$basearch/
http://ftp.uni-bayreuth.de/linux/fedora/linux/updates/$releasever/$basearch/
http://ftp.funet.fi/pub/mirrors/ ... dora/linux/updates/$releasever/$basearch/
$releasever/$basearch/
http://limestone.uoregon.edu/ftp/fedora/linux/updates/$releasever/$basearch/
http://fedora.mirror.iweb.ca/updates/$releasever/$basearch/
$releasever/$basearch/
http://mirror.cc.vt.edu/pub/fedora/linux/updates/$releasever/$basearch/
http://mirrors.tummy.com/pub/fed ... dora/linux/updates/$releasever/$basearch/
http://mirrors.kernel.org/fedora/updates/$releasever/$basearch/
http://www.gtlib.gatech.edu/pub/fedora.redhat/linux/updates/$releasever/$basearch/
http://ftp.linux.ncsu.edu/pub/fedora/linux/updates/$releasever/$basearch/
http://ftp.iij.ad.jp/pub/linux/fedora/updates/$releasever/$basearch/
$releasever/$basearch/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/updates/$releasever/$basearch/
http://ftp.rhnet.is/pub/fedora/linux/updates/$releasever/$basearch/
http://mirror.pacific.net.au/linux/fedora/linux/updates/$releasever/$basearch/

#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

此时YUM就基本上OK了。最好添加一个LIVNA的源。更新速度一直不错。
可以手动创建livna.repo也可以直接下载RPM包进行安装。
在此我使用了RPM包。原因是方便。
登录地址:
rpm.livna.org
直接选择FC8就可以了。
这是文件会自动下载到你的用户文件甲的下载目录里。如果不需要了可以删除它。


一. 添加上交大源
   即使安装了 yum-fastmirror 插件,Fedora 10 的更新速度还是不理想吗?那么请添加国内上海交通大学 Fedora 软件仓库吧!尤其适合教育网用户。 用 gedit 新建一个文件,并命名为 “sjtu.repo” (不包括引号),文件内容如下:[Fedora-ftp.sjtu.edu.cn]
name=Fedora 10 - i386
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/10/Fedora/i386/os/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[Everything-ftp.sjtu.edu.cn]
name=Everything 10 - i386
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/10/Everything/i386/os/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
[updates-ftp.sjtu.edu.cn]
name=Fedora updates
baseurl=http://ftp.sjtu.edu.cn/fedora/linux/updates/10/i386/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
搞定后,cd 到你保存 sjtu.repo 的目录下,并将其 cp 到 /etc/yum.repos.d/ 目录下并重建 yum 缓存即可。 #cp sjtu.repo /etc/yum.repos.d

#yum makecache Enjoy! source update: rpm.livna.org 的软件包仓库:
rpm -ivh http://livna-dl.reloumirrors.net/livna-release.noarch.rpm

freshrpms.net 的软件包仓库:
rpm –ivh http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/10/freshrpms-release/freshrpms-release-1.2-1.noarch.rpm

Update: 刚才修正了上述 repo 文件中的大小写错误。OwnLinux 的 Felix 同学今天的文章提到了添加上海交通大学软件仓库、安装 yum-fastestmirror 及 axel 加速插件的方法,这将大幅提高 Fedora 10 下 Yum 的下载速度,请网络不好的朋友参考。
另附axel使用方法: 在开始之前,首先确保你安装了如下软件,补上尚未安装的。
执行以下命令:
yum -y install gcc make subversion 如上所述,执行yum makecache后 依次执行:
yum -y install yum-fastestmirror
svn co svn://svn.debian.org/svn/axel/
cd ./axel/trunk
./configure
make && make install
svn co http://cnfreesoft.googlecode.com/svn/trunk/axelget/ /etc/yum/axelget
cd /etc/yum/pluginconf.d/
ln -s /etc/yum/axelget/axelget.conf .
cd /usr/lib/yum-plugins/
ln -s /etc/yum/axelget/axelget.py . 
如果你使用sudo来运行yum,为了解决sudo下出现sh: axel: command not found
可以执行以下命令解决: 
cd /usr/bin
ln -s /usr/local/bin/axel

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