Ubuntu – How to migrate the whole system to a new machine


I use ubuntu to deal with daily job. Now I buy a new laptop, and I want to migrate my whole system(programs, packages, data, settings, etc) to the new machine.

I know I can copy my home folder to new machine and I will get (almost) all data and settings. But is there a safe way to copy the whole system? Or it's a bad idea?

Best Answer


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

Extract from:


Related Question