Difference between revisions of "QEMU"
(First draft) |
(No difference)
|
Revision as of 16:54, 22 April 2009
The qemu emulation environment lets you run a variety of software on your computer in a protected environment. This includes software that is incompatible with your operating system. See also VMWare and WINE.
Use Cases
- Windows: Run Sugar, School Server, Linux more generally (for example, as a method for shifting from Windows to Linux)
- Macintosh: Run Sugar, School Server, any Linux
- Linux on Linux: Fedora on Ubuntu and the like
- BSD does not have a version of qemu
You can run almost any version of Sugar and the XS school server in qemu, including daily builds, releases, Sugar on a Stick, sugar-jhbuild, and whatever else we come up with. As we port Sugar to other computer architectures, such as ARM, this will become increasingly important, so that developers and testers do not have to purchase one of each.
Getting Started
One of these commands will work in most Linux distributions, using yum for Red Hat-style packages on Fedora and related distros, or apt-get for Debian-style packages on Debian, Ubuntu, and related distros. Otherwise, consult system documentation for package installation or installing from source.
- yum install qemu
- apt-get install qemu
There are full-screen text and windowed graphical package manager clients such as aptitude and Synaptic to assist you.
You should install an accelerator if at all possible, that is, if your processor supports virtualization in hardware. To find out whether it does, run the command
$ egrep ‘(vmx|svm)’ /proc/cpuinfo flags : fpu vme de pse tsc msr pae mce cx8 … vmx … flags : fpu vme de pse tsc msr pae mce cx8 … vmx …
Some of the output is truncated in this example, and your results will probably differ elsewhere.
There are two sets of flags because the processor used for this example has two cores. You would be looking for the “vmx” flag for an Intel-VT and the “svm” flag for an AMD-V processor.
This test succeeds if you get any lines of text as a result, and fails if the result is blank.
Installing KVM on Ubuntu is completely automatic, using
$ apt-get install kvm
The installation script gets the source code, compiles it into your kernel, and configures it to Just Work[TM]. Consult system documentation for other Linux distros and other OSs, or if you want to install kqemu instead. Either kqemu or kvm will give you something like a ten times performance boost, according to some sources. Your mileage may vary.
HOWTO
You can run qemu on a variety of disk images, including .iso (CD image format), .img (raw disk images), .qcow2 (qemu Copy-On-Write).
Minimum Command
$ qemu -hda hda.img
or
$ kvm -hda hda.img
where you will substitute the name of your .img, .iso, or other disk image file.
This may well boot your image and run, letting you log in and try out your software, assuming that your image file is valid. Depending on what your purpose is, you may prefer to add other options. For full details, consult the qemu documentation. Here are some examples.
Virtual Hardware
Set memory size, sound, networking, second hard drive, CD
$ kvm -m 512 -soundhw es1370 -net user -net nic,model=rtl8139 -hda hda.img -hdb hdb.img -cdrom cd.iso
Install School Server
$ kvm -m 512 -hda hda.img -cdrom XS.iso
Follow on-screen instructions. The process is almost completely automated. You will then have to set up networking to make this image accessible to jabber users and the like.
Command Line
This is actually a full terminal interface. It is good for remote servers, where you don't want to run X (too unstable) but you want to be able to log in with ssh to administer the system. This also lets you run full-screen text mode applications such as aptitude and Midnight Commander. Curses is named for the full-screen terminal cursor, which can be anywhere in a 24 × 80 field.
$ kvm -m 512 -curses -hda hda.img