OpenNebula
Pre-Installation Tasks
- groupadd --gid 2001 oneadmin
- useradd --uid 201 -g oneadmin -d /var/lib/one -m oneadmin
- elinks http://downloads.opennebula.org/
- apt-get install mysql-server git ruby-dev
- As MySQL root: CREATE USER 'oneadmin'@'localhost' IDENTIFIED BY 'PASSWORD' and GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin'@'localhost' IDENTIFIED BY 'password'
Install
- dpkg --install *.deb
- apt-get -f install (to get dependencies)
- /usr/share/opennebula/install_gems
- gem install nokogiri
- cd /usr/share/opennebula
- ./install_novnc.sh
Configure
Host configuration
- Copy /home/marc/git/xen/dist/install/usr/local/lib/xen/boot/pv-grub* on Flibble to /usr/lib/xen-4.1/boot/
- Ensure that /etc/xen/xend-config.sxp has the vnc-listen directive set to 0.0.0.0
- Also ensure that /etc/xen/xend-config.sxp has the following configured:
(xend-relocation-server yes) (xen-api-server ((9363 'none') (unix))) (xend-tcp-xmlrpc-server yes) (xend-tcp-xmlrpc-server-address )
- Add opennebula to /etc/hosts
- apt-get install ruby sshfs python-yaml
- Copy key to /root/.ssh/authorized_keys
- groupadd and useradd commands as above
- usermod -a -G disk oneadmin
- mkdir /etc/xen/auto
- mkdir /etc/xen/vm
- ssh-keygen for oneadmin and add to authorized_keys on opennebula controller
- Log in to oneadmin@opennebula from all hosts to store the keys appropriately
- Add to /etc/sudoers:
oneadmin ALL=(ALL) NOPASSWD: /usr/sbin/xm * oneadmin ALL=(ALL) NOPASSWD: /usr/sbin/xentop * oneadmin ALL=(ALL) NOPASSWD: /sbin/lvs * oneadmin ALL=(ALL) NOPASSWD: /sbin/lvcreate * oneadmin ALL=(ALL) NOPASSWD: /sbin/lvremove * oneadmin ALL=(ALL) NOPASSWD: /bin/dd *
- Mount the datastore by adding to /etc/fstab
sshfs#oneadmin@opennebula:/var/lib/one/datastores/1 /var/lib/one/datastores/1 fuse defaults,allow_other,reconnect 0 0
Front end
- mkdir ~/.one
- echo "oneadmin:password" > ~/.one/one_auth
- chmod 600 ~/.one/one_auth
- Change :host: to 0.0.0.0 and :port: to 80 in /etc/one/sunstone-server.conf
- echo "Host *" >> ~/.ssh/config
- echo " StrictHostKeyChecking no" >> ~/.ssh/config
- Authorise self to SSH: cat /var/lib/one/.ssh/id_rsa.pub >> /var/lib/one/.ssh/authorized_keys
CXM
- cd ~
- git clone git://github.com/nagius/cxm
- cd git/cxm/misc
- cp -r opennebula/tm opennebula/vmm opennebula/cxmrc /var/lib/one/remotes
- cp cxm.conf /etc/
- Change XPATH directive in cxm.conf to read "xpath -e" <--- not there any more?
- Edit one-migrate in cxm's directory to have ONE_HOST set with the hostname of the frontend.
- scp one-migrate to all hosts in /usr/local/sbin/ and then run chmod u+x /usr/local/sbin/one-migrate on the hosts
- Change /etc/xen/cxm.conf to have:
POST_MIGRATION_HOOK="/usr/local/sbin/one-migrate"
- Change /var/lib/one/remotes/cxmrc to have:
DEBUG="True" VG_NAME="lvm_r0" LV_PREFIX="one" VM_FQDN_TEMPLATE="%U-%V.one" XPATH="xpath -e"
Root OpenNebula Configuration
- Make OpenNebula use the MySQL backend by editing /etc/one/oned.conf:
DB = [ backend = "mysql", server = "localhost", port = 0, user = "oneadmin", passwd = "password", db_name = "opennebula" ]
- Go to /var/lib/one/remotes/vmm/xen4/xenrc and uncomment the line:
export FORCE_DESTROY=yes
- Change /etc/one/oned.conf to uncomment the following (commenting the KVM lines):
IM_MAD = [
name = "im_xen",
executable = "one_im_ssh",
arguments = "xen" ]
VM_MAD = [
name = "vmm_xen",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 xen4",
default = "vmm_exec/vmm_exec_xen4.conf",
type = "xen" ]
- Also add cxm to the TM_MAD directive so it reads:
TM_MAD = [ executable = "one_tm", arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmware,iscsi,cxm" ]
- Add the cxm driver:
VM_MAD = [ name = "vmm_cxm", executable = "one_vmm_exec", arguments = "-t 15 -r 0 cxm", default = "vmm_exec/vmm_exec_xen4.conf", type = "xen" ]
- Change the default device prefix
DEFAULT_DEVICE_PREFIX = "xvd"
- Change the default disk driver for phy: in /etc/one/vmm_exec/vmm_exec_xen4.conf :
DISK = [ driver = "phy:" ]
- Add the following to /etc/rc.local:
sunstone-server start
Networks
Create eth0.net with the following contents
NAME = "Network Name" TYPE = ranged BRIDGE = eth0 NETWORK_SIZE = 30 NETWORK_ADDRESS = 192.168.1.224 GATEWAY = 192.168.1.254 DNS = 8.8.8.8
Run onevnet create eth0.net
Hosts
- onehost create cloud1 --im xen --vm vmm_cxm --net dummy
- onehost create cloud2 --im xen --vm vmm_cxm --net dummy
- onehost enable cloud1
- onehost enable cloud2
Datastores
- Change the default datastore to use cxm by typing onedatastore update 1
TM_MAD="cxm"
- onedatastore create
NAME="london1cxm" DS_MAD="fs" TM_MAD="cxm" NO_DECOMPRESS="yes"
Clusters
- onecluster create London1
- onecluster addhost London1 cloud1
- onecluster addhost London1 cloud2
- onecluster update 102
SYSTEM_DS="X" where X is the cxm datastore
- onecluster adddatastore London1 london1cxm
Images
- Create debian.one in /images with the following
NAME = "Deb 6 x86 Std" PATH = "/images/debian-opennebula.tar.gz" TYPE = OS DESCRIPTION = "Debian 6 (Squeeze) x86_64 with standard system utilities"
- oneimage create debian.one -d <cxm datastore number>
- Download the OpenNebula Virtual Router
- gunzip it in /images
- Create router.one in /images with the following
NAME = "OpenNebula Router" PATH = "/images/router.img" TYPE = OS DESCRIPTION = "OpenNebula Router"
- oneimage create router.one -d <cxm datastore number>
Templates
- onetemplate create
CPU="1" DISK=[ FORMAT="ext3", IMAGE_ID="XX" SIZE="1024", TYPE="fs" ] DISK=[ SIZE="128", TYPE="swap" ] GRAPHICS=[ TYPE="vnc" ] MEMORY="128" NAME="Template Name" NIC=[ NETWORK="Network Name" ] OS=[ BOOTLOADER="/usr/lib/xen-4.1/bin/pygrub" ] RAW=[ TYPE="xen" ] TEMPLATE_ID="X" VCPU="1"
- onetemplate create (for the router)
CONTEXT=[ DHCP="YES", NTP="NO", PRIVNET="$NETWORK[TEMPLATE, NETWORK=\"Network Name\"]", TARGET="hdb", TEMPLATE="$TEMPLATE" ] CPU="1" DISK=[ FORMAT="ext3", IMAGE_ID="YY" SIZE="2048", TYPE="raw" ] GRAPHICS=[ TYPE="vnc" ] MEMORY="128" NAME="One Router" NIC=[ NETWORK="Network Name" ] OS=[ BOOTLOADER="/usr/lib/xen-4.1/bin/pygrub" ] RAW=[ TYPE="xen" ] TEMPLATE_ID="X" VCPU="1"
Datastore Sharing
Use SSHFS to mount the datastore for the images on all hosts. Something like the following will do:
- mkdir /var/lib/one/datastores/<cxm datastore ID>
- sshfs -o allow_other -o reconnect oneadmin@opennebula:/var/lib/one/datastores/100 /var/lib/one/datastores/100
CXM post-configuration
- apt-get install python-twister python-paramiko
- git clone https://github.com/nagius/cxm.git
- cp -rv cxm/lib/cxm /usr/lib/python2.7
- ln -s /usr/lib/xen-4.1/lib/python/xen /usr/lib/python2.7/
Router
To get the router up and running, a few changes need to be made within the VPS:
- loadkeys uk
- sed -i 's/KEYMAP="es"/KEYMAP="uk"/' /etc/rc.conf
- sed -i 's/Madrid/London/' /etc/rc.conf
Miscellaneous
- Download the vm_runn utility and save in ~oneadmin