Yum 命令

Yum 的全称是 "Yellowdog Updater Modified".

wikipedia链接

用yum install安装软件包

如果想安装某个软件, 只需要这样做:

  1. yum install packagename

下面的例子安装了postgresql:

  1. # yum install postgresql.x86_64
  2. Resolving Dependencies
  3. Install 2 Package(s)
  4. Is this ok [y/N]: y
  5. Running Transaction
  6. Installing : postgresql-libs-9.0.4-5.fc15.x86_64 1/2
  7. Installing : postgresql-9.0.4-5.fc15.x86_64 2/2

默认情况下, yum会向你确认要安装的包, 如不想显示这个确认, 可以加一个-y的参数:

  1. # yum -y install postgresql.x86_64

用yum remove卸载软件包

卸载软件包也很简单:

  1. # yum remove
  2. postgresql.x86_64
  3. Package postgresql.x86_64 0:9.0.4-5.fc15 will be erased
  4. Is this ok [y/N]: y
  5. Running Transaction
  6. Erasing : postgresql-9.0.4-5.fc15.x86_64 1/1

这个例子是卸载postgresql的.

用yum update升级某个软件包

  1. # yum update postgresql.x86_64

这个例子升级了postgresql.

用yum search搜索某个软件包

如果你不确定具体要安装的软件包的名字, 可以用yum search来搜索.

下面的例子搜索了那些名字中带有firefox的包:

  1. # yum search firefox
  2. Loaded plugins: langpacks, presto, refresh-packagekit
  3. ============== N/S Matched: firefox ======================
  4. firefox.x86_64 : Mozilla Firefox Web browser
  5. gnome-do-plugins-firefox.x86_64
  6. mozilla-firetray-firefox.x86_64
  7. mozilla-adblockplus.noarch : Mozilla Firefox extension
  8. mozilla-noscript.noarch : Mozilla Firefox extension

如果想显示全部的信息, 可以用yum search all.

用yum info来显示包的所有信息

当你通过yum search搜索到某个包时, 可以用yum info来查看包的信息:

  1. # yum info samba-common.i686
  2. Loaded plugins: langpacks, presto, refresh-packagekit Available Packages
  3. Name : samba-common
  4. Arch : i686
  5. Epoch : 1
  6. Version : 3.5.11
  7. Release : 71.fc15.1
  8. Size : 9.9 M
  9. Repo : updates
  10. Summary : Files used by both Samba servers and clients
  11. URL : http://www.samba.org/
  12. License : GPLv3+ and LGPLv3+
  13. Description : Samba-common provides files necessary for both the server and client

上面的例子查看了samba-common的包信息.

扩展阅读

15 Linux Yum Command Examples