how to run windows in linux via qemu?


There are lots of operating system virtualization, you have the option to use an open source or a proprietary software depending on your needs,familiarization and most significantly, budget. People have several reasons why they use virtualization, and the most common is for testing purposes wherein they can test different configurations from different OS. Another reason is to security and consolidation, where they can save money and electricity.

Some of the popular open source linux virtualization softwares are OpenVZ, Xen, KVM and VirtualBox. You can also try proprietary softwares such as VMWare and Citrix XenServer, a commercial implementation of Xen.

For this tutorial, I’ll be covering Qemu, another virtualization program and here are the steps:

Prerequisites and componets:

a. windows installation in ISO format  ex. WinXP ( you can create ISO format using 3rd party programs like magic ISO, power ISO etc.)

b.process emulator (QEMU)

c. any Linux distribution (I’ll be using CentOS 5 for this demonstration)

d. Linux/Unix administration skills

A. Installing qemu

# yum install qemu

# qemu-img create winxp.img 4G

C. install the windows

#qemu -hda winxp.img -cdrom win.iso -m 256 -boot d

B. Create windows image by creating a virtual drive ( sample demo is creation of 4 GB virtual drive named winxp.img)

this will tell qemu to use the virtual disk as the hard disk, which drive to use as the cdrom  and to allocate 256 memory for the virtual pc
Qemu will boot up and you will be in windows install (line the normal windows installation)

Tips: CTRL+ALT= when you need your mouse
ALT+CTRL+F = toggle fullscreen

This is a sample screenshot:

qemu

qemu

After finished the windows installation, you can just close the Qemu Window

D. Testing the newly installed windows under Linux

#qemu -hda winxp.img -m 256 -boot c

NOTE: This procedure is being done in your Linux X environment e.g. GNOME , KDE etc.

CHALLENGE: How to emulate Windows in Linux OS when you only have ssh access to the remote server, no X or GUI?

SOLUTION: Create a windows image in your local test machine then upload the image file.
Tip: Since an image file will be 4GB in size, you can split the file into several pieces via your favorite archiver. I used Winrar for this one, then upload those files in queue ( Bandwidth matters)

* Since image is already uploaded on the server, the only thing to do is to emulate and redir port 3389 for RDP purposes.

sample:

# qemu -hda /home/test/winxp.img -m 2000 -boot c -redir tcp:3389::3389 -nographic

You can now access your windows via RDP… Start> Run..> mstsc

then input the server IP address

enjoy! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: