Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

Using QEMU Ubuntu Tutorial

by Mike Levin SEO & Datamaster, 07/21/2010

NOTE: Want a QEMU Tutorial? Download Levinux and run Linux server with a double-click from your Mac, Windows or Linux desktop with no install. Lesson #1: software that doesn’t require an install is easy to start using.

I’m tempted to walk you through some of the different devices to be used as a micro-server. Those would include the SheevaPlug, TonidoPlug or GuruPlug. These are all ARM-based plug computers that cost around $100 and run Debian Linux just fine. Other options include wifi routers you may already own, such as the massively popular Linksys WRT54G, inspiration for the OpenWrt project, that gets Debian running on these ridiculously cheap MIPS-powered boxes. But for the sake of putting off any monetary costs at all until a sort of indoctrination has occurred, we will focus on virtual hardware for a moment.

Virtual hardware is a sad excuse for a shankserver, for tons of reasons. Folks might try to tell you otherwise, but as far as running your own server, the best I can say is try it. I’m about to show you how to set one up, so the test will be easy. You will have to choose a host machine–probably your main desktop. Then you will have to allow those precious resources to get the virtual machine running. You will then need to get and keep it on your local area network and mapped to an Internet address. Then you will have to keep it running all the time, including restarting after reboots.

So why start with virtual hardware at all? Because it’s a no-investment way to get started and understand some of the fundamential issues. Crawl before you can walk, and all that. Also, I’m going to help make a virtual machine that can be pulled up under Windows, OS X or Linux, which in itself is a very neat trick. Most virtual machines are tied to the hardware platform they’re created on, but after extensive use of VMWare, VirtualBox, VirtualPC and Parallels over the years, I’ve settled in on humble open source QEMU, which while slower, allows you to pull out a USB keychain and plug it into almost anything and get your VM running. Read the Wikipedia page http://en.wikipedia.org/wiki/QEMU

As far as emulators go, QEMU is definitely the road less travelled. Even the place you have to go to download the pre-compiled Windows version is a little scary. http://homepage3.nifty.com/takeda-toshiya/ But it’s worth it. I’m going to build up this blog with small posts like this. Eventually, I hope to organize it into an clear guide. But until I get there, it’s best to quickly write, commit, write, commit. That way, I’ll at least get something of a blog built up here.

So go ahead and download the QEMU zip file. At the time of my writing this, it’s a file named qemu-0.12.2-windows.zip that is 7,336KB large. That’s version 0.12.2. I had earlier been working from version 0.10.6 just fine. I’m doing this step on Windows XP right now, but it could be done on OS X, with the Q program. Q appears a little out-of-date (circa 2008) but works fine.

Also, go ahead and download the Ubuntu Server ISO image from http://www.ubuntu.com/server/get-ubuntu/download I’m choosing the 32-bit version for compatibility.

Once you’ve downloaded QEMU and unzipped it into a directory, cd into that directory from a command line, and execute the following command to make a hard drive:

qemu-img create -f raw harddrive.raw 500MB

It will tell you it succeeded with a line like:

Formatting ‘harddrive.raw’, fmt=raw size=524288000

Now, copy the ubuntu-10.04-server-i386.iso file (or whatever yours is) into the same QEMU directory. For the sake of easy typing, you might want to rename the file to something easier to type, like ubuntu.iso. Now is the moment of truth. Initiate the Linux install by typing:

qemu -hda harddrive.raw -cdrom ubuntu.iso

And this is it. This is the magic moment where you start to break free of your Windows habit, and all other proprietary software habits.

Using QEMU Ubuntu Tutorial

To escape out of a QEMU screen and get your pointer back, press the left Ctrl+Alt keys simultaneously.