QemuEmulator

Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2005-05-28 20:40:09
Size: 4998
Editor: adsl-213-190-44-43
Comment: imported from the old wiki
Revision 5 as of 2008-08-06 16:28:51
Size: 69
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= How To - Install Ubuntu on the Qemu emulator =

== How To - Install Ubuntu on the Qemu emulator ==

'''Qemu (http://fabrice.bellard.free.fr/qemu/) is a hardware emulator, capable of full emulation of x86 and partial emulation of PPC, Arm and SPARC architectures.'''

Publish date 09-2004; Version=?

This How To chronicles the steps taken to get the Ubuntu preview release up and running under this emulator.

Why would you want to?

Qemu emulates everything, including the cpu, so it is a lot slower than the host system. You will not get much benefit of most of your hardware either. But it is a pretty good way of testing a distribution without having to repartition your drive or set up new hardware. It is also quite fun, in a geeky sort of way :)


== Preparation ==

    * First, of course, you need to get and install qemu. Fortunately, this is quite easy. For FC2 (the OS I'm currently running on), there is an apt-getable package in Dag Wieers repository. The qemu site has a binary package as well.

Unlike some other virtualization systems, like VMware, there is no need for kernel modules or anything; it runs just fine in userland.

    * Download the Ubuntu iso file - no need to actually burn it to a CD though.
    * To get networking going for your emulated system, you need to set it up. The "linux-test" add-on tarball on the qemu site has a one-line script to put among your network scripts; I just found it easier to run the one-liner manually before starting the emulator:

      sudo /sbin/ifconfig eth0 172.20.0.1

    * We also need a virtual disk for our system. You make a disk simply by creating a file of the size you like, something like this:

      dd of=ubuntuimage bs=1024 seek=10485760 count=0

This will create a 10Gb file to use as a disk. That is actually overkill if you want to just try out the distribution; the whole install takes around 1.5Gb so a file of 3-4Gb would be plenty.


== Installation ==

We are ready to run the install.This is how to do it:

qemu -hda ubuntuimage -cdrom warty-i386.iso -m 192 -boot d

    * We set hda to be our empty disk file, set the cdrom to actually be the ubuntu iso file, set the amount of memory our virtual machine has to 192Mb, and tell it to boot from the cdrom.

A word of caution: giving too much memory to the virtual system will make your real machine start swapping, which will slow things down a lot. On the other hand, giving it too little memory will make the virtual machine start swapping, which will slow things down as well. Moral: have a lot of memory on your host system.

The installer should be booting at this point. I ran through the dialogues, pretty much choosing the defaults at every turn. The installer detected the virtual network properly and the install went without a hitch.

    * Now, at the end, it tries to reboot the machine. This will fail.
    * Exit the emulator (type "quit" in the emulator console), then rerun:

      qemu -hda ubuntuimage -cdrom warty-i386.iso -m 192

Note that we have removed the boot parameter so it will boot ubuntu from the virtual hard drive, not from the cd.

    * Follow the directions from the installer and create a user. The installer will then fetch updates and add additional packages.This takes a long time.
    * At one point, it will register all documentation for the help system.

This will take an inordinate amount of time; in my case it took over an hour. So don't worry, the install has not gone wrong. Relax, have a coffee, surf the web.

    * X setup is very easy; the only question is what video modes to support. Leave this at the defaults; the virtual video hardware does not support higher resolutions than those already set.

== Usage ==

First of all, running an OS on emulated hardware is not screamingly, insanely fast. Don't expect to run anything demanding on this system, other than for testing purposes. My machine is a 1.7Ghz Pentium Mobile, and Ubuntu is running - or strolling - rather sedately.

That said, even on this fairly underpowered hardware, it is certainly fast enough to test the distribution, perhaps install some packages, see how it all fits together.

This is also a good tool for paranoid system management. Qemu can have a read-only disk image with a separate write-back file, so one use would be to test installation of intrusive packages (or test your own packages to make sure they don't break the system) without actually touching your real system.

If it turns out it breaks the system, just remove the write-back file and it never happened.

From DavidJohansson Wed May 25 12:47:46 +0100 2005
From: David Johansson
Date: Wed, 25 May 2005 12:47:46 +0100
Subject: qemu-img
Message-ID: <20050525124746+0100@https://www.ubuntulinux.org>

It's a bit easier to qemu-img, that comes with the qemu package, to create the image instead of dd:
  qemu-img create my.img 3G

creates a 3Gb large image by the name 'my.img'.
#REFRESH 0 http://help.ubuntu.com/community/Installation/QemuEmulator

Installation/QemuEmulator (last edited 2008-08-06 16:28:51 by localhost)