Chinaunix首页 | 论坛 | 博客
  • 博客访问: 534689
  • 博文数量: 184
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 2490
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-09 11:34
文章分类

全部博文(184)

文章存档

2011年(1)

2010年(2)

2009年(12)

2008年(169)

我的朋友

分类: LINUX

2008-06-15 12:04:50

一、        yum的一点小用法;
1、查询软件包;

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

[root@localhost]# yum list |more

在显示的软件列表中,会有软件名称、版本、是否安装等;仔细的看一下吧。熟悉了就好了。也没有什么难的。

[root@localhost]# 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]# yum info 软件名

比如:

[root@localhost]# 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]# yum search kernel |more ,也就是yum --help提供的参数,也是一样的;

[root@localhost]# yum list |grep kernel

 

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

[root@localhost]# 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

 

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

[root@localhost]# 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]# yum update kernel

升级内核全景如下:

[root@localhost]# 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

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

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

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

[root@localhost]# 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]#

 

2.安装和升级软件包;

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

[root@localhost]# yum update firefox

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

[root@localhost]# 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]# yum update

试着运行一下看看?会好长时间,对系统进行全面更新,我们要进行yN了。
阅读(375) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~