Qemu
From FrugalWiki
Dansk – Deutsch – English – Español – Français – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Polski – Português – Română – Slovenský – Suomi – Svenska – Türkçe – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어
Contents |
Qemu
QEMU is a processor emulator that relies on dynamic binary translation to achieve a reasonable speed while being easy to port on new host CPU architectures.
In conjunction with CPU emulation, it also provides a set of device models, allowing it to run a variety of unmodified guest operating systems; it can thus be viewed as a hosted virtual machine monitor. It also provides an accelerated mode for supporting a mixture of binary translation (for kernel code) and native execution (for user code), in the same fashion as VMware Workstation and Microsoft Virtual PC.
QEMU can also be used purely for CPU emulation for user level processes; in this mode of operation it is most similar to Valgrind.
One feature exclusive to QEMU is that of portability: the virtual machines can be run on any PC, even those where the user has only limited rights with no administrator access, making the "PC-on-a-USB-stick" concept very real. Similar applications exist (such as MojoPac) but they currently require administrator rights to run, making them useless in areas such as public libraries, internet cafes, and so on.
Installation
Acceleration module
KDE GUI
GUI to change media
QEMU_Quickstart
Foreword
QEMU is a flexible multi-platform emulator. It is developed by Fabrice Bellard, and its core technology is used widely in other solutions (KVM, Xen, VirtualBox...) The original documentation may not always be available on the official site, but the manuals are quite straightforward.
This HOWTO is mostly about running Microsoft(R) Windows(TM) in QEMU under a Frugalware Linux host, but there is a wide variety of host/guest combinations available.
Please consider that there are several other solutions available in Frugalware for running virtualized systems, I chose QEMU because I wanted to solve a simple task with a simple tool.
This is just a little overview; there are a bunch of options, so please read the manuals for a complete reference!
Installation
Hint: The whole process will not require root privileges on the host OS except any network configuration (bridge, etc) in the host.
The regular qemu package depends on sdl, zlib and alsa-lib. The kernel accelerator driver (kqemu) is optional but it increases performance.
Create qcow image
You only set the maximum image size; it can expand dynamically later. The guest OS will see the full image size, regardless of the actual size of the QEMU image!
There are several formats, qcow/qcow2 seems the best, you can even encrypt them with AES.
Boot the install device
You can boot an image file as well, virtually any device. I used my USB DVD-RW here, and booted a Windows 2000 install CD.
The manual is quite usable if you need explanation. '-m 256' is the memory QEMU will use for this session - in practice, it will be a little more, around 300MB.
You should see a window open very quickly. The install speed is quite acceptable, however, it cannot be compared to the speed of the non-virtualized installation.
Complete the guest OS installation
You can do it in the regular way.
Boot the installed OS
The simple way:
Passing more parameters (example):
The allocated memory is 128MB by default, this can be overridden with the -m option.
Setting up network
By default, the '-net nic -net user' option is used. QEMU itself will act as a bridge between the host and the guest, providing DHCP services for the client. It means you can use DHCP on the client. In my case, I had nothing to setup on the client, it was ready for use.
Note: Of course if you have a firewall configured in the host Linux, it will filter any traffic between the LAN and the guest OS. From the perspective of the host, the entire guest network activity is covered by the QEMU process.
With the -smb option, you can use the built-in SAMBA server function to provide easy access to a directory of the host OS. You must install the 'samba' package because QEMU requires the smbd binary. Again, the firewall settings on the host do not matter here. Read more in the qemu manual about configuring the guest part.
Quick hints on QEMU shortcuts
- Ctrl Alt - release QEMU controls
- Ctrl Alt f - enter/quit full screen
I must mention that the keyboard map used in Linux will be transferred, i. e. for example if the logo key is not defined in Linux, you will not be able to use it in Windows as well.
Notable options
- -full-screen Start in full screen
- -snapshot Don't write to the image, only to temporary file
- -m Megs Allocated memory in MB (default = 128)
- -daemonize
- -usb Allow USB
- -smb Directory Export this directory to the client (see the manual for details)