Comments on Record Installed .deb Packages In A Text File (Ubuntu/Debian)

Record Installed .deb Packages In A Text File (Ubuntu/Debian) This short guide shows two methods of recording all your installed .deb packages in a text file that you can then use on another computer to install the same packages there. This is useful if you want to install the same set of packages on more than one computer.

7 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Marcus

Using dpkg --[get|set]-selections will miss the information on which packages were installed manually and which were installed automatically to satisfy dependencies. So on the target machine those packages that were installed automatically won't be removed when they are no longer needed. To keep the information about auto-installed packages instead of dpkg --get-selections one should use aptitude-create-state-bundle(1). On the target machine simply run aptitude-run-state-bundle(1) instead of dpkg --set-selections. Just my €0.02 ;) Cheers Marcus

By:

Did you check Save full state, not only changes?

By: treb0r

Same problem here. Synaptic just saves an empty file. Any ideas?

By: Anonymous

Thanks for the post.

On the target system it probably would be a good idea to run
sudo dpkg --clear-selections
before dpkg --set-selections.  According to the man-page this makes sure that no packages installed on the target and not on the source are set to be removed when running the apt-get command.

By: hippie

I get an empty text file.

By: Alejandro

Very useful post.

Anyway, I think you should aware  that this method only works well if you use the same Ubuntu version on both computers.

This applies not only to the release  (i.e. 8.10), but also to the type of installation (server or desktop) and the hardware architecture (Intel 32 bit, AMD 64 bit...)

Great and useful post, as always

 

By: johan

This is very helpfull, but sometimes you whant versions also, you whant to duplicate a machine and avoid updates which could cause problem for your usage. I have a solution for it.

DRY RUN SCRIPT
echo -n "apt-get -s install" > update.sh
dpkg-query -W -f=' ${Package}=${Version}'>> update.sh
chmod 700 update.sh

DO UPDATE SCRIPT
echo -n "apt-get install" > update.sh
dpkg-query -W -f=' ${Package}=${Version}'>> update.sh
chmod 700 update.sh

Johan