27 December 2011

Listing installed packages with Aptitude (to install on another computer)

Debian and Ubuntu machines, and others that use Aptitude, can list their installed packages many ways.  This is my favorite since it only lists the manually-installed packages.  Dependencies, which may change in the future, aren't included on this list which means that Aptitude can do the dependency handling.

First we list the packages and redirect that to a text file named packages.txt (note this is all one line):
root-shell-machine1#  aptitude search '~i' |grep -v "i.A " |awk '{print $2}' > packages.txt

Then we want to copy that packages.txt file to the other machine (I'll let you figure that out).  Once on the other machine, we want to update our Aptitude catalog and then install the listed packages:
root-shell-machine2#  aptitude update
root-shell-machine2#  aptitude install `cat packages.txt`

0 comments: