Solve Conflicts in RPM installation

Problem

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:

yum --disablerepo=* install -y ./bind-utils/*.rpm

Error output:

...
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:

# skipped
bind-utils.x86_64 32:9.9.4-73.el7_6

Then I try to use:

rpm -ivh ./bind-utils/*.rpm

still bad with conflicts:

...
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:

rpm {-i|--install} [install-options] PACKAGE_FILE ...

       This installs a new package.

       The general form of an rpm upgrade command is

rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

       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.

rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

       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:

rpm --force -ivh ./bind-utils/*.rpm
rpm -qa | grep openssl-libs
openssl-libs-1.0.2k-12.el7.x86_64
openssl-libs-1.0.2k-16.el7.x86_64
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章