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

KageSenshi 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.
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

haproxy on Centos 7 with SELinux

Setting up haproxy and varnish with reference to the configuration from these sites: http://sharadchhetri.com/2014/12/20/how-to-install-varnish-4-version-on-centos-7-rhel-7/ https://www.upcloud.com/support/haproxy-load-balancer-centos/ And finally can access plone on the server. But when I check the haproxy status, only client1 can be accessed. All other clients were down with general socket error, permission denied. Googling a bit I finally found out it was due to SELinux. Refer to this page: http://stackoverflow.com/questions/26420729/haproxy-health-check-permission-denied With the solution from that page, I installed policycoreutils-python and tried to run the command given: semanage port --add --type http_port_t --proto tcp 8081 But that command failed with the error that the port was already defined. When I looked it up using: semanage port -l | grep 8081 It belonged to some other type (transproxy_port_t). When I tried to delete the type using: semanage port -d -t transpro…

Installing Centos 7 on HP G7 Server

When I first initially tried it, the installer cannot detect any local hard disk to install to. After much googling found out that it was because a certain driver for the Smart Array Controller is no longer available on Centos 7. To allow for use of the new driver on old hardware, you need to enable the option. Once the DVD has booted and on the first menu screen, highlight the first option and then press tab which would bring you to a command line where you can add additional parameters to boot. Add the following parameters: hpsa.hpsa_allow_any=1 hpsa.hpsa_simple_mode=1 And then press enter to boot. You should now be able to install as you wish. After installation, on the first boot, make sure at the menu, press 'e' to edit the parameters and add them again. Then once booted, go to /boot/grub2/grub.cfg to permanently add the parameters to the menu. Refer to http://serverfault.com/questions/611182/centos-7-x64-and-hp-proliant-dl360-g5-scsi-controller-compatibility and it&#…

Me and my sleep apnea

I have been suffering from sleep apnea for quite a few years already. It started to show when I was still with OSCC some 6 years back when I would sometimes "accidentally" sleep at my cubicle. Early on I just dismissed it as because I was growing fat (we ate a lot at OSCC.. :P and I barely went anywhere except my cubicle) and also because of babies. Oh babies.. those cute little things that keeps you awake at night so that they can be so cute and charming when your friends and relatives come over the next day. So it was dismissed. Later on I got more and more used to sleeping at work, started associating it with my lack of motivation and sometimes feeling of downright depression. And I kept growing fatter and fatter, which I assumed was the reason why I was getting more and more tired.

But then around 2 years ago a friend of mine suggested maybe I've got sleep apnea. And a few other people suggested I go to a sleep clinic and all that. Put it off for quite a while. Until…