I want to offline install some rpms for an application, I put all dependencies for that application in a dedicated directory. The problem is it will cause conflicts with the old installed ones, I also want to keep old existing rpms because they may needed by other packages. For example, I offline install bind-utils use command:
1
yum --disablerepo=* install -y ./bind-utils/*.rpm
Error output:
1 2 3 4 5 6 7 8 9 10 11
... Error: Package: 1:openssl-1.0.2k-12.el7.x86_64 (@anaconda/7.5) Requires: openssl-libs(x86-64) = 1:1.0.2k-12.el7 Removing: 1:openssl-libs-1.0.2k-12.el7.x86_64 (@anaconda/7.5) openssl-libs(x86-64) = 1:1.0.2k-12.el7 Updated By: 1:openssl-libs-1.0.2k-16.el7.x86_64 (/openssl-libs-1.0.2k-16.el7.x86_64) openssl-libs(x86-64) = 1:1.0.2k-16.el7 ... You could try using --skip-broken to work around the problem ** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows: mokutil-15-1.el7.x86_64 is a duplicate with mokutil-12-1.el7.x86_64
This error shows that yum try to update old rpm with new one but this breaks the dependency chain. Option --skip-broken won’t work here, it will skip the dependency-problem rpm which include exactly what I need:
1 2
# skipped bind-utils.x86_64 32:9.9.4-73.el7_6
Then I try to use:
1
rpm -ivh ./bind-utils/*.rpm
still bad with conflicts:
1 2 3
... file /usr/lib64/openssl/engines/libcapi.so from install of openssl-libs-1:1.0.2k-16.el7.x86_64 conflicts with file from package openssl-libs-1:1.0.2k-12.el7.x86_64 ...
Solution
After doing research I find some rpm options may help:
This upgrades or installs the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed.
This will upgrade packages, but only ones for which an earlier version is installed. ... --force Same as using --replacepkgs, --replacefiles, and --oldpackage. --replacepkgs Install the packages even if some of them are already installed on this system. --replacefiles Install the packages even if they replace files from other, already installed, packages. --oldpackage Allow an upgrade to replace a newer package with an older one.
Let’s add --force flag and try again, this works and the old rpms are still there: