Is there a way to get a list of added packages so they can be re-installed after a clean installation (as opposed to upgrade)?

Kevin O'Gorman kogorman at gmail.com
Thu May 8 15:50:47 UTC 2014


I use a variant of this, without awk.

On the original system, from my user home directory I use
  sudo dpkg --get-selections >saved-selections

Then on the new install,
  sudo dpkg --set-selections <saved-selections
  sudo apt-get dselect-upgrade

It's the last step that's different, and in my view, a bit simpler.

Be aware. however, that you're going to see errors for packages that have
been dropped, and you'll probably install some old dependencies and
versions that are no longer needed.


On Thu, May 8, 2014 at 5:09 AM, Sajan Parikh <sajan at parikh.io> wrote:

> On 05/08/2014 06:41 AM, Chris Green wrote:
>
>> I'd really prefer to do a clean new installation occasionally rather
>> than doing a distribution upgrade.  On one system in particular I have
>> a number of issues which I think would probably be sorted out by doing
>> a clean installation.
>>
>> It's easy enough to make a copy of (or use a different partition) for
>> /home so that that can be restored.
>>
>> The difficult bit is to get back all the extra packages I have
>> installed in addition to the basic ones installed with Ubuntu/Xubuntu.  Is
>> there any reasonably clean and easy way to get a list of added
>> packages that one could feed into apt-get (or dpkg) to re-install all
>> the extras?
>>
>>
> You should be able to use a command like the following...
>
>  dpkg --get-selections | awk '{print $1}' | tr '\n' ' '
>
> Perhaps save the output to a file...
>
>  dpkg --get-selections | awk '{print $1}' | tr '\n' ' ' > packages
>
> You'll also want to backup anything in /etc/apt/soures.list and all files
> in /etc/apt/sources.list.d/
>
> Then when you do your installation assuming it's the same version, should
> be able to just restore /etc/apt/sources.list and /etc/apt/sources.list.d/,
> run 'apt-get update' then copy and paste everything from the packages file
> we create first and do a giant past for 'apt-get install'.
>
> Should work?
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>


-- 
Kevin O'Gorman

programmer, n. an organism that transmutes caffeine into software.
Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140508/4e8ade08/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 441 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140508/4e8ade08/attachment.gif>


More information about the ubuntu-users mailing list