OpenNebula allows virtual machines to be placed and re-placed dynamically on a pool of physical resources. This allows a virtual machine to be hosted from any location available.
This section will detail configuring an OpenNebula cluster using three machines: one Front-End host, and two Compute Nodes used to run the virtual machines. The Compute Nodes will also need a bridge configured to allow the virtual machines access to the local network. For details see the section called “Bridging”.
First, from a terminal on the Front-End enter:
sudo apt-get install opennebula
On each Compute Node install:
sudo apt-get install opennebula-node
In order to copy SSH keys, the oneadmin user will need to have a password. On each machine execute:
sudo passwd oneadmin
Next, copy the oneadmin user's SSH key to the Compute Nodes, and to the Front-End's authorized_keys
file:
sudo scp /var/lib/one/.ssh/id_rsa.pub oneadmin@node01:/var/lib/one/.ssh/authorized_keys sudo scp /var/lib/one/.ssh/id_rsa.pub oneadmin@node02:/var/lib/one/.ssh/authorized_keys sudo sh -c "cat /var/lib/one/.ssh/id_rsa.pub >> /var/lib/one/.ssh/authorized_keys"
The SSH key for the Compute Nodes needs to be added to the /etc/ssh/ssh_known_hosts
file on the Front-End host. To accomplish
this ssh to each Compute Node as a user other than oneadmin. Then exit from the SSH session, and
execute the following to copy the SSH key from ~/.ssh/known_hosts
to /etc/ssh/ssh_known_hosts
:
sudo sh -c "ssh-keygen -f .ssh/known_hosts -F node01 1>> /etc/ssh/ssh_known_hosts" sudo sh -c "ssh-keygen -f .ssh/known_hosts -F node02 1>> /etc/ssh/ssh_known_hosts"
Replace node01 and node02 with the appropriate host names. |
This allows the oneadmin to use scp, without a password or manual intervention, to deploy an image to the Compute Nodes.
On the Front-End create a directory to store the VM images, giving the oneadmin user access to the directory:
sudo mkdir /var/lib/one/images sudo chown oneadmin /var/lib/one/images/
Finally, copy a virtual machine disk file into /var/lib/one/images
. You can create an Ubuntu virtual machine
using vmbuilder, see the section called “JeOS and vmbuilder” for details.
The OpenNebula Cluster is now ready to be configured, and virtual machines added to the cluster.
From a terminal prompt enter:
onehost create node01 im_kvm vmm_kvm tm_ssh onehost create node02 im_kvm vmm_kvm tm_ssh
Next, create a Virtual Network template file named vnet01.template
:
NAME = "LAN" TYPE = RANGED BRIDGE = br0 NETWORK_SIZE = C NETWORK_ADDRESS = 192.168.0.0
Be sure to change 192.168.0.0 to your local network. |
Using the onevnet utility, add the virtual network to OpenNebula:
onevnet create vnet01.template
Now create a VM Template file named vm01.template
:
NAME = vm01 CPU = 0.5 MEMORY = 512 OS = [ BOOT = hd ] DISK = [ source = "/var/lib/one/images/vm01.qcow2", target = "hda", readonly = "no" ] NIC = [ NETWORK="LAN" ] GRAPHICS = [type="vnc",listen="127.0.0.1",port="-1"]
Start the virtual machine using onevm:
onevm submit vm01.template
Use the onevm list option to view information about virtual machines. Also, the onevm show vm01 option will display more details about a specific virtual machine.
-
See the OpenNebula website for more information.
-
You can also find help in the #ubuntu-virt and #ubuntu-server IRC channels on Freenode.
-
Also, the OpenNebula Ubuntu Wiki page has more details.