我有一台 CentOS 机器,我已经使用它安装了 openssl-devel
$ yum install openssl-devel
Run Code Online (Sandbox Code Playgroud)
它下载并安装了所有的依赖包。现在我需要所有这些 RPM 包。是否可以只下载 RPM 包?当我这样做时:
$ yum install openssl-devel -y --downloadonly
Run Code Online (Sandbox Code Playgroud)
它说
Package 1:openssl-devel-1.0.1e-4.fc18.x86_64 already installed and latest version
Run Code Online (Sandbox Code Playgroud)
因为它已经安装了。
有谁知道如何在同一系统上下载这些 RPM 包?
Joh*_*Eye 14
可以下载已使用--downloadonly交换机安装的 RPM 的软件包。我不知道为什么 yum 在检查包是否已经安装之前不检查这个设置,但我猜这可能是由工具的底层架构引起的。
无论如何,您需要做的就是告诉 yum重新安装软件包:
yum --downloadonly --downloaddir=/tmp/rpm_files/ reinstall package_name
Run Code Online (Sandbox Code Playgroud)
当然,yum 不会知道只为这个包安装了哪些依赖项,因此如果您使用 RPM 并尝试将它们安装在不同的系统上,则可能会丢失一些依赖项。有多种方法可以探索整个依赖关系图,我相信这已经在 SE 的其他地方进行了描述。
yumdownloaderinyum-utils将下载您传递给它的任何包,或者可以选择生成可以从中下载包的 URL。
您可以使用yum-utils 包中的repotrack命令。它将下载整个依赖关系树——即使它已经安装了。
例子:
sudo yum install yum-utils # Install yum-utils
sudo repotrack openssl-devel # Download all dependencies for openssl-devel
Run Code Online (Sandbox Code Playgroud)
示例输出:
[sbadra@rhel6 ~]$ sudo yum install openssl-devel
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Setting up Install Process
Package openssl-devel-1.0.1e-57.el6.x86_64 already installed and latest version
Nothing to do
[sbadra@rhel6 ~]$ sudo repotrack openssl-devel
Downloading audit-libs-2.4.5-6.el6.x86_64.rpm
Downloading audit-libs-2.4.5-6.el6.i686.rpm
Downloading basesystem-10.0-4.el6.noarch.rpm
Downloading bash-4.1.2-48.el6.x86_64.rpm
Downloading ca-certificates-2017.2.14-65.0.1.el6_9.noarch.rpm
Downloading chkconfig-1.3.49.5-1.el6.x86_64.rpm
Downloading coreutils-8.4-46.el6.x86_64.rpm
Downloading coreutils-libs-8.4-46.el6.x86_64.rpm
.... more packages ....
Downloading openssl-1.0.1e-57.el6.i686.rpm
Downloading openssl-1.0.1e-57.el6.x86_64.rpm
Downloading openssl-devel-1.0.1e-57.el6.i686.rpm
Downloading openssl-devel-1.0.1e-57.el6.x86_64.rpm
.... more packages ....
Downloading sed-4.2.1-10.el6.x86_64.rpm
Downloading setup-2.8.14-23.el6.noarch.rpm
Downloading tzdata-2018c-1.el6.noarch.rpm
Downloading zlib-1.2.3-29.el6.x86_64.rpm
Downloading zlib-1.2.3-29.el6.i686.rpm
Downloading zlib-devel-1.2.3-29.el6.i686.rpm
Downloading zlib-devel-1.2.3-29.el6.x86_64.rpm
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27752 次 |
| 最近记录: |