Binary Revolution Forums: HOWTO Qemu - Binary Revolution Forums

Jump to content

Welcome to Binary Revolution Forums

Welcome to the Binary Revolution Forums! You are a guest and are welcome to browse our 7 public forums at the top of the list without registering. All other forums are restricted to registered users only and will give you an "unauthorized" message if you try to browse them. However, if you Register or Sign In (ABSOLUTELY FREE and PRIVATE) you will be able to access many more sections of the site that are reserved for registered members and have lots of other benefits such as bypassing those annoying ads.

  • NO ADS! All of the ads are for GUESTS ONLY!
  • The annoying guest message (this very one) at the top of every page will go away.
  • Access our private messaging system to communicate with other users.
  • Start new topics and reply to others instead of just reading.
  • Subscribe to topics and forums to get automatic updates on watched threads.
  • Add/view events to our community calendar.
  • Customize your profile and see your statistics.
  • Change your preferences such as choosing layouts and tweaking your settings.
  • Contribute your site to our database of links.
  • Access our Gallery and all of its features (instead of just viewing thumbnails) including uploading images of your own.
  • Build up your reputation using our reputation controls.
  • Once again: NO ADS! All of the ads are for GUESTS ONLY! It is all free so Register Now!
Guest Message © 2012 DevFuse
ANNOUNCEMENTS & NEWS:


ANNOUNCEMENT: BinRev is now proud to be hosted and affiliated with lunarpages! See the announcement at the top of the forums for more details.
ANNOUNCEMENT: Follow us on twitter: @binrev @stankdawg

NOTE 2012-03-12: The forums are pretty neglected these days. I still stop in and clean up SPAM every once in a while and ban asshats as the need arises but you MUST USE THE REPORT FEATURE to notify the moderating team! We will not know that there are problems if you do not report it.

-- StankDawg

Subscribe to CETX_var_log        RSS Feed
-----

HOWTO Qemu

Icon Leave Comment
Qemu is a free emulator for Linux, and it is powerful enough for everyday use with new features popping up with each new release.I'm not virtualizing to serve thin clients or anything fancy like that; I'm just doing the everyday hobbyist kind of emulation that one wants to do when one wants to try out the beta of an upcoming release, or when one wants to first with a distro that is not their own, or when one is doing a tutorial and needs a fresh install for pure screenshots, or whatever.Qemu at its best, IMHO, is a Command Line application. There is a GUI front-end called Qemu-Launcher. I find it unnecessary, partially because the command line options are powerful and quick enough to get your emulated host going, and partially because Qemu-Launcher doesn't seem to actually launch a host for me on my system. Not sure why -- but I'm not going to bother troubleshooting something that is redundant anyway. I find the command line interface quite enough to launch an emulated client.First thing's first: you need to install Qemu. This should be a simple su -c 'yum install' or a sudo apt-get away.
bash$ su -c 'yum install qemu'
Once that's finished, you can do a "man qemu" to see all the options that come along with qemu...or check out the qemu site for complete documentation.One of the first things I do is create a little fake harddrive for Qemu to use as its emulated harddrive. That is, if you want to actually install a distro (as opposed to just running it off of the cd) then you'll need a container file that Qemu can take over, pretend like it's a real harddrive, "format" and install onto. Since this is just a sandbox, I figure a 4gb image is quite enough:
bash$ qemu-img create -f qcow2 qEmu.qcow2 4G
Here's what we just did:qemu-img create # invokes qemu-create and tells it to create a new file-f qcow2 # the image format; qcow2 is qemu's native format; there are other choices if you're going to export this image to some other virtualizerqEmu.qcow2 # this is the name I've given my disk image...you can call yours anything you like; fedora11.qcow2 or debianSqueeze.qcow2 or whatever4G # the size of the container...give it more or less space as desiredNow, I typically use Qemu with an actual cdrom in my disc drive, because the distros I am test-driving are almost always the ones that come on the bundled disc in Linux Format or Linux Pro or Linux Identity magazines. Here's the one-liner for such an endeavour:
bash$ qemu -M pc -cpu qemu32 -cdrom /dev/cdrom -boot d -drive file=~/qEmu.qcow2
Switch by switch:qemu # invokes qemu-M pc # defines what kind of Machine you want to emulate; type -M ? to see a list of choices-cpu qemu32 # what kind of cpu to emulate; type -cpu ? for more choices. qemu32 is the one you'll probably want if you're trying out a modern OS-cdrom /dev/cdrom # this defines the location of your cdrom drive. Can be an .iso image saved on your harddrive, too!-boot d # where to boot from; the "d" option tells qemu to boot on CDROM rather than Network or Harddrive-drive file=~/qEmu.qcow2 # our qcow2 image, remember?After you issue the above command, you should see a window pop open, revealing your emulated host. First it will load its emulated BIOS and then it will boot from the actual cdrom. You can install the distro onto the harddrive image, which the emulated machine will believe is an actual harddrive (you'll know it's not your real harddrive by the size of the drive, if nothing else), or you can just run the distro as a Live distro if available.What if you didn't get a dvd with a magazine, but had just bit torrented the latest iso of a hot new release? That's quite similar; first, of course, have the iso on your harddrive. Have a qcow2 image established. And then run qemu thusly:
qemu -M pc -cpu qemu32 -no-acpi -cdrom ~/Download/F11-Preview-i686-Live/F11-Preview-i686-Live.iso -boot d -drive file=~/qEmu.qcow2
You might notice that I've added a -no-acpi flag here, simply because I've found that Fedora 11 won't boot without it. In an emulated machine, I'm not sure whether you ever really need acpi anyway, so it's probably a safe thing to turn off. Aside from that, the procedure is the same except that instead of point -cdrom to my /dev/cdrom I'm pointing it to the iso file.Some other important options you might want to define:-m 512 # allot 512mb of RAM to the emulated pc-usb # enable usb functionality in your emulated pcCheck the man page or just type "qemu" without any options for a full list of functions. There are a few video and sound and network settings that you might want to play around with.That's pretty much it. Emulation that is free and easy!

0 Comments On This Entry

 

May 2012

S M T W T F S
  12345
6789101112
13141516 17 1819
20212223242526
2728293031  

Recent Entries

Recent Comments

Search My Blog


  • Time Now: May 17 2012 05:06 AM