Move your Ubuntu system to another computer in 3 simple steps

You just got a brand new machine but you won’t like to spend hours tuning it to get the same configuration as the one you have used for years?

Let’s transfer your Ubuntu configuration and applications to your new computer in three simple steps.

This method is cross-architecture. I moved successfully my configuration and applications from an Ubuntu 9.04 32bit to a 64bit one.

Prerequisites:

The same version of Ubuntu is installed on both machines. The architecture (32/64 bit) can be different.

Step 1: Store the list of installed packages

Run the following command on the source machine to store the installed packages names in ~/pkglist:
sudo dpkg --get-selections | sed "s/.*deinstall//" | sed "s/install$//g" > ~/pkglist

Step 2: Transfer your config

Use scp or rsync or even a flash drive to transfer your home directory (~/*, ~/.*), the source list (/etc/apt/sources.list) and any other files you customized or installed (like apache config under /etc or softwares on /opt) from the source machine to the target one.

Step 3: Install packages

On the target machine run the following command in a failsafe terminal session to install your packages:

sudo aptitude update && cat pkglist | xargs sudo aptitude install -y

That’s all folks!

Log into your new machine and keep working as if you were using the previous one.

A freshly transfered Ubuntu install

Post to Twitter

. Bookmark the permalink. Both comments and trackbacks are currently closed.
  • Nitin

    Exactly what I was looking for. vey helpful. Thanks

  • http://www.technoshamanarchist.net Emrah

    ……
    Hit http://archive.ubuntu.com lucid-security/multiverse Packages
    Hit http://archive.ubuntu.com lucid-security/multiverse Sources
    Reading package lists… Done

    after this, nothing else happens, it’s just stuck with a blinking cursor. Any ideas?

    Thank you :)

    • http://eggsonbread.com Philippe Creux

      Does this happen when you run sudo aptitude install `xargs ~/pkglist`? If so, what does xargs ~/pkglist display?

  • Lamer

    I think you should use `xargs -a ~/pkglist`

    • Jared Kline

      Thanks, you’re suggestion was the only one that worked on my 10.10 install in the slightest.

    • http://eggsonbread.com Philippe Creux

      I’m happy that this tutorial is still working on 10.10.

  • demidrol

    > sudo aptitude install `xargs ~/pkglist`

    OMG, that will take much time. Better do the following

    cat ~/pkglist | dpkg –set-selections
    apt-get dselect-upgrade

    • veelck

      It should be sth like:
      cat ~/pkglist | awk ‘{print $1 ” install”}’ | dpkg –set-selections
      apt-get dselect-upgrade

  • Marek

    Hi Philippe,
    thank you for this very simple mothod, I was searching a lot, and hitting very complex many steps methods. This one was easy and great.
    Take care
    Marek

  • Marek

    sorry, forgot to mention, that last scripts work on 11.04 but i had to change last one as follows:
    sudo apt-get update && sudo apt-get install `xargs -a ~/pkglist`

    I am a bit lame in linux, so in step 2 I was missing more info about which files except of home directory to transfer as well. Otherwise it was succesful.

  • אילן

    Thanks for the technique. Some things were transferred correctly and this saved me work.

    Things that were not installed that I came across: Cairo-dock and VLC. I’ll update is there are more.

    There SHOULD be a utlity to make this process foolproof and easy…

    • אילן

      It turns out DOZENS of apps were left behind. Some like desktopnova have an install procedure that bypasses apt-get, but most are run-of-the-mil, standard ubuntu software center apps.

      Guess we should come up with a more complete way to do this.

  • JB

    Hey,

    How long is the last command supposed to take? it has been running (well I hope it runs, because I cannot see anything happening except that blank line) for 40 minutes and still nothing …

    I ran
    sudo aptitude install `xargs /home/user/pkglist`

    cheers,

    • JB

      By the way thank you for this post, and I am running ubuntu 10.04,

      cheers,

  • Pingback: Ubuntu konfigurieren und auf neues System kopieren - Forum de Luxx

  • Shay Guy

    I can’t seem to follow the various tutorials for rsync that are out there. Do I need to run in daemon mode or whatever? That seems more complex than it should be. I can’t even figure out how to resolve the hostname. (Both systems are on the same wireless home network — “network” meaning they can use the same router to access the Internet. But just using “destname” — as in “myname@destname:~$” — doesn’t work, I can’t find a USB-to-USB cable, and I don’t know if an Ethernet cable will do any good.)

  • David

    Step 1 doesn’t work for me, I got “illegal variable name” error.

    I have 10.04

    • David

      never mind, I wasn’t running bash…

  • Aymen

    Hi,
    It seems very helpful article, but in Step 2 how I can transfer directories like /etc and /opt to the new machine? cause cp -r doesn’t work fine for me. Moreover, are the /etc and /opt directories enough for this kind of migration? Or should I transfer all under /?
    Thanks

    • http://eggsonbread.com Philippe Creux

      I would rather leave /etc alone unless you edited files yourself. I guess you should use “sudo cp -r” :)

  • http://www.iwebprovider.com Innovative Web Provi

    Have anyone tried this on version 11.10? I’m planning to migrate my ubuntu to my other PC right after I fix it. Thanks for this anyway, nice stuff you got there

  • R Sarath

    Could someone please explain the above steps in detail( a walk through) as I am a newbie to ubuntu . I run ubuntu 11.10 on my desktop and i wish to port it to my laptop with all the updates and software downloads.

  • http://kele.herbopedia.org kele

    Hi Philippe!

    Thanks A LOT for this!! I followed the steps you kindly shared with us but for the 3rd step I did (to the target machine):
    sudo apt-get install dselect
    dpkg –set-selections < ~/pkglist
    dselect update
    apt-get dselect-upgrade show

    I am using Kubuntu (when I do lsb_release -d I get: Ubuntu 10.04.4 LTS though).

  • http://gauravmali.com Gaurav Mali

    Will this transfer Ruby Bundles (Bundler) and RVMs as well? Or should I back those up separately?

    • http://gauravmali.com Gaurav Mali

      nvm, I can back their respective .folders.

  • http://blog.peterfisher.me.uk Peter Fisher

    This is excatly what I was looking for. Im also thinking of autmating the copying of /etc/ to backups for the future

  • Richard

    Great work Phillipe. Thanks to your guide, even though I have stubby fingers and no magic linux powers, I have been able to take repeated copies of my desktop computer to my laptop. I have done this for several years now, letting me take a clone of my desktop with me on location, it’s really changed my life for the better. Recently I am using “apt-get” to complete step 3 with later versions to replace “aptitude” but even I can do that.

    Thanks for your help.

  • Ray Manta

    I had so much fun with my Ubuntu to the point that I’m going to bring it when I move countries (and computers, I’m leaving my desktop at home). This will be very useful to me. Thanks.