这篇文章主要介绍“RPM包知识点详细介绍”,在日常操作中,相信很多人在RPM包知识点详细介绍问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”RPM包知识点详细介绍”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
可供用户选择的“版本”和“风味版”(spins / labs / silverblue)其实非常相似。它们都是由各种软件组成的,这些软件经过混合和搭配,可以很好地协同工作。它们之间的不同之处在于放入其中的具体工具不同。这种选择取决于它们所针对的用例。所有这些的“版本”和“风味版”基本组成单位都是 RPM 软件包文件。
RPM 文件是类似于 ZIP 文件或 tarball 的存档文件。实际上,它们使用了压缩来减小存档文件的大小。但是,除了文件之外,RPM 存档中还包含有关软件包的元数据。可以使用 rpm
工具查询:
$ rpm -q fpastefpaste-0.3.9.2-2.fc30.noarch $ rpm -qi fpasteName : fpasteVersion : 0.3.9.2Release : 2.fc30Architecture: noarchInstall Date: Tue 26 Mar 2019 08:49:10 GMTGroup : UnspecifiedSize : 64144License : GPLv3+Signature : RSA/SHA256, Thu 07 Feb 2019 15:46:11 GMT, Key ID ef3c111fcfc659b9Source RPM : fpaste-0.3.9.2-2.fc30.src.rpmBuild Date : Thu 31 Jan 2019 20:06:01 GMTBuild Host : buildhw-07.phx2.fedoraproject.orgRelocations : (not relocatable)Packager : Fedora ProjectVendor : Fedora ProjectURL : https://pagure.io/fpasteBug URL : https://bugz.fedoraproject.org/fpasteSummary : A simple tool for pasting info onto sticky notes instancesDescription :It is often useful to be able to easily paste text to the FedoraPastebin at http://paste.fedoraproject.org and this simple scriptwill do that and return the resulting URL so that people mayexamine the output. This can hopefully help folks who are forsome reason stuck without X, working remotely, or any otherreason they may be unable to paste something into the pastebin $ rpm -ql fpaste/usr/bin/fpaste/usr/share/doc/fpaste/usr/share/doc/fpaste/README.rst/usr/share/doc/fpaste/TODO/usr/share/licenses/fpaste/usr/share/licenses/fpaste/COPYING/usr/share/man/man1/fpaste.1.gz
安装 RPM 软件包后,rpm
工具可以知道具体哪些文件被添加到了系统中。因此,删除该软件包也会删除这些文件,并使系统保持一致状态。这就是为什么要尽可能地使用 rpm
安装软件,而不是从源代码安装软件的原因。
如今,完全独立的软件已经非常罕见。甚至 fpaste,连这样一个简单的单个文件的 Python 脚本,都需要安装 Python 解释器。因此,如果系统未安装 Python(几乎不可能,但有可能),则无法使用 fpaste
。用打包者的术语来说,“Python 是 fpaste
的运行时依赖项。”
构建 RPM 软件包时(本文不讨论构建 RPM 的过程),生成的归档文件中包括了所有这些元数据。这样,与 RPM 软件包归档文件交互的工具就知道必须要安装其它的什么东西,以便 fpaste
可以正常工作:
$ rpm -q --requires fpaste/usr/bin/python3python3rpmlib(CompressedFileNames) <= 3.0.4-1rpmlib(FileDigests) <= 4.6.0-1rpmlib(PayloadFilesHavePrefix) <= 4.0-1rpmlib(PayloadIsXz) <= 5.2-1 $ rpm -q --provides fpastefpaste = 0.3.9.2-2.fc30 $ rpm -qi python3Name : python3Version : 3.7.3Release : 3.fc30Architecture: x86_64Install Date: Thu 16 May 2019 18:51:41 BSTGroup : UnspecifiedSize : 46139License : PythonSignature : RSA/SHA256, Sat 11 May 2019 17:02:44 BST, Key ID ef3c111fcfc659b9Source RPM : python3-3.7.3-3.fc30.src.rpmBuild Date : Sat 11 May 2019 01:47:35 BSTBuild Host : buildhw-05.phx2.fedoraproject.orgRelocations : (not relocatable)Packager : Fedora ProjectVendor : Fedora ProjectURL : https://www.python.org/Bug URL : https://bugz.fedoraproject.org/python3Summary : Interpreter of the Python programming languageDescription :Python is an accessible, high-level, dynamically typed, interpreted programminglanguage, designed with an emphasis on code readability.It includes an extensive standard library, and has a vast ecosystem ofthird-party libraries. The python3 package provides the "python3" executable: the referenceinterpreter for the Python language, version 3.The majority of its standard library is provided in the python3-libs package,which should be installed automatically along with python3.The remaining parts of the Python standard library are broken out into thepython3-tkinter and python3-test packages, which may need to be installedseparately. Documentation for Python is provided in the python3-docs package. Packages containing additional libraries for Python are generally named withthe "python3-" prefix. $ rpm -q --provides python3python(abi) = 3.7python3 = 3.7.3-3.fc30python3(x86-64) = 3.7.3-3.fc30python3.7 = 3.7.3-3.fc30python37 = 3.7.3-3.fc30
虽然 rpm
知道每个归档文件所需的依赖关系,但不知道在哪里找到它们。这是设计使然:rpm
仅适用于本地文件,必须具体告知它们的位置。因此,如果你尝试安装单个 RPM 软件包,则 rpm
找不到该软件包的运行时依赖项时就会出错。本示例尝试安装从 Fedora 软件包集中下载的软件包:
$ lspython3-elephant-0.6.2-3.fc30.noarch.rpm $ rpm -qpi python3-elephant-0.6.2-3.fc30.noarch.rpmName : python3-elephantVersion : 0.6.2Release : 3.fc30Architecture: noarchInstall Date: (not installed)Group : UnspecifiedSize : 2574456License : BSDSignature : (none)Source RPM : python-elephant-0.6.2-3.fc30.src.rpmBuild Date : Fri 14 Jun 2019 17:23:48 BSTBuild Host : buildhw-02.phx2.fedoraproject.orgRelocations : (not relocatable)Packager : Fedora ProjectVendor : Fedora ProjectURL : http://neuralensemble.org/elephantBug URL : https://bugz.fedoraproject.org/python-elephantSummary : Elephant is a package for analysis of electrophysiology data in PythonDescription :Elephant - Electrophysiology Analysis Toolkit Elephant is a package for theanalysis of neurophysiology data, based on Neo. $ rpm -qp --requires python3-elephant-0.6.2-3.fc30.noarch.rpmpython(abi) = 3.7python3.7dist(neo) >= 0.7.1python3.7dist(numpy) >= 1.8.2python3.7dist(quantities) >= 0.10.1python3.7dist(scipy) >= 0.14.0python3.7dist(six) >= 1.10.0rpmlib(CompressedFileNames) <= 3.0.4-1rpmlib(FileDigests) <= 4.6.0-1rpmlib(PartialHardlinkSets) <= 4.0.4-1rpmlib(PayloadFilesHavePrefix) <= 4.0-1rpmlib(PayloadIsXz) <= 5.2-1 $ sudo rpm -i ./python3-elephant-0.6.2-3.fc30.noarch.rpmerror: Failed dependencies: python3.7dist(neo) >= 0.7.1 is needed by python3-elephant-0.6.2-3.fc30.noarch python3.7dist(quantities) >= 0.10.1 is needed by python3-elephant-0.6.2-3.fc30.noarch
理论上,你可以下载 python3-elephant
所需的所有软件包,并告诉 rpm
它们都在哪里,但这并不方便。如果 python3-neo
和 python3-quantities
还有其它的运行时要求怎么办?很快,这种“依赖链”就会变得相当复杂。
幸运的是,有了 dnf
和它的朋友们,可以帮助解决此问题。与 rpm
不同,dnf
能感知到存储库。存储库是程序包的集合,带有告诉 dnf
这些存储库包含什么内容的元数据。所有 Fedora 系统都带有默认启用的默认 Fedora 存储库:
$ sudo dnf repolistrepo id repo name statusfedora Fedora 30 - x86_64 56,582fedora-modular Fedora Modular 30 - x86_64 135updates Fedora 30 - x86_64 - Updates 8,573updates-modular Fedora Modular 30 - x86_64 - Updates 138updates-testing Fedora 30 - x86_64 - Test Updates 8,458
在 Fedora 快速文档中有这些存储库以及如何管理它们的更多信息。
dnf
可用于查询存储库以获取有关它们包含的软件包信息。它还可以在这些存储库中搜索软件,或从中安装/卸载/升级软件包:
$ sudo dnf search elephantLast metadata expiration check: 0:05:21 ago on Sun 23 Jun 2019 14:33:38 BST.============================================================================== Name & Summary Matched: elephant ==============================================================================python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Pythonpython3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python $ sudo dnf list \*elephant\*Last metadata expiration check: 0:05:26 ago on Sun 23 Jun 2019 14:33:38 BST.Available Packagespython3-elephant.noarch 0.6.2-3.fc30 updates-testingpython3-elephant.noarch 0.6.2-3.fc30 updates
现在使用 dnf
安装软件包时,它将解决所有必需的依赖项,然后调用 rpm
执行该事务操作:
$ sudo dnf install python3-elephantLast metadata expiration check: 0:06:17 ago on Sun 23 Jun 2019 14:33:38 BST.Dependencies resolved.============================================================================================================================================================================================== Package Architecture Version Repository Size==============================================================================================================================================================================================Installing: python3-elephant noarch 0.6.2-3.fc30 updates-testing 456 kInstalling dependencies: python3-neo noarch 0.8.0-0.1.20190215git49b6041.fc30 fedora 753 k python3-quantities noarch 0.12.2-4.fc30 fedora 163 kInstalling weak dependencies: python3-igor noarch 0.3-5.20150408git2c2a79d.fc30 fedora 63 k Transaction Summary==============================================================================================================================================================================================Install 4 Packages Total download size: 1.4 MInstalled size: 7.0 MIs this ok [y/N]: yDownloading Packages:(1/4): python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch.rpm 222 kB/s | 63 kB 00:00(2/4): python3-elephant-0.6.2-3.fc30.noarch.rpm 681 kB/s | 456 kB 00:00(3/4): python3-quantities-0.12.2-4.fc30.noarch.rpm 421 kB/s | 163 kB 00:00(4/4): python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch.rpm 840 kB/s | 753 kB 00:00----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total 884 kB/s | 1.4 MB 00:01Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing : 1/1 Installing : python3-quantities-0.12.2-4.fc30.noarch 1/4 Installing : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4 Installing : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4 Installing : python3-elephant-0.6.2-3.fc30.noarch 4/4 Running scriptlet: python3-elephant-0.6.2-3.fc30.noarch 4/4 Verifying : python3-elephant-0.6.2-3.fc30.noarch 1/4 Verifying : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4 Verifying : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4 Verifying : python3-quantities-0.12.2-4.fc30.noarch 4/4 Installed: python3-elephant-0.6.2-3.fc30.noarch python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch python3-quantities-0.12.2-4.fc30.noarch Complete!
请注意,dnf
甚至还安装了python3-igor
,而它不是 python3-elephant
的直接依赖项。
尽管技术用户可能会发现 dnf
易于使用,但并非所有人都这样认为。Dnfdragora 通过为 dnf
提供图形化前端来解决此问题。
dnfdragora (version 1.1.1-2 on Fedora 30) listing all the packages installed on a system.
从上面可以看到,dnfdragora 似乎提供了 dnf
的所有主要功能。
Fedora 中还有其他工具也可以管理软件包,GNOME 的“软件”和“发现”就是其中两个。GNOME “软件”仅专注于图形应用程序。你无法使用这个图形化前端来安装命令行或终端工具,例如 htop
或 weechat
。但是,GNOME “软件”支持安装 dnf
所不支持的 Flatpak 和 Snap 应用程序。它们是针对不同目标受众的不同工具,因此提供了不同的功能。
到此,关于“RPM包知识点详细介绍”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。