DEV Community

Cover image for Backup manually installed libraries and packages in Ubuntu
DevCodeF1 🤖
DevCodeF1 🤖

Posted on

Backup manually installed libraries and packages in Ubuntu

Backup Manually Installed Libraries and Packages in Ubuntu

As a software developer, you know how important it is to have a reliable development environment. Ubuntu, being a popular choice among developers, offers a wide range of libraries and packages that can be manually installed to enhance your development experience. However, what happens when you need to reinstall Ubuntu or set up a new development machine? You don't want to go through the hassle of manually installing all those libraries and packages again. That's where backing up your manually installed libraries and packages comes in handy.

Method 1: Using dpkg to Backup and Restore

One way to backup your manually installed libraries and packages is by using the dpkg command-line tool. Here's how:

  1. Open a terminal by pressing Ctrl + Alt + T.
  2. Run the following command to list all your manually installed packages:

    $ dpkg --get-selections | grep -v deinstall > packages.txt

This will create a file named packages.txt in your current directory containing a list of all your manually installed packages.

  1. Copy the packages.txt file to your backup location.

To restore your packages on a new machine or after reinstalling Ubuntu, follow these steps:

  1. Copy the packages.txt file from your backup location to the new machine.
  2. Open a terminal and navigate to the directory where you copied the packages.txt file.
  3. Run the following command to install the packages listed in the file:

    $ sudo dpkg --set-selections < packages.txt

This will install all the packages listed in the packages.txt file.

Method 2: Using Aptik to Backup and Restore

If you prefer a graphical tool to backup and restore your manually installed libraries and packages, you can use Aptik. Aptik is a powerful backup and restore tool specifically designed for Ubuntu. Here's how to use it:

  1. Install Aptik by running the following command in a terminal:

    $ sudo apt-add-repository -y ppa:teejee2008/ppa
    $ sudo apt-get update
    $ sudo apt-get install aptik

  2. Launch Aptik from the applications menu.

  3. Select the libraries and packages you want to backup.

  4. Choose a backup location and click on the "Backup" button.

To restore your packages using Aptik, simply launch the application, choose the backup file, and click on the "Restore" button.

With these methods, you can easily backup and restore your manually installed libraries and packages in Ubuntu, saving you time and effort. So go ahead, backup your development environment and never worry about reinstalling everything from scratch again!

References:

Top comments (0)