How to Back up the Installed Packages/RPM on Linux

October 24, 2023 / How-to Guide

In this article, we will explain the process of creating backups for installing packages/RPM on Linux.

RPM rebuild is a user-friendly tool to generate RPM files from already installed packages, making it accessible to those with no prior RPM building experience. (In the Debian ecosystem, dpkg-repack serves a similar purpose).

  1. For RHEL/CentOS: If it is not installed on your server then, you need to install it.
    yum install rpmrebuild -y
  2. For Ubuntu/Debian:
    apt-get install rpmrebuild -y

    Once it’s installed, you are set to start using it!
    For example, if the “screen” package is installed on the server, you can utilise the command line to create a backup of the “screen” package:

    rpmrebuild screen
    1. Now, a confirmation prompt will appear on your screen, you need to input “Y” and press Enter.
      The package will be backed up in the /root directory. Upon completion, the system will display the location of the generated backup file.
    2. To install an RPM file, use the following command line:
      rpm -Uvh rpm_pack_name.rpm

      Note: Make sure that you replace the specific package name with “rpm_pack_name.rpm.”

In this way, you can back up the installed packages/RPM on Linux. For more information on Linux, visit our knowledge base section.

Spread the love