# rpm2tgz

RPM 是最常见的 Linux 软件包格式之一，非常多的开发者只以源代码形式和 RPM 包形式提供他们的软件。在这种情况下，有三种选择：

1. 自行创建 Slackware 包。
2. 直接从源代码编译安装。
3. 转换 RPM 包并安装。

构建源代码或者创建 Slackware 包并不是想象中的那么复杂，但直接从源代码编译安装是不太好的，因为在执行 `make install` 之后，很难追踪哪些东西被安装在了系统中。如何自行创建 Slackware 包不在本章的讨论范围里。那么只好使用 `rpm2tgz` 了。

`rpm2tgz` 把 RPM 包转换成可以被 `pkgtool` 或 `installpkg` 安装的 Slackware 包，这样一来，既避免了自行创建 Slackware 包，又实现了对软件包的追踪、移除和升级。

> **警告**
>
> 一个 Slackware 包只是 shell 脚本加一些代码，相比之下，一个 RPM 包就像个充满了依赖列表和特殊指令的迷宫。因此， `rpm2tgz` 不是总能奏效，尤其对那些非常复杂的应用程序，而且它也不会像变魔术似的解决依赖关系。

要尝试 `rpm2tgz`，从可靠的网站上下载一个 RPM 文件并转换它：

```
rpm2tgz foo-x.x.xx.rpm
```

这会产生一个 `.tgz` 文件，所以转换完毕后，原来的 RPM 文件完全可以删除。使用 `installpkg` 可以安装刚刚创建的 Slackware 包，不过要使安装的程序能够真正运行，还要保证所有它依赖的代码也被正确安装了。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://slackwarecn.gitbook.io/slackbook_cn/chapter_17/package_compression_formats/rpm2tgz.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
