Tag cloud

JBoss (16) Fedora (5) Linux (4) Red Hat (4) JON (3) command line (3) 4.3 (2) JEE (2) JVM (2) Java (2) KVM (2) Oracle (2) Portal (2) Weblogic (2) installation (2) vs (2) /boot partition (1) Add-ons (1) Apache (1) Bundles (1) Business model (1) Byteman (1) CLASSPATH (1) EAP (1) EPP (1) Eclipse (1) Failover (1) Gnome (1) JAVA_OPTS (1) JBDS (1) JBoss Tools (1) JBossON (1) JConsole (1) JDK (1) JMS (1) JVM options (1) KDE (1) MBean (1) Network (1) Open Source (1) RHQ (1) Red Hat subscription (1) Thunderbird (1) Troubleshooting (1) Virtulization (1) WS (1) Webservices (1) Wireshark (1) classloading (1) clustering (1) comparison (1) debug (1) deployment (1) disable SELinux (1) disksize (1) error (1) fun (1) jboss.org (1) log (1) log4j (1) lvm (1) messaging (1) multiple WARs (1) patent FOSS (1) performance tuning (1) provisionning (1) scripting (1) services (1) switch (1) troll (1) upgrade (1) video (1) war (1) webapp (1) yum (1)

22 July 2010

Howto install Red Hat Virtualisation KVM

Red Hat enlarged it's virtualization portfolio in 2008 by aquiring Qumranet.
The main product of the Israel based company is KVM (the Kernel-based Virtual Machine).
Ever since February 2007 KVM is part of the Linux kernel (2.6.20+).

Here a good reference on kvm:
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Virtualization_Guide/

Howto install KVM on Fedora 13:
Official Red Hat support
sudo yum install virt-manager
sudo yum install libvirt

sudo yum install kvm

or
sudo yum groupinstall 'Virtualization'
Often you come from another virtualization envioronement (VMware or Virturalbox)

Check if you can start a virtual daemon
$ sudo service libvirtd start


error : qemudListenUnix:570 : Failed to bind socket to '@/home/jboss-as/.libvirt/libvirt-sock': Address already in use

This error occurs b/c another virutalization enviroment is blocking you

Image source





























Run KVM
Either by GUI Alt + F2 or directly on command line 'virt-manager'












Start screen:







Then choose 'Edit' -- 'Host details'














By default KVM stores the virtual machines within /var/lib/libvirt/images/*.img, if you want to change that goto the 'Storage' tab and choose the plus sign (Add pool). Choose the file system type 'dir' to store future virtual machines on your hard drive.

The solution
Another elegant solution is that you leave the defaults and you create a soft link on your machine


  1. VM - Image file can be found in directory /var/lib/libvirt/images/*.img
    sudo rm -rf /var/lib/libvirt/images
    sudo ln -s /data/virtual_machines /var/lib/libvirt/images
  2. VM - Description file can be found in /etc/libvirt/qemu/*.xml
    sudo cp -r /etc/libvirt/qemu /tmp/virtual_machines/qemu (first back it up)
    sudo rm -rf /etc/libvirt/qemu
    sudo ln -s /data/virtual_machines/qemu /etc/libvirt/qemu
    ├── jon.xml
    ├── jon.log
    ├── network
    │   ├── autostart
    │   │   ├── default.xml -> /etc/libvirt/qemu/networks/default.xml
    │   │   └── prive.xml -> /etc/libvirt/qemu/networks/prive.xml
    │   ├── default.xml
    │   └── prive.xml
    avec
    -rw-------   1 qemu     qemu     4GB  jon.img
  3. VM - Network file can be found in /var/lib/libvirt/network/default.xml
    sudo cp -r /var/lib/libvirt/network /tmp/virtual_machines/network
    sudo rm -rf /var/lib/libvirt/network
    sudo ln -s /data/virtual_machines/network /var/lib/libvirt/network
  4. VM - Logging file can be found in /var/log/libvirt/qemu/*.log
    sudo rm -rf /var/log/libvirt/qemu/
    ln -s /data/virtual_machines /var/log/libvirt/qemu
  5. Move tmp folder
    mkdir /data/virtual_machines
    sudo cp -r /tmp/virtual_machines/* /data/virtual_machines
    sudo rm -rf /tmp/virtual_machines
    sudo cp /vm_backup/jon.xml /data/virtual_machines/jon.xml
    sudo cp /vm_backup/jon.img /data/virtual_machines/jon.img
    # check if your IP in prive.xml is correctly set 192.168.100. and change virbr0 to vm-kvm for example
    sudo cp /data/virtual_machines3/networks/prive.xml /data/virtual_machines/qemu/networks/prive.xml
    sudo cp /data/virtual_machines3/networks/prive.xml /data/virtual_machines/network/prive.xml
    sudo ln -s ../prive.xml /data/virtual_machines/qemu/networks/prive.xml
    chown qemu:qemu /data/virtual_machines/*
  6. Restart libvirt
    service libvirtd restart


Add virtual machine
- Click first icon in toolbar "Create a new virtual machine"
- Choose name 2010_FED13_64_OracleDB10g

Install your operating system
If you have chosen Fedora 13 (for example) do not be scared of the messeges that tell you
"REINITIALIZING WILL CAUSE ALL DATA TO BE LOST"
It is only the data within the virtual machine file that was created. The scary message is subject of discussion of redhat support.

Starting Virtual machine
After having installed your OS (up to 3 hours) you'll have to restart your computer.
I ran into a freezed screen saying 'Booting from Hard Disk...' (here the Red Hat discussion)

add this '-enable-kvm'

At the beginning of the startup process you can hit Ctrl+B to enter the command line of the prebootloader gPXE.


Follow-up: The problem was having hardware virtualization support turned
off in the host's BIOS. (Doh!) Once I turned that on, not only was 
installing a guest about 10x faster, but it also booted properly afterward.



> Hi,
> 
> I'm installing a Fedora 13 virtual host on a Fedora 13 system, like this:
> 
> virt-install --ram 2048 --vcpus 4 --name test --os-type linux \
>   --os-variant fedora13 --disk /var/lib/libvirt/images/test.img,size=10 \
>   --cdrom /var/lib/libvirt/Fedora-13-x86_64-DVD.iso --vnc --noautoconsole
> 
> I connect to the installer using virt-manager, and the install appears to
> complete successfully. Then, I reboot the virtual machine and reconnect
> with virt-manager. What I see is this:
> 
>   Starting SeaBios (version 0.5.1)
> 
>   gPXE (http://etherboot.org) - 00:04.0 C900 PCI2.10 PnP BBS PMM7FE0 10 C900
> 
>   Booting from Hard Disk...
> 
> If I connect to the VM's console using 'virsh console', there's no output
> at all. I don't see anything in /var/log/messages or /var/log/libvirt that
> looks like an error.
> 
> So, I'm not sure what's going on here, as this is the first time I've done
> anything with virtualization. Has my VM hung, or is this what's supposed to
> happen? I was expecting that somewhere along the line that my VM would get
> an IP address via DHCP so I could SSH to it, but don't see anything indicatin
> g
> that has happend, or what the IP address is if it has. Is something broken
> here, or have I missed a crucial step?
>

Follow-up: The problem was having hardware virtualization support turned
off in the host's BIOS. (Doh!) Once I turned that on, not only was 
installing a guest about 10x faster, but it also booted properly afterward.

https://www.redhat.com/archives/libvirt-users/2010-June/msg00087.html






Source: Wikipedia
http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine
http://jwang3417.blogspot.com/2010/02/kvm-on-ubuntu-and-fedora.html

HOWTO: Resize a KVM Virtual Machine Image
http://itsignals.cascadia.com.au/?p=28

http://wiki.libvirt.org/page/Tips

No comments:

Post a Comment