
我有一台 CentOS 機器,我已經使用它安裝了 openssl-devel
$ yum install openssl-devel
它下載並安裝了所有依賴套件。現在我需要所有這些 RPM 軟體包。是否可以只下載 RPM 套件?當我這樣做時:
$ yum install openssl-devel -y --downloadonly
它說
Package 1:openssl-devel-1.0.1e-4.fc18.x86_64 already installed and latest version
因為它已經安裝了。
有人知道如何在同一系統上下載這些 RPM 軟體包?
答案1
可下載使用交換器安裝的 RPM 軟體包--downloadonly
。我不確定為什麼 yum 在檢查軟體包是否已安裝之前不檢查此設置,但我猜這可能是由該工具的底層架構引起的。
不管怎樣,你需要做的就是告訴 yum重新安裝包裝:
yum --downloadonly --downloaddir=/tmp/rpm_files/ reinstall package_name
當然,yum 不會知道專門為此軟體包安裝了哪些依賴項,因此如果您取得 RPM 並嘗試將它們安裝在不同的系統上,則可能會遺失某些依賴項。有幾種方法可以探索整個依賴關係圖,我確信這已經在 SE 的其他地方進行了描述。
答案2
yumdownloader
inyum-utils
將下載您傳遞給它的任何包,或可選地產生可從中下載包的 URL。
答案3
您可以使用重新追蹤來自 yum-utils 套件的命令。它將下載整個依賴樹 -即使已經安裝。
例子:
sudo yum install yum-utils # Install yum-utils
sudo repotrack openssl-devel # Download all dependencies for openssl-devel
範例輸出:
[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
答案4
這就是我所做的:
sudo yum install --config=./yum.conf
--installroot=/tmp/f541Sdex
--downloadonly
--downloaddir /tmp/DL-e25xds
$(cat list-of-packages)