Wednesday, August 1, 2012

HOWTO: Clone all Programs Installed via Apt

Today I would like to share a nifty trick for cloning your application selections installed via the apt-get package manager. It is as simple as running two commands. First on the system you wish to clone, open a terminal and run this command (which is on pastebin due to blogger formatting issues).

Next, simply copy the package-list to the system you wish to setup a copy on. Finally open a terminal and run:

xargs apt-get install -y < package-list

In the same directory you copied the package-list file too. Please note that this trick only works when your two systems in question have exactly the same sources/operating system version.

Cheers,
~Jeff Hoogland

6 comments:

  1. pastebin not working here. Isn't it better to paste command here?

    ReplyDelete
  2. dpkg -l | awk '/^ii/ { print $2 }' >package-list

    ReplyDelete
  3. What about apt-get --get-selections? Just pipe into a file the same way. Then use --set-selections with the file. And I just noticed --clear-selections in the man page which looks helpful. Great cli fu though.

    ReplyDelete
  4. I do basically the same thing w/ synaptic:
    sudo apt-get install synaptic
    File>
    Save markings as(save w/ gui just like save As)
    (system 2 clone)
    File>
    read markings>(brose to file)
    (system to copy package list)
    If it is an ubuntu system I use y-ppa-manager to backup && restore the repositories and not forgetting a reload in synaptic b4 reading packages
    I know not quite as hardcore as the script above, but it's my work-flow for helping friend's/neighbors/clients w/ ubuntu systems

    ReplyDelete
  5. I love the sypnaptic command. Thanks a lot for the tip. love pau :)

    ReplyDelete
  6. Hi guys, it is al little late, but a did this script, using the Jeef's concept:

    http://pastebin.com/yec3WA96

    Cheers,

    ReplyDelete