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

Unknown 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 anywa…

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&#…

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…