LKBEN11098: Howto clone a debian system on the same platform (e.g. 64-bit)
Symptom
You want to install a system with exactly the software from another system
Cause
Nice to show windows users, they will run away and cry
Solution
This is not cloning a system like having exactly the same one! This cloning is more like installing a system with exactly the same software. The configuration will be a different one and the data will not be on the cloned system.
You can think of a nice and quick form of installation which will just take the software from PC1 (or server1) and install it on PC2 (or server2).
This works with all Debian-based systems like ubuntu, kubuntu, knoppix and all debian systems.
First thing you need is the installed packages on the first PC.
To get a list of all selections you can type in the following command:
dpkg --get-selections
This command will show all the packages that you have installed on your machine. This can be directed in a text file.
To be honest, I do not use this command but the following one:
dpkg --get-selections \*
This command will also uninstall software you purged from you master PC. In my case the difference is:
> popularity-contest purge
and your clone PC will be more like the first one. Believe me, on heavily used systems, the difference can be much more.
dpkg --get-selections \* > ~/softwarelist.txt
This file has to be copied to the computer you want to clone. This computer needs a bare debian installation on it to be able to read the file and get it into the debian dpkg command.
On the clone system you use the following command to get the list of software in your dpkg:
dpkg --set-selections < ~/softwarelist.txt && sudo apt-get dselect-upgrade
Wait for that last command to finish, which might take a while and your system is installed.
Please note that this might not be usefull between different platforms. e.g. 64-bit versus 32-bit because some packages are not named the same! I one used this technique to clone to a different platform and had to manually correct quite a bit. (but it was still much faster as doing everything manual)
Disclaimer:
The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!About the Author
Author:
- Keskon GmbH & Co. KGWim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.