当前位置:操作系统 > Unix/Linux >>

Fedora/Redhat在线安装更新软件包yum篇

在本文中,我们主要解介绍 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.


  

  在上面的例子中,如果Rep
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,