返回介绍

Hack-71 Yum 命令

发布于 2025-03-08 17:39:07 字数 2624 浏览 0 评论 0 收藏 0

Yum 命令

Yum 的全称是 "Yellowdog Updater Modified".

wikipedia 链接

yum install 安装软件包

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

yum install packagename

下面的例子安装了 postgresql:

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

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

# yum -y install postgresql.x86_64

yum remove 卸载软件包

卸载软件包也很简单:

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

这个例子是卸载 postgresql 的。

yum update 升级某个软件包

# yum update postgresql.x86_64

这个例子升级了 postgresql.

yum search 搜索某个软件包

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

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

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

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

yum info 来显示包的所有信息

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

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

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

扩展阅读

15 Linux Yum Command Examples

本书简介:

  • Linux 进阶技巧
  • 巧妙的命令组合
  • Bash 某些技巧
  • 一共一百零一个(包括充数的)
  • 最后有个奖励章(额外技巧)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文