RPM database location for backup purpose

Q. Where is the RPM database located under Fedora Core Linux? I need to backup the same so that it can be used for restore purpose. May be I can use the same for troubleshooting purpose.

A. /var/lib/rpm directory stores all files used by rpm command. To be frank you don’t have to backup /var/lib/rpm directory. You can use rpm command to get list of packages and restore them later on.

If you get rpm database corruption error, try to follow instructions mentioned here to fix database problem with following two commands:
# rpm --rebuilddb
# rpmdb_verify Packages

Above command will rebuild the RPM database for Fedora Core and recreate the necessary files for you.

Please note that above command works with Red Hat Linux, Fedora Core and Cent OS.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.