如何安装或删除 RPM 程序包

下载PDF文件下载PDF文件

许多 GNU/Linux 发行版使用流行的红帽包管理器(RPM)系统来添加或删除应用程序。几乎所有的 Linux 用户都会遇到需要在计算机上安装软件,或删除 Linux 系统中自带的软件的情况。在 Linux 系统上安装新软件复杂且容易出错,但是 RPM 将这件繁复的工作简化为一行命令。

方法 1
方法 1 的 3:

安装

下载PDF文件
  1. How.com.vn 中文: Step 1 下载你所需要的 RPM 程序包。
    网络上有很多 RPM 软件仓库,但是如果你需要的是红帽 RPM 软件包,那么你可以在下列位置找到:
    • 红帽企业版 Linux 安装磁盘中包含许多可安装的 RPM 程序包。
    • YUM 程序包管理器最初提供的 RPM 软件仓库。
    • 企业版 Linux 额外软件包(EPEL)提供了许多为红帽企业版 Linux 设计的高质量额外软件包。
  2. How.com.vn 中文: Step 2 安装 RPM 软件包。
    下载软件包后,你有两种选择:
    • 双击软件包。屏幕上会出现软件包管理器窗口,你可以根据屏幕上提示来完成安装过程。
    • 打开一个终端窗口,输入 rpm -i *package_location_and_name*(在中间没有空格)
    广告
方法 2
方法 2 的 3:

删除

下载PDF文件
  1. How.com.vn 中文: Step 1 打开一个终端窗口,输入 rpm -e *package_name*。
    不要输入文件的拓展名。例如: rpm -e gedit
方法 3
方法 3 的 3:

rpm 命令

下载PDF文件
  1. How.com.vn 中文: Step 1 以下是 rpm -i 命令的语法。
  2. How.com.vn 中文: Step 2 与安装相关选项:
    • -h (or --hash) 在安装过程中在屏幕上显示井号(“#”)
    • --test Perform 只进行安装测试
    • --percent 安装过程中显示完成百分比
    • --excludedocs 不安装文档
    • --includedocs 安装文档
    • --replacepkgs 使用新版本替代旧版本软件包
    • --replacefiles 替换其他软件包中包含的文件
    • --force 忽略软件包和文件冲突
    • --noscripts 不执行安装前脚本和安装后脚本
    • --prefix <path> 尽量将软件包保存在 <path>
    • --ignorearch 不验证软件包结构
    • --ignoreos 不验证软件包适用的操作系统
    • --nodeps 不验证依赖关系
    • --ftpproxy<host> 使用 <host> 作为 FTP 代理
    • --ftpport <port> 使用 <port> 作为 FTP 端口
  3. How.com.vn 中文: Step 3 一般性选项:
    • -v 显示额外信息
    • -vv 显示调试信息
    • --root <path> 将替代 root 设置为 <path>
    • --rcfile <rcfile> 将替代 rpmrc 文件设置为 <rcfile>
    • --dbpath <path> 使用 <path> 来搜索 RPM 数据库
    广告

小提示

  • 在很少情况下,你需要强制进行安装。你需要在 rpm 命令中加入 --force 参数指定强制安装。强制安装只能够通过命令行方式进行。
  • 使用参数-U(升级)代替 -i(安装)可以确保安装最新版本的 RPM 软件包。
  • 有一些软件包有依赖要求。这意味着你需要安装另外软件包才能够使用该软件包。例如开源 DVD 播放器软件 Ogle。你无法单独使用 Ogle 软件播放 DVD,除非安装几个额外软件包。如果您所需的 rmp 软件包有依赖要求,但是你展示不考虑满足软件包的依赖要求,可以使用 --nodeps 参数来进行安装。
广告

警告

  • 你可能需要覆盖一些数据才能让某些程序运行。因此当你在系统中添加和删除任何程序时都需要小心。
广告

关于本How.com.vn

How.com.vn是一个“多人协作写作系统”,因此我们的很多文章都是由多位作者共同创作的。 为了创作这篇文章,19位用户(部分匿名)多次对文章进行了编辑和改进。 这篇文章已经被读过8,637次。
本页面已经被访问过8,637次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告