Duplicate linux box.

Say you want to have several machines to be exactly alike that run Debian or Ubuntu Linux.  You will want to set up the first machine the way you want it.

Now we need to get the list of packages that have been installed (software installed via ppa's may still have to be setup manually.)

$ dpkg -–get-selections > installed-software.log

installed-software.log:
[code]
...
...
x11-common                    install
xauth                        install
xfonts-encodings                install
xfonts-utils                    install
xkb-data                    install
xml-core                    install
xz-utils                    install
zlib1g                        install
[/code]

You could probably edit this file to add any last minute packages to be added or removed.




Now you want to do a minimal install of Debian. You will want to uncheck the graphical environment when tasksel asks you what packages you want installed. That will make the rest of the install go quickly.

After the reboot of the finished install, you will want to be able to have ssh and scp file capabilities so on the destination machine so install the ssh programs. (note: on Debian you will also have to install as root sudo and include your user name in /etc/sudoers).

$ sudo apt-get install ssh openssh-server

Now you want to copy the installed-software.log file from the setup machine to the new destination machine via the network.

$ scp  installed-software.log [destinationmacineipaddress]:~/.

On the destination machine  you need to confirm the repositories are accessible with

$ sudo apt-get update

Now you need to let the destination machine aware of the installed-software.log.

$ dpkg -–set-selections < installed-software.log

And finally you want the system to do the update with the software list.

$ apt-get dselect-upgrade

This will install the duplicate software.

to make sure the machine is update you will want to:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

If there are any issues you can always issue the command:

$ sudo apt-get upgrade -f

That should be it for the software install part. if you tweaked  any configuration files, those will be needed to be duplicated over to the new machine also.

Done.

Just wanted to clone drive to drive locally. Install the destination drive as the second drive (/dev/sdb). Boot with a live linux cd/dvd:

$ sudo fdisk -l

To make sure which drive is which.

$ dd if=/dev/sda of=/dev/sdb


To keep and image for later:

dd if=/dev/hdb | gzip -c > /image.img

Then later to restore the image

gunzip -c /image.img.gz | dd of=/dev/hdb


Just want to clone the system over the network and do not have any fancy cloning software. no problem. Just boot with a live or minimal linux distro and type:

$ sudo nc -l -p 9901 | dd of=/dev/sdc

That will start the destination machine listening to receive data. Then boot with a live cd on the destination machine:

$ dd if=/dev/sda | nc ipaddressofhostmachine 9901

i.e. dd if=/dev/sda | nc 192.168.0.99 9901


Some people might use:

$ sudo nc -p 2222 -l |bzip2 -d | dd of=/dev/sdb

$ sudo bzip2 -c /dev/sda | netcat hostipaddress 2222

i.e. $ sudo bzip2 -c /dev/sda | nc 192.168.1.100 2222



That is it now for cloning. Update: You can always use clonzilla live cd or clonezilla/drbd server also.

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice