DeskTux

Linux on Desktops

User Tools

Site Tools


misc:manually_installed_packages

Manually installed Packages

Sometimes, you want to create a list of manually installed packages on a system, so you can transfer this list to another computer. There are two ways to accomplish this, each has its advantages and disadvantages.

Using dpkg

The standard way in Debian is to use dpkg. Create a list of installed packages:

dpkg --get-selections "*" > ~/selections

This creates a list of all packages ever installed on your system (even if they got uninstalled later) and their state (install, deinstall, purge etc.).

To restore this file on another system just enter these two commands and sit back:

dpkg --set-selections < ~/selections
apt-get dselect-upgrade

Afterwards the package state will be restored. Even if a package has been purged on the reference system, it will be purged on the new system as well.

Using aptitude

The method above is very elegant and takes the whole status of the packaging system. It has one disadvantage though: it really takes all packages, even locally installed or platform dependent ones. And because there will be changes to your package list, going through the list manually to clean it up is not really an option.

I usually install a Debian base system using netinstall and only choose “Standard System” in tasksel during installation. Afterwards, I install everything I need by hand. But often the package choices are based on the designation of a system. Is it a mailserver, webserver or workstation?

To take the first piece of work out of my hands, I made me a script I call tweakconsole.sh, but being able to install the same packages as another system is really handy.

So, I found this command:

aptitude search -F '%100p' '~i!~M'|grep -v ^lib > ~/selections

This will create a list of all manually installed packages including their dependencies. AFAIK this is as good as it gets. To clean up the list a little, I filter out the libraries. The really necessary ones will be pulled in as dependencies anyway.

To restore this list on another system, just run:

apt-get install $(< ~/selections)

Sit back and enjoy :-)

Discussion

Enter your comment:
B B T Q S
 
misc/manually_installed_packages.txt · Last modified: 2024-05-18 18:40 by jens