CentOS – How to Fix Library Update Issues in CentOS

centoslibrarylinuxrpmupdate

I'm trying to update my libarchive library on CentOS 7. Currently, I have version 3.1.2. If I type the following command, here is the result:

# rpm -q libarchive
libarchive-3.1.2-10.el7_2.x86_64

I was able to find an .rpm file, online, which provides libarchive 3.5.2. I'd like to update to this newer version. So, I attempted to install the package by typing the following:

# rpm -i libarchive-3.5.2-1.el9.src.rpm
warning: user mockbuild does not exist -- using root
warning: group mock does not exist -- using root
warning: user mockbuild does not exist -- using root
warning: group mock does not exist -- using root
warning: user mockbuild does not exist -- using root
warning: group mock does not exist -- using root
warning: user mockbuild does not exist -- using root
warning: group mock does not exist -- using root

Even though it shows warnings, I would expect that it installed. After all, they're warnings, not errors. However, if I type the following command, it doesn't show that the package was installed.

# rpm -lq libarchive
/usr/lib64/libarchive.so.13
/usr/lib64/libarchive.so.13.1.2
/usr/share/doc/libarchive-3.1.2
/usr/share/doc/libarchive-3.1.2/COPYING
/usr/share/doc/libarchive-3.1.2/NEWS
/usr/share/doc/libarchive-3.1.2/README
/usr/share/man/man5/cpio.5.gz
/usr/share/man/man5/mtree.5.gz
/usr/share/man/man5/tar.5.gz

I've also tried compiling from source, based on a downloaded .tar file from the libarchive.org website. The procedure seems to go well, but I still only show the old, 3.1.2 version of libarchive when typing the rpm -lq libarchive command, or the rpm -q libarchive command.

So, how would I update this library? If it has been updated, why don't these commands show that it has been updated?

Thanks for your time.

Best Answer

The RPM you are trying to install is a SRPM (hence the .src in its filename) - it contains the sources for the package you want to upgrade.

You need to compile it first for your target system. Use mock to do that.

Take great care of not breaking other things if you introduce a newer version of a system lib provided by CentOS. Consider upgrading to EL8 (e.g. Rocky Linux, Alma Linux, or CentOS 8 Stream), you likely save yourself from headaches.