OpenNebula released version October 3 in 3.0. In the past two days, I finally had time to test it.
[Manage nodes]
The newly installed Ubuntu 11.04 Server operating system is installed with both OpenSSH Server and LAMP Server. The Intranet IP address of the Management node is 192.168.1.1.
First, create a cloud group and oneadmin User:
sudo mkdir -p /srv/cloud/sudo groupadd -g 10000 cloudsudo useradd -u 10000 -g cloud -m oneadmin -d /srv/cloud/one -s /bin/bashsudo passwd oneadminsudo chown -R oneadmin:cloud /srv/cloud/su -l oneadminssh-keygencat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keysecho “StrictHostKeyChecking no” > ~/.ssh/configexit
Install and configure the NFS service:
sudo apt-get install nfs-kernel-serversudo pico /etc/exports
Add a line of content:
/srv/cloud *(rw,fsid=0,nohide,sync,root_squash,no_subtree_check)
Start the NFS service:
sudo /etc/init.d/nfs-kernel-server start
Install the software on which OpenNebula depends:
sudo apt-get install libsqlite3-dev libxmlrpc-c3-dev g++ ruby libopenssl-ruby libssl-dev ruby-devsudo apt-get install libxml2-dev libmysqlclient-dev libmysql++-dev libsqlite3-ruby libexpat1-devsudo apt-get install rake rubygems libxml-parser-ruby1.8 libxslt1-dev genisoimage sconssudo apt-get install mysql-serversudo gem install nokogirisudo gem install rakesudo gem install xmlparser
Create a MySQL database:
mysql -u root -pCREATE USER ‘oneadmin’@'localhost’ IDENTIFIED BY ‘oneadmin’;CREATE DATABASE opennebula;GRANT ALL PRIVILEGES ON opennebula.* TO ‘oneadmin’ IDENTIFIED BY ‘oneadmin’;quit;
Download and install OpenNebula front-end software:
su -l oneadminwget http://dev.opennebula.org/attachments/download/478/opennebula-3.0.0.tar.gztar -zxvf opennebula-3.0.0.tar.gzcd opennebula-3.0.0scons sqlite=no mysql=yes./install.sh -u oneadmin -g cloud -d /srv/cloud/one
Edit ~ /. Bash_profile, set some environment variables
export ONE_LOCATION=/srv/cloud/oneexport ONE_AUTH=$ONE_LOCATION/.one/one_authexport ONE_XMLRPC=http://localhost:2633/RPC2export PATH=$ONE_LOCATION/bin:/usr/local/bin:/var/lib/gems/1.8/bin/:$PATH
Execute. bash_profile to make these environment variables take effect:
source ~/.bash_profile
Edit ~ /. One/one_auth, set the username and password of OpenNebula:
mkdir ~/.oneecho “oneadmin:YOUR_PASSWORD” > ~/.one/one_authchmod 640 ~/.one/one_auth
Edit ~ /Etc/oned. conf, set the database parameters used by OpenNebula:
# DB = [ backend = "sqlite" ]# Sample configuration for MySQL
DB = [ backend = "mysql",
server = "localhost",
port = 0,
user = "oneadmin",
passwd = "oneadmin",
db_name = "opennebula" ]
Start the OpenNebula service:
one start
[Computing node]
The new Ubuntu 11.04 Server operating system is installed with both OpenSSH Sever and Virtualization. The Intranet IP address of the computing node is 192.168.1.2.
First install virtualization support:
Important: If the ubuntu-vm-builder and ruby software packages are not installed on the computing node, you can use the onehost create command to add the computing node, but its status will be displayed as err .)
sudo apt-get install qemu-kvm libvirt-bin bridge-utils ubuntu-vm-builder ruby
Install the NFS client:
sudo apt-get install nfs-common
Edit/etc/fstab and configure the NFS client. Assume that the IP address of the OpenNebula management node is 192.168.166.100)
19.2.166.100:/srv/cloud /srv/cloud nfs defaults 0 0
Create an NFS directory and mount the NFS file system:
sudo mkdir -p /srv/cloudsudo mount /srv/cloud
Create a cloud group and oneadmin User:
sudo groupadd -g 10000 cloudsudo useradd -u 10000 -g cloud -m oneadmin -s /bin/bashsudo usermod -d /srv/cloud/one oneadminsudo passwd oneadminsudo chown oneadmin:cloud /srv/cloud/
Edit/etc/libvirt/libvirtd. conf to configure libvirt and grant the operation permission to the cloud group:
unix_sock_group = “cloud”
Edit/etc/libvirt/qemu. conf to configure libvirt and set VNC:
vnc_listen = “0.0.0.0″
Restart libvirt:
sudo service libvirt-bin restartsudo chown :cloud /var/run/libvirt/libvirt-sock
Edit/etc/network/interface and configure the bridge according to the actual network conditions. Here we use eth1 to connect to a private intranet and use the Intranet IP address 192.168.1.
auto eth1iface eth1 inet manualauto br1iface br1 inet staticaddress 192.168.1.2netmask 255.255.255.0network 192.168.1.0broadcast 192.168.1.255bridge_ports eth1bridge_stp offbridge_fd 0bridge_maxwait 0
[Manage nodes]
Add a computing node. Assume that the IP address of the computing node is 192.168.1.2 ):
onehost create 192.168.1.2 im_kvm vmm_kvm tm_shared
Check whether the computing node is successfully added:
onehost list
At this time, we can see 192.168.1.2 appears in the computing node list. If the compute node is correctly configured, its state STAT should be displayed as "on ". If the status of the computing node is "err", the computing node is not configured properly. At this time, you can perform three checks: 1) Can you log on to the computing node using SSH in password-free mode on the Management node? 2) whether the computing node has installed ubuntu-vm-builder and ruby, and 3) whether the oneadmin user has the permission to control KVM on the computing node.
After successfully adding a computing node, we download a pre-configured VM for testing.
mkdir ~/one-templatescd ~/one-templateswget http://dev.opennebula.org/attachments/download/170/ttylinux.tar.gztar xzf ttylinux.tar.gz
Edit small_network.net to define a network:
NAME = “Small Network”TYPE = FIXEDBRIDGE = br1
LEASES = [ IP="192.168.1.5"]LEASES = [ IP="192.168.1.6"]LEASES = [ IP="192.168.1.7"]LEASES = [ IP="192.168.1.8"]LEASES = [ IP="192.168.1.9"]LEASES = [ IP="192.168.1.10"]LEASES = [ IP="192.168.1.11"]LEASES = [ IP="192.168.1.12"]LEASES = [ IP="192.168.1.13"]LEASES = [ IP="192.168.1.14"]LEASES = [ IP="192.168.1.15"]
Add the network defined above to the system:
onevnet create small_network.net
List all networks on the system. The ID of the Small Network just created may be 0 ):
onevnet list
Edit ttylinux. one and modify the VM parameters:
NAME = ttylinuxCPU = 0.1MEMORY = 64DISK = [source = "/srv/cloud/one/one-templates/ttylinux.img",target = "hda",readonly = "no" ]NIC = [ NETWORK_ID = 0]GRAPHICS = [ TYPE = "VNC"]FEATURES=[ acpi="no" ]
Create the VM in the system:
onevm create ttylinux.one
List all the VMS on the system. The IDS of the VMS just created may be 0 ):
onevm list
The preceding command lists the statuses of all VMS on the system, including the computing nodes that run these VMS. To learn the details of a virtual machine, you can use the onevm show VM_ID command, for example:
onevm show 0
This command lists all the information about the virtual machine with the ID 0, including the computing node and VNC Port Number of the virtual machine. If the port number is 5900), you can connect to the console of the VM through the VNC client. For example:
vncviewer 192.168.1.2:5900[SunStone]
SunStone is the management interface of OpenNebula, which can provide services for cloud administrators and end users at the same time. To enable SunStone, you must perform the following operations on the Management node:
sudo apt-get install rails thinsudo gem install json sinatra thinsudo gem install sequel sinatra-sequelsudo ln -s /usr/bin/rackup1.8 /usr/bin/rackup
Start the SunStone service:
su -l oneadmin./bin/sunstone-server start
In var/sunstone. log, find the port number used by SunStone. Here I see 9869), and access SunStone through a browser. Suppose that the IP address of the Management node is 192.168.1.1 ):
http://192.168.1.1:9869/
Original: http://www.qyjohn.net /? P = 1581