Sponsored Link

If you want to create a system that is similar to a different system you have already set up, it can be difficult to remember each and every package you had installed.This method works best when you are exporting to and importing from the same distribution and, specifically, the same releasefor example, exporting from Ubuntu Dapper to Ubuntu Dapper or ubuntu edgy to ubuntu edgy.

Ubuntu uses the APT package management system which handles installed packages and their dependencies. If we can get a list of currently installed packages you can very easily duplicate exactly what you have installed now on your new machine. Below is a command you can use to export a list of your installed packages.

sudo dpkg --get-selections | grep '[[:space:]]install$='| awk '{print $1}' > installedpackagesNow you should end up with a file called “installedpackages” which consists of a long list of every package your currently have installed.

The next step would be to tell the clone machine to install each of those packages. You’ll have to copy that file to the clone machine (via network, usb drive, email, etc) and also make sure to duplicate the /etc/apt/sources.list file. Without the same access to repositories it may not be able to find the packages.

To tell your system to use the previously exported package list use the following command (after making sure to also clone your /etc/apt/sources.list file)

Does this copy the packages or just makes a list for apt to go off of. I have a desktop with no way to access a network and a laptop with wireless and obvious mobility advantages. Is it possible to clone my installed packages off my laptop onto desktop with this method?

Can I do this and copy my home directory to the new computer? I am trying to get data, configurations, and everything. I can’t use partimage or anything else because I have a single broken package that has killed dpkg.

this saves your entire hard drive (lvm supported) to a dvd as a bootable iso image. just use k3b or whatever to burn it. just make sure you create /storage/mondo/ISO and that you grab the 2.2.6 version of mondo and mindi from mondo rescue, not the repos. now you have a bootable dvd. i do this for all my laptops when i want to get crazy so i can just reimage my laptop rather than undoing all my changes.

This is a handy first step in cloning a system.
Don’t forget, you’ll still have to copy across users/passwords, hosts, users profiles, their home directories, email, log files, any and all config data your packages may need and probably a ton of other stuff I’ve forgotten.
This is far from a one-line machine cloning solution

A suggestion… You probably get the quotes wrong? Allan’s example (as it has ended up on the web page) does not use the right quotes. After awk, it must be a single quote, and just before the > must be single quote.