Tips&Tricks

How to configure Qemu-KVM

qemu

At times, it is useful to have a deployed infrastructure of N machines to see how networking works, how the cluster shards on nodes, etc.

From time to time I remember how I did it last time. But this time I decided to just write this simple set of commands, so as not to remember, not to look.

Install the packages:

sudo aptitude install qemu-kvm libvirt-bin virtinst virt-viewer 

if you use Ubuntu / Debian / Linux Mint and other Debian-based.

Create a folder that will contain images of virtualos.

mkdir ~/virt && cd ~/virt

Create an empty image.

fallocate -l 8192M guest1.img

Run the installation in the desired image, the desired iso file:

sudo virt-install -r 512 --accelerate -n deb1 -f guest1.img       -- 
cdrom ~/Downloads/debian-testing-amd64-lxde-CD-1.iso

I needed Debian this time, but I can also install Windows if fate forces me to.

Now you can administrate it with:

sudo virsh