Skip to main content

Virtual machines

I finally tried to give kvm a try on a core 2 duo laptop. And what great fun it is. :D
Following the instruction from the great arch linux wiki, I installed the qemu package. Once I've done that I added myself to the kvm group:

# gpasswd -a abdza kvm

And then I loaded the kvm & kvm-intel module:

# modprobe kvm
# modprobe kvm-intel

To change the new kvm devices to the kvm group I modified the udev rules (had to create the file) at /etc/udev/rules.d/65-kvm.rules:

KERNEL=="kvm", NAME="%k", GROUP="kvm", MODE="0660"

I downloaded some cd iso's to boot install into the "virtual machines". First I tried ubuntu. Once the iso has been downloaded I had to create a virtual machine image with:

# qemu-img create -f qcow2 ubuntu 4194304

Not sure yet what all of that option is for but that basically would create an image named ubuntu with hard disk size of around 4GB. So I had to 'boot' that image with a cd (the iso image downloaded earlier):

# qemu-system-x86_64 --enable-kvm -hda ubuntu -m 512 -cdrom ~/Downloads/ubuntu-9.04-desktop-i386.iso -boot d -vga std -net nic,vlan=1 -net user,vlan=1

That would boot the machine with the cd "inside" it. It would run the live cd and allow you to install ubuntu on it and everthing. Then once it's already installed you can boot it without the cd with:

# qemu-system-x86_64 --enable-kvm -hda ubuntu -m 512 -boot c -vga std -net nic,vlan=1 -net user,vlan=1

Notice that the boot flag has changed to c. Now with the current `-net nic,vlan=1 -net user,vlan1` you will already get normal internet access from inside the virtual machine. But that virtual machine would not be able to access any other machines on your network and no other machines on your network can access your virtual machine neither. Reason being is that it is actually on it's own virtual network provided by qemu. I've read that you need to set up bridge and tun/tap to be able to make it appear on your normal network. Haven't tried it out yet. That would be for the next part.

Just a little side note. Whenever you click inside the virtual machine display, the mouse would be 'captured' by that machine. To release it like normal press ctrl+alt. That would release the mouse. Sometimes you might even like to view the machine full screen, to toggle that just use ctrl+alt+f.

Another small note, 4GB isn't enough to install Fedora 11. For that I created an 8GB virtual machine.

Another small note (my.. getting lots of small notes nowadays.. :P). To use sound in the 'virtual machine', add:

-soundhw all

to the options. Can even view and listen to youtube from a 'virtual' ubuntu.. :P

Comments

izhar firdaus said…
just what ure trying to install in that fedora to the point that 4GB is not enough ???

i can install fine with less than 2GB disk ..

btw, u may want to look at virt-manager in Fedora :P.
abdza said…
most probably I didn't do something right when installing fedora because I can't partition the hard disk manually and so just choose use all. But then it would say that it cannot install to a hard disk with less than 3GB (which is strange because it detected it's 4GB). anyhow, using 8GB works.. :D

Popular posts from this blog

Dell Inspiron Mini 9

Yesterday went to Low Yat to buy my cousin a sub RM 1500 notebook. Of course with that kind of price tag it would have to be a netbook jelah. Anyhow, I was short on time so I didn't get to browse thoroughly. Just went for one quick round around level 2 and picked the one that I thought would fulfil his need. The thing is, as soon as I stepped out of the lift there was a shop that sold the new Dell Inspiron Mini 9 for only RM 1199. I was suprised. Just 1199. I couldn't believe my eyes. With original Windows XP and all. RM 1199. I thought there must be something wrong. Better survey first. So went around level 2. There was nothing that could match that price. Most of the other netbook from acer, asus and lenovo even was around RM 1600. So I decided I'll just go with the Dell lah. But to tell you the truth if I had money to buy for my own use, I'd go with the Lenovo Ideapad S10. Fuh.. she's one sweet mama... Smooth rounded curves, slim white profile. Pergh.. But anyway

First godot game published

I haven't published anything in google play for a very long time. I'm very happy to finally introduce my latest project to the public. It is a casual game called..... Add Block. Yeah.. The best original game name award coming right up. But seriously, try it out. Find in at the play store here . I love playing casual games on my phone. It's great to pass the time. But it doesn't really do anything for your skills. Or at least not anything for real life important skills (yes, I don't consider being able to identify the consecutive shapes or color as really important). So I decided to create one. So in this game, you practice your math skills. Find the adjacent blocks that add up to the total you need. So it's math, math is important right? Right?.... The levels are unlimited, the idea is that you keep on playing until you can't anymore. You'll die if you finally can't get the number of wins required to pass the level in time. You only have 100 se

Rendering template from string using thymeleaf in spring

Finally solved a very big problem for me... How do I render a page in spring framework that uses the thymeleaf templating engine? The string most probably will come from the database. After long hours of searching and trying, I've got it. First I've got a clue from this particular stackoverflow question . But following an example from there got me an error about class not found for ognl.PropertyAccessor. That solution was found here . So here's how I finally done it... First thing is to create a service where that service can be used wherever you need it in your spring app. @Service public class PortalService { private TemplateEngine templateEngine; private final static String TEMPLATE_LOCAL = "US"; private TemplateEngine getTemplateEngine(){ if(null == templateEngine){ templateEngine = new TemplateEngine(); StringTemplateResolver templateResolver = new StringTemplateResolver(); templat