Lately I came across a very common problem: how to install debian in virtualized environment automatically. You can always do that by hand, manually. Download Debian Netinstall image, and go through all installation steps. After searching I found out a useful tutorial on the web: Creating a KVM virtual machine using debootstrap. However, it's still a few steps which needs to be done. Can't we do that better? That's why I prepared bash script that automatizes the debootstrap process.
The script is very simple. It replicates all the steps mentioned in the tutorial. You just have to invoke one simple command and there goes all the magic ;)
What to do:
Create virtual machine disk image (eg. using qemu-img):
Download the script:
Wait a few moments. At the end of the process you will be asked for root password.
If everything goes right, you should see SUCCESS.
Example installation log: Show
Script assumes that you use the virtio block device. If you need differently, replace all s/vda/sda/g.
Script works with any storage supported by qemu: lvm, raw, qcow2, vmdk
Script creates two partitions:
Script configures one ethernet as dhcp-client.
Script can be reconfigured to create Ubuntu image. Just change hardcoded mirror URL (http://ftp.pl.debian.org/debian) to any Ubuntish mirror and specify valid release (eg. hardy).
You can install additional packages during debootstrapping:
nbd kernel module: it must be loaded with max_parts=16
v.0.1. (2.06.2013) - Initial release