-
Backup and Retrieve List of Installed Packages For Quick Software Restore in Linux
Posted on November 13th, 2008 No commentsWhy do you want to create a copy of the packages installed in Linux on your machine ? This is mainly to speed up in scenarios such as – upgrading from an earlier version to a newer version when you choose to do a fresh install, or installing an exact copy of Linux right down to all the packages installed on one machine to another machine and so on.
The general steps to be followed are as follows :
- Get a copy of all the packages installed on your Linux machine (source machine) and save it to a text file.
- Copy the file to the target machine which has a fresh Linux install and merge it into the repository database.
- Finally run the command to do the upgrade.
On a practical level, this is how it is done :
Debian based Linux distributions
In Debian Linux and other Debian based distributions such as Ubuntu which use
dpkgandapt-getto do package management, this is how it is done.- Get a copy of all the packages installed on the source machine and save it in the
package.list.$ dpkg --get-selections > package.list
- Copy the file to the target machine and merge it to the repository database.
dpkg --set-selections < package.list
- Finally upgrade the target system (You should have super user privileges to use apt-get. ).
# apt-get dselect-upgrade
apt-get will download and install all the packages that were listed in the
package.listfile.
This way you get an exact copy of the packages installed on your source Linux machine.
Arch Linux
Arch Linux uses
pacmantool for package management. In Arch Linux, you do it as follows :- Backup the current list of packages on the source machine.
$ pacman -Qqe > package.list
- Store the
package.listfile on a USB key or other convenient medium. Copy thepackage.listfile to the new installation (target machine running Arch Linux), and navigate to the directory containing it. - Install the packages using the following command :
# pacman -S $(cat package.list)
Related Posts
- Arch Linux – How to install packages from AUR
- dpigs – Shows which installed packages occupy most space
- A beginner's guide to Arch Linux installation
- How To Install LAMP Server in Ubuntu Linux
- Linux Articles
