追尔教育 - View Article

yum使用方法

发布时间: 2017-11-25 阅读数: 17987

提要:我们用的是Redhat/Fedora通过在线安装更新软件包,除了系统自带的up2date以外,我们还有更为强大的在线升级工具 yum 和 apt-get 可用。主要资源有 freshrpms.net和 rpm.livna.org ;

在本文中,我们主要解介绍 Fedora core 4.0 通过软件包管理工具yum来在线安装更新软件;关于apt工具应用,我们会在另外一篇中介绍;


一、 yum 的使用;

有些初学Linux的弟兄可能问,为什么不用系统自带的图形化工具up2date来升级,却要用 yum呢。其实大家用一用就知道了,up2date 真是奇慢无比,而且经常失去响应;造成机器假死的情况。所以我们还是试一试yum ;另外freshrpms.net 可能比官方站更快的更新升级源,也没有理由不用 yum;

1、首先我们要到下面的地址下载与自己系统相对应的版本的 yum;


http://ayo.freshrpms.net/

比如我用的是Fedora core 4.0 就下载如下的包安装;


[root@localhost beinan]# rpm -ivh freshrpms-release-1.1-1.fc.noarch.rpm
warning: freshrpms-release-1.1-1.fc.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e42d547b
Preparing... ########################################### [100%]
1:freshrpms-release ########################################### [100%]


2、安装软件举例;

比如我要安装能听mp3的 bmp-mp3,只要输入下面的命令行即可,系统就自己工作了;

[root@localhost beinan]# yum install bmp-mp3

内容全景如下:


[root@localhost beinan]# yum install bmp-mp3
Setting up Install Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 42 kB 00:03
freshrpms : ################################################## 122/122
Added 122 new packages, deleted 0 old in 0.72 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bmp-mp3 to pack into transaction set.
bmp-mp3-0.9.7-1.2.fc4.i38 100% |=========================| 2.9 kB 00:00
---> Package bmp-mp3.i386 0:0.9.7-1.2.fc4 set to be updated
--> Running transaction check
--> Processing Dependency: libid3-3.8.so.3 for package: bmp-mp3
--> Processing Dependency: libbeep.so.2 for package: bmp-mp3
--> Processing Dependency: bmp >= 0.9.7 for package: bmp-mp3
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for id3lib to pack into transaction set.
id3lib-3.8.3-11.fc4.i386. 100% |=========================| 38 kB 00:05
---> Package id3lib.i386 0:3.8.3-11.fc4 set to be updated
---> Downloading header for bmp to pack into transaction set.
bmp-0.9.7-10.fc4.i386.rpm 100% |=========================| 14 kB 00:03
---> Package bmp.i386 0:0.9.7-10.fc4 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Installing:
 bmp-mp3 i386 0.9.7-1.2.fc4 freshrpms 95 k
Installing for dependencies:
 bmp i386 0.9.7-10.fc4 extras 912 k
 id3lib i386 3.8.3-11.fc4 extras 752 k
Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): id3lib-3.8.3-11.fc 100% |=========================| 752 kB 01:04
(2/3): bmp-0.9.7-10.fc4.i 100% |=========================| 912 kB 02:14
(3/3): bmp-mp3-0.9.7-1.2. 100% |=========================| 95 kB 00:05
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: bmp ######################### [1/3]
  Installing: id3lib ######################### [2/3]
  Installing: bmp-mp3 ######################### [3/3]
Installed: bmp-mp3.i386 0:0.9.7-1.2.fc4
Dependency Installed: bmp.i386 0:0.9.7-10.fc4 id3lib.i386 0:3.8.3-11.fc4
Complete!


注:yum优点:软件包依赖关系自行解决,比如上面的,我们可以看到本来我们只安装的是bmp-mp3,结果yum 安装也安装了 id3lib ;bmp


二、yum的一点小用法;


1、查询软件包;

面对成千上万的软件,我们可能无从下手,有时也不知道它的文件名;这时就要用到查询;我们可以用 yum list 来列出yum升级源上的包有文件;然后我们再来查看 info
有以下几个组合可以用;比如;


[root@localhost beinan]# yum list |more

加上一个管道 |,然后 more 一下,就能把所有的包分页显示出来。然后按一下空格键就能看下一页了。在显示的软件列表中,会有软件名称、版本、是否安装等;仔细的看一下吧。熟悉了就好了。也没有什么难的。


[root@localhost beinan]# yum list |more
Setting up repositories
Reading repository metadata in from local files
Installed Packages
4Suite.i386 1.0-8.b1 installed
Canna.i386 3.7p3-13 installed
Canna-devel.i386 3.7p3-13 installed

如果想知道软件的详细信息,可能得用上info参数了。比如:

用法:


[root@localhost beinan]# yum info 软件名

比如:


[root@localhost beinan]# yum info bmp-mp3
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Installed Packages
Name : bmp-mp3
Arch : i386
Version: 0.9.7
Release: 1.2.fc4
Size : 234 k
Repo : freshrpms
Summary: MP3 playback plugin for the Beep Media Player
Description:
 This package contains an MP3 playback plugin for BMP (Beep Media Player),
a media player that uses a skinned user interface based on Winamp 2.x skins,
and is based on ("forked off" XMMS.

在上面的例子中,如果Repo : freshrpms是这样的,表示您的系统没有安装这个软件,如果显示的是:Repo : installed,表示已经安装了。

查询软件包,也可以再加参数 grep ,比如我们想查询升级源上是否有内核的新版本,则我们可以用下面的命令查询;当然您也可以用 [root@localhost beinan]# yum search kernel |more ,也就是yum --help提供的参数,也是一样的;


[root@localhost beinan]# yum list |grep kernel

我们看一下机器工作的结果,如下:


[root@localhost beinan]# yum list |grep kernel
GFS-kernel.i686 2.6.11.8-20050601.1526 installed
cman-kernel.i686 2.6.11.5-20050601.1526 installed
dlm-kernel.i686 2.6.11.5-20050601.1526 installed
gnbd-kernel.i686 2.6.11.2-20050420.1331 installed
kernel.i686 2.6.11-1.1369_FC4 installed
kernel-devel.i686 2.6.11-1.1369_FC4 installed
kernel-doc.noarch 2.6.11-1.1369_FC4 installed
GFS-kernel.i586 2.6.11.8-20050601.1526 base
GFS-kernel-debuginfo.i686 2.6.11.8-20050601.1526 updates-released
GFS-kernel-debuginfo.i586 2.6.11.8-20050601.1526 updates-released
GFS-kernel-smp.i686 2.6.11.8-20050601.1526 base
GFS-kernel-xen0.i686 2.6.11.8-20050601.1526 base
GFS-kernel-xenU.i686 2.6.11.8-20050601.1526 base
cman-kernel.i586 2.6.11.5-20050601.1526 updates-released
cman-kernel.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-debuginfo.i586 2.6.11.5-20050601.1526 updates-released
cman-kernel-debuginfo.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-smp.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-xen0.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-xenU.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel.i586 2.6.11.5-20050601.1526 updates-released
dlm-kernel-debuginfo.i586 2.6.11.5-20050601.1526 updates-released
dlm-kernel-debuginfo.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-smp.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-xen0.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-xenU.i686 2.6.11.5-20050601.1526 updates-released
gnbd-kernel.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel.i586 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-debuginfo.i586 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-debuginfo.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-smp.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-xen0.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-xenU.i686 2.6.11.2-20050420.1331 updates-released
kernel.i586 2.6.12-1.1398_FC4 updates-released
kernel.i686 2.6.12-1.1398_FC4 updates-released
kernel-debuginfo.i686 2.6.12-1.1398_FC4 updates-released
kernel-debuginfo.i586 2.6.12-1.1398_FC4 updates-released
kernel-devel.i586 2.6.12-1.1398_FC4 updates-released
kernel-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-doc.noarch 2.6.12-1.1398_FC4 updates-released
kernel-smp.i686 2.6.12-1.1398_FC4 updates-released
kernel-smp-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-xen0.i686 2.6.12-1.1398_FC4 updates-released
kernel-xen0-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-xenU.i686 2.6.12-1.1398_FC4 updates-released
kernel-xenU-devel.i686 2.6.12-1.1398_FC4 updates-released

上面的确显示出一大堆与内核有关的, installed表示我们的系统已经安装了;

咱们看前一列吧,看一下名字就能猜个差不多;比如 doc 肯定和内核文档有关了;smp是多处理器的内核;其它的我不懂了,请想知道的弟兄用 info来看吧。

比如我们用的机器是单处理器的X86机,想看一下是否有新内核可用。所以咱们试一下下面的这个。看是否已经有了新内核可以升级的;


[root@localhost beinan]# yum info kernel.i686
[root@localhost beinan]# yum info kernel.i686
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Installed Packages
Name : kernel
Arch : i686
Version: 2.6.11
Release: 1.1369_FC4
Size : 37 M
Repo : installed
Summary: Linux 内核(Linux 操作系统的核心)。
Description:
 kernel 软件包包含 Linux 内核 (vmlinuz),Red Hat Linux
操作系统的核心。内核处理操作系统的基本功能:
分配内存、处理分配、设备的输入和输出等等。
Available Packages
Name : kernel
Arch : i686
Version: 2.6.12
Release: 1.1398_FC4
Size : 14 M
Repo : updates-released
Summary: The Linux kernel (the core of the Linux operating system)
Description:
 The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.

通过上面的信息,我们可以看到 2.6.11的是已经安装了,因为已经显示的是Repo : installed ,下面还有一个Version: 2.6.12 ,告诉我们是Repo : updates-released,看来这个是升级用的了。

所以是否升级就看我们的了。


[root@localhost beinan]# yum update kernel

升级内核全景如下:


[root@localhost beinan]# yum update kernel
Setting up Upgrade Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for kernel to pack into transaction set.
kernel-2.6.12-1.1398_FC4. 100% |=========================| 174 kB 00:18
---> Package kernel.i686 0:2.6.12-1.1398_FC4 set to be installed
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Installing:
 kernel i686 2.6.12-1.1398_FC4 updates-released 14 M
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 14 M
Is this ok [y/N]:

是不是升级,只需要在 Is this ok [y/N]:行的后面输入y或者N;y是yes,就是点头同意的意思;N就是摇头No的意思。

对于软件包的查询,还有,比如:


[root@localhost beinan]# yum list available 列出所有升级源上的包;
[root@localhost beinan]# yum list updates 列出所有升级源上的可以更新包;
[root@localhost beinan]# yum list installed 列出已经安装的包;

yum 的命令支持通配符; 比如;


[root@localhost beinan]# yum list mp* |more
Setting up repositories
Reading repository metadata in from local files
Installed Packages
mpage.i386 2.5.4-5 installed
Available Packages
mpc.i386 0.11.2-3 extras
mpeg2dec.i386 0.4.0-5b.2.fc4 freshrpms
mpeg2dec-devel.i386 0.4.0-5b.2.fc4 freshrpms
mpg321.i386 0.2.10-6.2.fc4 freshrpms
mplayer.i386 1.0-0.16.pre7.2.fc4 freshrpms
mplayer-docs.i386 1.0-0.16.pre7.2.fc4 freshrpms
mplayer-fonts.noarch 1.1-3.fc freshrpms
mplayer-skins.noarch 1.7-1.fc freshrpms
[root@localhost beinan]#


2.安装和升级软件包;

安装和升级分别是 install 和 update 参数;比如;

[root@localhost beinan]# yum update firefox

这样我们就可以升级 firefox了。


[root@localhost beinan]# yum update firefox
Setting up Update Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:03
freshrpms 100% |=========================| 951 B 00:02
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package firefox.i386 0:1.0.6-1.1.fc4 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Updating:
 firefox i386 1.0.6-1.1.fc4 updates-released 18 M
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 18 M
Is this ok [y/N]:

如果不加参数的 update 会是什么呢??


[root@localhost beinan]# yum update

试着运行一下看看?会好长时间,对系统进行全面更新,我们要进行y和N了。

3.移除软件包要用到remove参数;比如;


[root@localhost beinan]# yum remove bmp-mp3

内容全景如下:


[root@localhost beinan]# yum remove bmp-mp3
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package bmp-mp3.i386 0:0.9.7-1.2.fc4 set to be erased
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Removing:
 bmp-mp3 i386 0.9.7-1.2.fc4 installed 234 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 1 Package(s)
Total download size: 0
Is this ok [y/N]:
按y就移除了;


三、yum的图形工具;

请参见:《软件在线升级更新yum 图形工具介绍》

四、yum的帮助;

在论坛中有好多,有兴趣的弟兄自己找找看吧;但也不要忘记了自救;呵。。。。


[root@localhost beinan]# yum --help
    Usage: yum [options] < update | install | info | remove | list |
            clean | provides | search | check-update | groupinstall |
            groupupdate | grouplist | groupinfo | groupremove |
            makecache | localinstall | shell >
        Options:
        -c [config file] - specify the config file to use
        -e [error level] - set the error logging level
        -d [debug level] - set the debugging level
        -y - answer yes to all questions
        -R [time in minutes] - set the max amount of time to randomly run in
        -C run from cache only - do not update the cache
        --installroot=[path] - set the install root (default '/')
        --version - output the version of yum
        --exclude=package to exclude
        --disablerepo=repository id to disable (overrides config file)
        --enablerepo=repository id to enable (overrides config file)
        -h, --help - this screen

还有更厉害的帮助;


[root@localhost beinan]#man yum





fedora cn简介
fedora-cn是一个致力于为中文fedora用户提供便利和帮助的项目。目前处于重新起步阶段,建设中的项目有:
1、ybuild,用于构建和发布fedora cn的yum仓库
2、fedora cn yum软件仓库,作为fedora core, fedora extras,fedora updates之外的扩充软件库,多为国产优秀软件和因版权问题不能进入官方源的软件。其下的软件在经过大家测试和使用后将向extras中提交,为fedora的建设出力。
3、fedora cn的主页。

目前的项目主页:https://gro.clinux.org/projects/fedora/
开发人员:https://gro.clinux.org/project/membe...p?group_id=730

其中要特别感谢蓝迪游戏公司,http://www.bluedj.com/ ,是它们赞助了项目的ftp空间,也特别
希望广大FC用户能多多支持蓝迪开源游戏平台(fedora.cn yum仓库中有bluedj游戏的打包)

fedora yum仓库配置和使用
目前仓库支持FC-5和FC-6版本。
只需下载各版本相应的fedora-cn-release包安装即可使用yum。比如FC-5下载
ftp://ftp.fedora.cn/pub/fedora-cn/linux/5/i386/RPMS/
下的fedora-cn-release的最新RPM
执行(假设最新的是fedora-cn-release-1.1-1.fc5.y1.noarch.rpm)

代码:
#rpm -ivh fedora-cn-release-1.1-1.fc5.y1.noarch.rpm安装成功后,即可用yum安装fedora cn的软件了。
(注:
FC-6: ftp://ftp.fedora.cn/pub/fedora-cn/li....y0.noarch.rpm


比如,安装蓝迪游戏大厅:

代码:
#yum install bluedj然后就可以在游戏菜单中找到蓝迪游戏大厅了。

fedora.cn联系方式
邮件列表:
groups.google.com/group/fedora-cn
groups.google.com/group/fedora-cn-devel

IRC频道:
irc://irc.freenode.org/#fedora-cn
(IRC使用方法见 http://www.linuxsir.org/bbs/showthread.php?t=266632 )



Fedora/Redhat 在线安装更新软件包,yum 篇 ── 给新手指南
作者:北南南北
来自:LinuxSir.Org
提要:我们用的是Redhat/Fedora通过在线安装更新软件包,除了系统自带的up2date以外,我们还有更为强大的在线升级工具 yum 和 apt-get 可用。主要资源有 freshrpms.net和 rpm.livna.org ;

在本文中,我们主要解介绍 Fedora core 4.0 通过软件包管理工具yum来在线安装更新软件;关于apt工具应用,我们会在另外一篇中介绍;


一、 yum 的使用;

有些初学Linux的弟兄可能问,为什么不用系统自带的图形化工具up2date来升级,却要用 yum呢。其实大家用一用就知道了,up2date 真是奇慢无比,而且经常失去响应;造成机器假死的情况。所以我们还是试一试yum ;另外freshrpms.net 可能比官方站更快的更新升级源,也没有理由不用 yum;

1、首先我们要到下面的地址下载与自己系统相对应的版本的 yum;


http://ayo.freshrpms.net/

比如我用的是Fedora core 4.0 就下载如下的包安装;


[root@localhost beinan]# rpm -ivh freshrpms-release-1.1-1.fc.noarch.rpm
warning: freshrpms-release-1.1-1.fc.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e42d547b
Preparing... ########################################### [100%]
1:freshrpms-release ########################################### [100%]


2、安装软件举例;

比如我要安装能听mp3的 bmp-mp3,只要输入下面的命令行即可,系统就自己工作了;

[root@localhost beinan]# yum install bmp-mp3

内容全景如下:


[root@localhost beinan]# yum install bmp-mp3
Setting up Install Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 42 kB 00:03
freshrpms : ################################################## 122/122
Added 122 new packages, deleted 0 old in 0.72 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for bmp-mp3 to pack into transaction set.
bmp-mp3-0.9.7-1.2.fc4.i38 100% |=========================| 2.9 kB 00:00
---> Package bmp-mp3.i386 0:0.9.7-1.2.fc4 set to be updated
--> Running transaction check
--> Processing Dependency: libid3-3.8.so.3 for package: bmp-mp3
--> Processing Dependency: libbeep.so.2 for package: bmp-mp3
--> Processing Dependency: bmp >= 0.9.7 for package: bmp-mp3
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for id3lib to pack into transaction set.
id3lib-3.8.3-11.fc4.i386. 100% |=========================| 38 kB 00:05
---> Package id3lib.i386 0:3.8.3-11.fc4 set to be updated
---> Downloading header for bmp to pack into transaction set.
bmp-0.9.7-10.fc4.i386.rpm 100% |=========================| 14 kB 00:03
---> Package bmp.i386 0:0.9.7-10.fc4 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Installing:
 bmp-mp3 i386 0.9.7-1.2.fc4 freshrpms 95 k
Installing for dependencies:
 bmp i386 0.9.7-10.fc4 extras 912 k
 id3lib i386 3.8.3-11.fc4 extras 752 k
Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): id3lib-3.8.3-11.fc 100% |=========================| 752 kB 01:04
(2/3): bmp-0.9.7-10.fc4.i 100% |=========================| 912 kB 02:14
(3/3): bmp-mp3-0.9.7-1.2. 100% |=========================| 95 kB 00:05
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: bmp ######################### [1/3]
  Installing: id3lib ######################### [2/3]
  Installing: bmp-mp3 ######################### [3/3]
Installed: bmp-mp3.i386 0:0.9.7-1.2.fc4
Dependency Installed: bmp.i386 0:0.9.7-10.fc4 id3lib.i386 0:3.8.3-11.fc4
Complete!


注:yum优点:软件包依赖关系自行解决,比如上面的,我们可以看到本来我们只安装的是bmp-mp3,结果yum 安装也安装了 id3lib ;bmp


二、yum的一点小用法;


1、查询软件包;

面对成千上万的软件,我们可能无从下手,有时也不知道它的文件名;这时就要用到查询;我们可以用 yum list 来列出yum升级源上的包有文件;然后我们再来查看 info
有以下几个组合可以用;比如;


[root@localhost beinan]# yum list |more

加上一个管道 |,然后 more 一下,就能把所有的包分页显示出来。然后按一下空格键就能看下一页了。在显示的软件列表中,会有软件名称、版本、是否安装等;仔细的看一下吧。熟悉了就好了。也没有什么难的。


[root@localhost beinan]# yum list |more
Setting up repositories
Reading repository metadata in from local files
Installed Packages
4Suite.i386 1.0-8.b1 installed
Canna.i386 3.7p3-13 installed
Canna-devel.i386 3.7p3-13 installed

如果想知道软件的详细信息,可能得用上info参数了。比如:

用法:


[root@localhost beinan]# yum info 软件名

比如:


[root@localhost beinan]# yum info bmp-mp3
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Installed Packages
Name : bmp-mp3
Arch : i386
Version: 0.9.7
Release: 1.2.fc4
Size : 234 k
Repo : freshrpms
Summary: MP3 playback plugin for the Beep Media Player
Description:
 This package contains an MP3 playback plugin for BMP (Beep Media Player),
a media player that uses a skinned user interface based on Winamp 2.x skins,
and is based on ("forked off") XMMS.

在上面的例子中,如果Repo : freshrpms是这样的,表示您的系统没有安装这个软件,如果显示的是:Repo : installed,表示已经安装了。

查询软件包,也可以再加参数 grep ,比如我们想查询升级源上是否有内核的新版本,则我们可以用下面的命令查询;当然您也可以用 [root@localhost beinan]# yum search kernel |more ,也就是yum --help提供的参数,也是一样的;


[root@localhost beinan]# yum list |grep kernel

我们看一下机器工作的结果,如下:


[root@localhost beinan]# yum list |grep kernel
GFS-kernel.i686 2.6.11.8-20050601.1526 installed
cman-kernel.i686 2.6.11.5-20050601.1526 installed
dlm-kernel.i686 2.6.11.5-20050601.1526 installed
gnbd-kernel.i686 2.6.11.2-20050420.1331 installed
kernel.i686 2.6.11-1.1369_FC4 installed
kernel-devel.i686 2.6.11-1.1369_FC4 installed
kernel-doc.noarch 2.6.11-1.1369_FC4 installed
GFS-kernel.i586 2.6.11.8-20050601.1526 base
GFS-kernel-debuginfo.i686 2.6.11.8-20050601.1526 updates-released
GFS-kernel-debuginfo.i586 2.6.11.8-20050601.1526 updates-released
GFS-kernel-smp.i686 2.6.11.8-20050601.1526 base
GFS-kernel-xen0.i686 2.6.11.8-20050601.1526 base
GFS-kernel-xenU.i686 2.6.11.8-20050601.1526 base
cman-kernel.i586 2.6.11.5-20050601.1526 updates-released
cman-kernel.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-debuginfo.i586 2.6.11.5-20050601.1526 updates-released
cman-kernel-debuginfo.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-smp.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-xen0.i686 2.6.11.5-20050601.1526 updates-released
cman-kernel-xenU.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel.i586 2.6.11.5-20050601.1526 updates-released
dlm-kernel-debuginfo.i586 2.6.11.5-20050601.1526 updates-released
dlm-kernel-debuginfo.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-smp.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-xen0.i686 2.6.11.5-20050601.1526 updates-released
dlm-kernel-xenU.i686 2.6.11.5-20050601.1526 updates-released
gnbd-kernel.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel.i586 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-debuginfo.i586 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-debuginfo.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-smp.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-xen0.i686 2.6.11.2-20050420.1331 updates-released
gnbd-kernel-xenU.i686 2.6.11.2-20050420.1331 updates-released
kernel.i586 2.6.12-1.1398_FC4 updates-released
kernel.i686 2.6.12-1.1398_FC4 updates-released
kernel-debuginfo.i686 2.6.12-1.1398_FC4 updates-released
kernel-debuginfo.i586 2.6.12-1.1398_FC4 updates-released
kernel-devel.i586 2.6.12-1.1398_FC4 updates-released
kernel-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-doc.noarch 2.6.12-1.1398_FC4 updates-released
kernel-smp.i686 2.6.12-1.1398_FC4 updates-released
kernel-smp-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-xen0.i686 2.6.12-1.1398_FC4 updates-released
kernel-xen0-devel.i686 2.6.12-1.1398_FC4 updates-released
kernel-xenU.i686 2.6.12-1.1398_FC4 updates-released
kernel-xenU-devel.i686 2.6.12-1.1398_FC4 updates-released

上面的确显示出一大堆与内核有关的, installed表示我们的系统已经安装了;

咱们看前一列吧,看一下名字就能猜个差不多;比如 doc 肯定和内核文档有关了;smp是多处理器的内核;其它的我不懂了,请想知道的弟兄用 info来看吧。

比如我们用的机器是单处理器的X86机,想看一下是否有新内核可用。所以咱们试一下下面的这个。看是否已经有了新内核可以升级的;


[root@localhost beinan]# yum info kernel.i686
[root@localhost beinan]# yum info kernel.i686
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Installed Packages
Name : kernel
Arch : i686
Version: 2.6.11
Release: 1.1369_FC4
Size : 37 M
Repo : installed
Summary: Linux 内核(Linux 操作系统的核心)。
Description:
 kernel 软件包包含 Linux 内核 (vmlinuz),Red Hat Linux
操作系统的核心。内核处理操作系统的基本功能:
分配内存、处理分配、设备的输入和输出等等。
Available Packages
Name : kernel
Arch : i686
Version: 2.6.12
Release: 1.1398_FC4
Size : 14 M
Repo : updates-released
Summary: The Linux kernel (the core of the Linux operating system)
Description:
 The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc.

通过上面的信息,我们可以看到 2.6.11的是已经安装了,因为已经显示的是Repo : installed ,下面还有一个Version: 2.6.12 ,告诉我们是Repo : updates-released,看来这个是升级用的了。

所以是否升级就看我们的了。


[root@localhost beinan]# yum update kernel

升级内核全景如下:


[root@localhost beinan]# yum update kernel
Setting up Upgrade Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
freshrpms 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for kernel to pack into transaction set.
kernel-2.6.12-1.1398_FC4. 100% |=========================| 174 kB 00:18
---> Package kernel.i686 0:2.6.12-1.1398_FC4 set to be installed
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Installing:
 kernel i686 2.6.12-1.1398_FC4 updates-released 14 M
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 14 M
Is this ok [y/N]:

是不是升级,只需要在 Is this ok [y/N]:行的后面输入y或者N;y是yes,就是点头同意的意思;N就是摇头No的意思。

对于软件包的查询,还有,比如:


[root@localhost beinan]# yum list available 列出所有升级源上的包;
[root@localhost beinan]# yum list updates 列出所有升级源上的可以更新包;
[root@localhost beinan]# yum list installed 列出已经安装的包;

yum 的命令支持通配符; 比如;


[root@localhost beinan]# yum list mp* |more
Setting up repositories
Reading repository metadata in from local files
Installed Packages
mpage.i386 2.5.4-5 installed
Available Packages
mpc.i386 0.11.2-3 extras
mpeg2dec.i386 0.4.0-5b.2.fc4 freshrpms
mpeg2dec-devel.i386 0.4.0-5b.2.fc4 freshrpms
mpg321.i386 0.2.10-6.2.fc4 freshrpms
mplayer.i386 1.0-0.16.pre7.2.fc4 freshrpms
mplayer-docs.i386 1.0-0.16.pre7.2.fc4 freshrpms
mplayer-fonts.noarch 1.1-3.fc freshrpms
mplayer-skins.noarch 1.7-1.fc freshrpms
[root@localhost beinan]#


2.安装和升级软件包;

安装和升级分别是 install 和 update 参数;比如;

[root@localhost beinan]# yum update firefox

这样我们就可以升级 firefox了。


[root@localhost beinan]# yum update firefox
Setting up Update Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:03
freshrpms 100% |=========================| 951 B 00:02
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package firefox.i386 0:1.0.6-1.1.fc4 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Updating:
 firefox i386 1.0.6-1.1.fc4 updates-released 18 M
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 18 M
Is this ok [y/N]:

如果不加参数的 update 会是什么呢??


[root@localhost beinan]# yum update

试着运行一下看看?会好长时间,对系统进行全面更新,我们要进行y和N了。

3.移除软件包要用到remove参数;比如;


[root@localhost beinan]# yum remove bmp-mp3

内容全景如下:


[root@localhost beinan]# yum remove bmp-mp3
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package bmp-mp3.i386 0:0.9.7-1.2.fc4 set to be erased
--> Running transaction check
Dependencies Resolved
=============================================================================
 Package Arch Version Repository Size
=============================================================================
Removing:
 bmp-mp3 i386 0.9.7-1.2.fc4 installed 234 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 1 Package(s)
Total download size: 0
Is this ok [y/N]:
按y就移除了;


三、yum的图形工具;

请参见:《软件在线升级更新yum 图形工具介绍》

四、yum的帮助;

在论坛中有好多,有兴趣的弟兄自己找找看吧;但也不要忘记了自救;呵。。。。


[root@localhost beinan]# yum --help
    Usage: yum [options] < update | install | info | remove | list |
            clean | provides | search | check-update | groupinstall |
            groupupdate | grouplist | groupinfo | groupremove |
            makecache | localinstall | shell >
        Options:
        -c [config file] - specify the config file to use
        -e [error level] - set the error logging level
        -d [debug level] - set the debugging level
        -y - answer yes to all questions
        -R [time in minutes] - set the max amount of time to randomly run in
        -C run from cache only - do not update the cache
        --installroot=[path] - set the install root (default '/')
        --version - output the version of yum
        --exclude=package to exclude
        --disablerepo=repository id to disable (overrides config file)
        --enablerepo=repository id to enable (overrides config file)
        -h, --help - this screen

还有更厉害的帮助;


[root@localhost beinan]#man yum


软件在线升级更新yum 图形工具介绍;
作者:北南南北
来自:LinuxSir.Org
提要:yum 是Fedora/Redhat 软件包管理工具,包括文本命令行模式和图形模式;图形模式的yum也是基于文本模式的;目前yum图形前端程序主要有 yumex和kyum ;


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
正文
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


一、yum 在线安装、移除、更新及管理rpm软件包工具;

我们除了系统提供的软件包管理工具 system-config-packages ,但这个软件包管理工具,只能用于系统安装盘提供的软件的管理;

Fedora也提供了 up2date升级工具,但这个工具明显无任何优势;升级速度慢,效率低下,大多人是忍受不了 up2date折磨的;

yum 工具是Fedora 推荐使用的在线升级更新软件包的工具,在安装系统时,一般都是默认安装;yum 是一个命令行式的工具,如果您不习惯命令行式的yum,您可以用yumex和kyum;


yumex和kyum并不是独立于yum的,而是yum的图形前端,也就是说,我们在安装和使用yumex和kyum同时,都是以yum的安装和配置为基础;您在用yumex或kyum 时,必须先安装配置yum ;


做为初学者,如何使用yum及yum的资源,拜请您读以下几篇文档;

1、《Fedora/Redhat 在线安装更新软件包,yum 篇》
2、《Fedora Extras(Fedora 计划的扩充资源) rpm.livna.org软件仓库的介绍和应用》
3、《Freshrpms.net 资源介绍,及apt 和yum 的应用》

二、安装yumex;

注:您在用yumex或kyum 时,必须先安装配置yum ;请看前面提到的文章;

如果您用 kde桌面,您可以用kyum,yunex和kyum二者任选其一,找一个自己习惯的就行;

1、yumex 的安装和使用;

首先确认系统是不是有yumex


[root@localhost beinan]# rpm -q yumex
yumex-0.42-3.0.fc4

如果没有类似的输出,请用下面的命令安装,前提是您已经完成了前面说的yum的配置;


[root@localhost beinan]# yum install yumex

2、yumex的调用:


[beinan@localhost ~]# yumex

3、yumex的操作;会点鼠标就会用 yumex

   


三、安装kyum ;


注:yumex 和kyum您只需选择一个适合您的就行,没有必要两个都安装,不过尝试一下再做选择也好;

1、安装kyum ;


[root@localhost beinan]# yum install kyum

2、调用kyum ;


[root@localhost beinan]# kyum

3、用法图示;




四、关于yum补充:

如果您想要深入了解yum ,您必须到查看yum主页上的文档;

yum主页地址:

http://www.linux.duke.edu/projects/yum

后记:至此yum基础文档就差不多完成了,我写了一系列的教程;软件包管理基础的东西差不多就这些;如果您在教程发现您所要的东西没有,就看man;

附录一:

安装软件时,最好用各自发行版所提供的系统软件包管理工具,对于Fedora/Redhat 您可以参考如下文章;

0)RPM 基础 《RPM 的介绍和应用》

1)Fedora 系统管理软件包工具 system-config-packages,方便的添加和移除系统安装盘提供的软件包,详情请看 《Fedora 软件包管理器system-config-packages》

2)Redhat 系统管理软件包工具,新一点的系统应该是 redhat-config-packages ,用法和 《Fedora 软件包管理器system-config-packages》 一样;

3)apt + synaptic 软件包在线安装、移除、升级工具; 用法:《用apt+synaptic 在线安装或升级Fedora core 4.0 软件包》
4)yum 软件包在线安装、升级、移除工具;用法:《Fedora/Redhat 在线安装更新软件包,yum 篇》

5)所有的yum和apt 教程 《apt and yum》

6)《file.src.rpm 使用方法的简介》

7)《如何编译安装源码包软件》

提示:目前 apt和yum 已经极为成熟了,建议我们安装软件时采用 apt或者yum ;如果安装系统盘提供的软件包,可以用 system-config-packages 或redhat-config-packages ;


附录二:

1、《Fedora/Redhat 在线安装更新软件包,yum 篇》
2、《软件在线升级更新yum 图形工具介绍》
3、《Freshrpms.net 资源介绍,及apt 和yum 的应用》
4、《Fedora Extras(Fedora 计划的扩充资源) rpm.livna.org软件仓库的介绍和应用》
5、《RPM 的介绍和应用》
6、《file.src.rpm 使用方法的简单介绍》
7、《如何编译安装源码包软件>
8、《Fedora/Centos/Redhat及相关RPM资源收集及介绍》
分享到:

我的回复:

回复前请先 登录 注册

关于我们

这是一个在线直播学习平台
你可以在这里学习你喜爱的课程

关注我们

gongzhonghao.jpg

Powered by zhuir   沪ICP备15027604号  沪公网安备:31011302004922     Copyright © 2013-2024