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.

Entries (RSS)
Follow me on Twitter
Github repos
LinkedIn profile
Photos
Videos
27 Comments
Exactly what I was looking for. vey helpful. Thanks
……
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 :)
Does this happen when you run
sudo aptitude install `xargs ~/pkglist`? If so, what doesxargs ~/pkglistdisplay?I think you should use `xargs -a ~/pkglist`
Thanks, you’re suggestion was the only one that worked on my 10.10 install in the slightest.
I’m happy that this tutorial is still working on 10.10.
> sudo aptitude install `xargs ~/pkglist`
OMG, that will take much time. Better do the following
cat ~/pkglist | dpkg –set-selections
apt-get dselect-upgrade
It should be sth like:
cat ~/pkglist | awk ‘{print $1 ” install”}’ | dpkg –set-selections
apt-get dselect-upgrade
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
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.
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,
By the way thank you for this post, and I am running ubuntu 10.04,
cheers,
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.)
Step 1 doesn’t work for me, I got “illegal variable name” error.
I have 10.04
never mind, I wasn’t running bash…
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
I would rather leave /etc alone unless you edited files yourself. I guess you should use “sudo cp -r” :)
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
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.
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).
Will this transfer Ruby Bundles (Bundler) and RVMs as well? Or should I back those up separately?
nvm, I can back their respective .folders.
This is excatly what I was looking for. Im also thinking of autmating the copying of /etc/ to backups for the future
Hey,
Someone stole your blog post…
http://panic83.livejournal.com/22114.html
Boris
Hello! This is my 1st comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading through your articles.
Can you recommend any other blogs/websites/forums that cover the same subjects?
Thank you so much!
One Trackback
[...] [...]