8

Possible Duplicate:
How do you track which packages were installed on Ubuntu (Linux)?

Hello,

I'm using apt-get install to install various software on my PC. I have a handful of PCs that needs the same software packages installed all over them. How can I get list of software installed via apt-get install and the sequence in what the packages are installed. Okay, the sequence is not so important since the package manager resolves dependencies... I want to create a script that once run installs all needed software on the other PCs. All of these PCs are Ubuntu default installations. It is obvious that the packages list must not include all the packages that are installed trough a default installation :)

Also that list should not contain software installed via synaptic or dpkg if possible.

2

2 Answers 2

2

You can save a list of installed packages on the old machine with the command dpkg --get-selections > ~/packages and then restore it on the new one with sudo dpkg --set-selections < ~/packages && apt-get dselect-upgrade.

You shouldn't have to worry about the default install having a load of stuff already included, apt-get will look after everything for you.

You are going to end up with several text files called packages listing the packages that need installing on each machine. If you want you can add all these together and then get rid of duplicates using uniq, meaning that you would then have one set of packages to install rather than one set from each machine.

1
  • 1
    To combine them together, you would write something like cat file1 file2 file3 | sort | uniq > outputfile
    – davr
    Apr 19, 2010 at 16:55
13

aptitude can do what are you looking for and much more, actually.

aptitude search '?installed ?not(?automatic)'

Or shorter:

aptitude search '~i!~M'

will list all the packages installed manually. None of the dependent (i.e., like mysql-data, or *-common, that are installed automatically) packages will be listed.

If you want just package names, use -F '%p' parameter.

You can check out search patterns reference, there's virtually no criteria it can't search for.

Not the answer you're looking for? Browse other questions tagged .