Friday, November 23, 2012

Windows as Guest in Linux with minimal Software

You have Linux (any distribution, commands below for Debian/Ubuntu) and need to do just one tiny thing with Windows? Therefore you don't want to install thousands of packages and third party packages?
Then follow this quick guide made out of 4 steps and one package you need to install!

Fist install the kvm engine typing this into a terminal:

$ apt-get install kvm

Afterwards change into the directory where you want your virtual harddrive image to be created. The next command will create a *.img file with a size of 8GB.

$ dd if=/dev/zero of=vm_disc.img bs=1024k count=8000

Once this is done, you can boot up your virtual "machine" for the first time - of course with the Windows Install CD "inserted" into your device:

$ kvm -m 2048 -cdrom Windows_XP.iso -boot d vm_disc.img

Remember that you might have to exchange the name of your install-cd image.
Reading the manual of kvm (terminal command: man kvm) I found some nice features like graphical output to a vnc stream, using a specific sound-card, forwarding usb devices,... I am always using following command to start my virtual machine:

$ kvm -m 2048 -hda vm_disc.img -vga std -soundhw ac97 -usb -usbdevice tablet -smp 2 -vnc :0

Afterwards I connect to the vnc stream (localhost) using the "Remote Desktop Viewer" application.

Have Fun!

No comments:

Post a Comment