YUM应用终极攻略

本文以fedora10发行版为例,如果使用的是低于10版本的,可能需要修改一些内容。
先以我系统中的yum.conf文件,说明一下大概的参 数配置,很多文章都会说如何用YUM,但是很少见到说有如何配置yum.conf的。
引用内容 引用内容
[marco.chan@fedora ~]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum    #yum下载的RPM包的缓存目录
keepcache=0        #缓存是否保存,1保存,0不保存。
debuglevel=2        #调试级别(0-10),默认为2(具体调试级别的应用,我也不了解)。
logfile=/var/log/yum.log    #yum的日志文件所在的位置
exactarch=1        #在更新的时候,是否允许更新不同版本的RPM包,比如是否在i386上更新i686的RPM包。
obsoletes=1        #这是一个update的参数,具体请参阅yum(酷 ,简单的说就是相当于upgrade,允许更新陈旧的RPM包。
gpgcheck=1        #是否检查GPG(GNU Private Guard),一种密钥方式签名。
plugins=1        #是否允许使用插件,默认是0不允许,但是我们一般会用yum-fastestmirror这个插件。
installonly_limit=3    #允许保留多少个内核包。
exclude=selinux*    #屏蔽不想更新的RPM包,可用通配符,多个RPM包之间使用空格分离。
#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE or IN separate files named file.repo
# in /etc/yum.repos.d

repo文件中的内容可以包含在yum.conf文件中,但是默认会放在/etc /yum.repos.d/这个目录下,方便编辑,也为了方便区分不同源的文件。

然后看一下我系统中的.repo:
引用内容 引用内容
[marco.chan@fedora ~]$ ls /etc/yum.repos.d/ -l
-rw-r--r-- 1 root root  962 2009-03-14 16:57 fedora-asia-release.repo
-rw-r--r-- 1 root root  738 2009-03-14 16:57 fedora-asia-update.repo
-rw-r--r-- 1 root root  153 2009-03-14 19:46 fedora-dvdiso.repo
-rw-r--r-- 1 root root  317 2009-03-15 13:10 fedora-redhat-release.repo
-rw-r--r-- 1 root root  317 2009-03-15 13:11 fedora-redhat-update.repo
-rw-r--r-- 1 root root  316 2009-03-15 20:21 fedora-second-depository-release.repo
-rw-r--r-- 1 root root  263 2009-03-14 23:10 fedora-second-depository-updates.repo
-rw-r--r-- 1 root root 1126 2009-01-15 23:50 jpackage17.repo
-rw-r--r-- 1 root root 1035 2007-06-06 01:45 planetccrma.repo
#以上9个是我自己添加的.repo和相对陌生的第三 方源文件。以下是系统默认的以及rpmfusion的源。
-rw-r--r-- 1 root root 1963 2009-03-14 15:29 fedora-rawhide.repo
-rw-r--r-- 1 root root 1093 2009-03-14 23:43 fedora.repo
-rw-r--r-- 1 root root 1267 2009-03-15 14:55 fedora-updates.repo
-rw-r--r-- 1 root root 1181 2008-11-07 04:06 fedora-updates-testing.repo
-rw-r--r-- 1 root root 1022 2009-03-14 16:56 rpmfusion-free-rawhide.repo
-rw-r--r-- 1 root root 1079 2009-03-14 15:30 rpmfusion-free.repo
-rw-r--r-- 1 root root 1134 2009-03-14 15:30 rpmfusion-free-updates.repo
-rw-r--r-- 1 root root 1194 2008-11-03 21:15 rpmfusion-free-updates-testing.repo
-rw-r--r-- 1 root root 1067 2008-11-15 18:29 rpmfusion-nonfree-rawhide.repo
-rw-r--r-- 1 root root 1124 2009-03-14 15:30 rpmfusion-nonfree.repo
-rw-r--r-- 1 root root 1179 2009-03-14 15:30 rpmfusion-nonfree-updates.repo
-rw-r--r-- 1 root root 1239 2008-11-03 21:18 rpmfusion-nonfree-updates-testing.repo

yum加速,关于yum的加速无非就是选择一个快速的 源,或者是多线程下载(yum本身是单线程):
方法一、安装yum-fastestmirror这个插件.
说明:这个插件的效果并非和描 述的那样好“自动选择最快的源”。其实yum-fastestmirror使用简单的ping方式,以延时的大小来判断源主机是否是最快的源,实际上这方 法并不可靠。
安装:
程序代码 程序代码
sudo yum -y install yum-fastestmirror

如 果你仔细观察过yum的话,我们大陆用户基本会选择到台.湾的主机作为最快的源,而实际上根据我个人的经验,台湾的源一般都跟蜗牛似的。所以我选择了屏蔽 了.tw的源,屏蔽的方式为:
程序代码 程序代码

sudo vi /etc/yum/pluginconf.d/fastestmirror.conf
添加这一句:exclude=.tw, .twaren.net



方法二、安装yum-axelget。
说明:yum是单线程下载的,而axel是一个多 线程下载软件。yum-axelget在yum运行的时候,自动调用axel来多线程下载,从而达到加速的目的。
安装:使用rpm命令安装 axel,yum-axelget。
只允许会员下载 该文件只允许会员下载! 登录 | 注册



方法三、安装 yum-presto。关于presto请连接
用户只需要下载每一个软件的增量内容(用drpm打包而成),在本地计算机重新生成一个完整的软件 包再安装。通常增量更新只有很小的下载量,因而即使很大量的内容要更新,所耗费的时间必然比传统方法要少很多。不过presto系统还在测试之中,而且只 有一个服务器提供presto更新,速度也不怎么样。目前 presto只提供Fedora 9、Fedora 10和Fedora Rawhide三个版本的更新。
程序代码 程序代码
sudo yum -y install yum-presto

引用 内容 引用内容
Installation
In Fedora, run "yum install yum-presto". Then enable a presto repository listed below.
Presto Repositories
To use presto in Fedora, you need to have some presto repositories enabled.
Easy setup:
The easy way (if you're running F9 or F10 (i386, x86_64)) is to change the mirrorlist

For F9, in /etc/yum.repos.d/fedora-updates-newkey.repo change the mirrorlist to:
mirrorlist=http://presto-mirrors.anmar.eu.org/mirrorlist?repo=updates-released-f$releasever.newkey&arch=$basearch

For F10, in /etc/yum.repos.d/fedora-updates.repo change the mirrorlist to:
mirrorlist=http://presto-mirrors.anmar.eu.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
Hard setup:

If you prefer to set the baseurl directly, use the following:

Fedora Rawhide:
To use the presto repository in Fedora Rawhide, you need to change your baseurl in /etc/yum.repos.d/fedora-rawhide.repo to point to the one below.
i386: baseurl=http://lesloueizeh.com/devel/i386/development

Fedora 10:
To use the presto repository in Fedora 10, you need to change your baseurl in /etc/yum.repos.d/fedora-updates.repo to point to the one below.
i386: baseurl=http://lesloueizeh.com/f10/i386/updates
x86_64: baseurl=http://dl.anmar.eu.org/repos/f10/updates-x86_64
A big thank you to Angel Marin for creating and hosting the x86_64 deltarpms for F10!

Fedora 9:
To use the presto repository in Fedora 9, you need to change your baseurl in /etc/yum.repos.d/fedora-updates-newkey.repo to point to the one below.
i386: baseurl=http://lesloueizeh.com/f9/i386/updates.newkey
x86_64: baseurl=http://dl.anmar.eu.org/repos/f9/updates-x86_64.newkey
A big thank you to Angel Marin for creating and hosting the x86_64 deltarpms for F9!
Releases:
Fedora 9, 10 and Rawhide


方法三、挑选自己满意的 源。
以附件形式放上来!
只允许会员下载 该文件只允许会员下载! 登录 | 注册



方法四、安装专门的第 三方源。
对于一些国内的源,大都只适合教育网用户,因为我不是教育网用户,所以无法测试,我自己只用了上海交大自由软件(free software)资源镜像这一个。另外,大家期待163mirrors,除了fedoar ISO之外,并没有同步其他的RPM包。
1、 Planetccrma
http://ccrma.stanford.edu/planetccrma/software/
安 装:
http://ccrma.stanford.edu/planetccrma/software/installplanetnine.html
For Fedora 9:
rpm -Uvh http://ccrma.stanford.edu/planetccrma/mirror/fedora/linux/planetccrma/9/i386/planetccrma-repo-1.1-2.fc9.ccrma.noarch.rpm

For Fedora 10:
rpm -Uvh http://ccrma.stanford.edu/planetccrma/mirror/fedora/linux/planetccrma/10/i386/planetccrma-repo-1.1-2.fc10.ccrma.noarch.rpm

2、 jpackage
http://www.jpackage.org/
下 载.repo文件,保存到/etc/yum.repos.d/ 下。http://www.jpackage.org/jpackage17.repo

3、 RPM Fusion
http://rpmfusion.org/
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -ivh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

4、 ATrpms
http://atrpms.net/

5、 rpm.livna.org(已经合并)
http://rpm.livna.org/

6、 freshrpms(已经合并)
http://freshrpms.net

7、 rpmfind(法国东部的一个城市)
http://www.rpmfind.net/
安 装
http://ftp://rpmfind.net/pub/rpmfind/

8、 RPM.pbone.net
http://rpm.pbone.net/
一 个付费的yum repository。可以注册一个用户,免费试用14天,依照自己的需求配置不同的.repo文件。
比如:
引用内容 引用内容
This is experimental system. Use it on own risk.
Copy below section and put it into /etc/yum.repos.d/pbone.repo file.
[65i386]
name=PBONE Fedora 10 i386
baseurl=http://yum.pbone.net/65/i386/
gpgcheck=0
proxy=http://proxy.pbone.net:3127/
proxy_username=marco
proxy_password=123456789
[65noarch]
name=PBONE Fedora 10 noarch
baseurl=http://yum.pbone.net/65/noarch/
gpgcheck=0
proxy=http://proxy.pbone.net:3127/
proxy_username=marco
proxy_password=123456789

       此文献给在为yum默默泪崩的fedora fans,希望以上对fedora fans有所帮助

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值