Linux.com

Use the dpkg magic

Posted by: spartas on June 21, 2007 04:21 AM

One of the nice things about debian-based distributions is apt. Another nice thing is dpkg.
Instead of choosing just a few packages and specifying them on the command line to <code>apt-get install</code>, with dpkg it is possible to restore all the packages that were previously on the system. To use this, before upgrading, save the list of currently installed packages to the home folder with the following command:


<code>
dpkg --get-selections > ~username/packages.list
</code>


After upgrading, to restore all of the installed packages, all that is necessary is the following commands:



<code>
apt-get update

sudo dpkg --set-selections < ~username/packages.list

sudo apt-get -u dselect-upgrade

</code>


Note, dselect is not spelled deselect (i.e. the first e is missing).



This second part can be automated (e.g. put into a script).
<!-- start: modules/comments/xartemplates/user-modifiedby.xd -->
[Modified by: spartas on June 21, 2007 04:22 AM]<!-- end: modules/comments/xartemplates/user-modifiedby.xd -->

#

Return to Simple script restores your system settings after OS reinstall