Install and configure OpenNebula on CentOS

Source: Internet
Author: User
Tags cloud computing platforms

We mentioned three types of cloud computing: Software as a Service (SaaS) and Platform as a Service (PaaS) and Infrastructure as a Service (IaaS ). When the cloud concept was first introduced, it was hard to find its way into the cloud. Now Cloud technology is deeply rooted in the hearts of the people. Maybe you are using the cloud and you are not aware of it, for example, Gmail is used on Google cloud every day. To better understand these three different clouds, we can take Google as an example. Just as this company provides three forms of cloud services, first look at SaaS, google Gmail/Docs/Gtalk/Maps all these Apps run on Google cloud, so they provide "software as a service" to common users. Google also provides developers with AppEngine, developers can use Python, Java, and other languages on their platforms to develop software and services, therefore, they provide developers with "Platform-as-a-service". Google built its own big cloud infrastructure based on GFS, BigTable, and MapReduce, they provide "infrastructure as a service" for their internal staff. These are three different types of clouds.

OpenNebula is an open-source basic cloud computing management tool that allows administrators to centrally deploy, create, allocate, and manage a large number of virtual machines in the data center, enterprise data centers can use this tool to build their own private clouds and provide IaaS services internally. Similar open-source products include OpenStack, CloudStack, Eucalyptus, and openQRM. The following installation process is completed on two VPSee servers with the CentOS 5.5 system. One server serves as the OpenNebula frontend (node00) and the other server serves as the node (node01 ), to build a minimal "Cloud", if you want to expand the cloud, you only need to gradually add nodes (node02, node03 ,...) You can. If you are interested in other similar open-source cloud computing platforms, you can install and configure OpenStack Nova on Ubuntu, and install OpenNebula 4.0 on CentOS 6.4. Here: install and configure OpenNebula 4.0 on CentOS.

Front-End installation and configuration)

Add CentOS Karan Source:

# cd /etc/yum.repos.d# wget http://centos.karan.org/kbsingh-CentOS-Extras.repo# yum update

Install the software packages required by OpenNebula and the tools required to compile OpenNebula source code:

# yum install gcc gcc-c++ make openssl-devel flex bison# yum install ruby ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc# yum install rubygems# gem install nokogiri rake xmlparser# yum install scons# yum install xmlrpc-c xmlrpc-c-devel

The sqlite version of CentOS does not work. You need to download and compile sqlite 3.6.17:

# wget http://www.sqlite.org/sqlite-amalgamation-3.6.17.tar.gz# tar xvzf sqlite-amalgamation-3.6.17.tar.gz# cd sqlite-3.6.17/# ./configure; make; make install

Download and compile the opennebula 2.0.1 source code package, decompress, compile, and install it:

# tar zxvf opennebula-2.0.1.tar.gz# cd opennebula-2.0.1# scons# ./install.sh -d /srv/cloud/one# ls /srv/cloud/one/bin  etc  include  lib  share  var

You must configure the ONE_AUTH environment variable before starting OpenNebula. This environment variable is read from the $ HOME/. one/one_auth file. Therefore, you must first create the one_auth file and then start one (OpenNebula Service Program ):

# cd /root/# mkdir .one# cd .one/# echo "oneadmin:password" > one_auth# one start

OpenNebula supports KVM, Xen, and VMware virtual technologies. We also need to tell OpenNebula what we want to use and restart one for the configuration to take effect:

# vi /etc/one/oned.conf...IM_MAD = [    name       = "im_xen",    executable = "one_im_ssh",    arguments  = "xen" ]VM_MAD = [    name       = "vmm_xen",    executable = "one_vmm_ssh",    arguments  = "xen",    default    = "vmm_ssh/vmm_ssh_xen.conf",    type       = "xen" ]...# one stop# one start
Install and configure a Node (Compute Node)

You need to install the Xen or KVM Virtual Environment on each node. For details, see install and configure Xen on CentOS and install and configure KVM on CentOS. You also need the ruby runtime environment:

# yum install ruby 
Exchange SSH Key

Because OpenNebula Front and Nodes communicate through SSH, you must set up SSH password-less logon between front and nodes to prevent front from entering the password when running scripts on node or cloning images, first configure sshd on front and nodes:

# vi /etc/ssh/sshd_configRSAAuthentication yesPubkeyAuthentication yes# /etc/init.d/sshd restart

Create a key on front (node00) and copy it to node (node01 ):

# ssh-keygen -t rsa# ssh-copy-id -i ~/.ssh/id_rsa.pub node01

Create a key on one node (node01) and copy it to front (node00 ):

# ssh-keygen -t rsa# ssh-copy-id -i ~/.ssh/id_rsa.pub node00
Onehost

After both front and each node can communicate via ssh without a password, you can add the node one by one using the onehost create Command on front and check whether the node is created successfully using the onehost list:

# onehost create node01 im_xen vmm_xen tm_ssh# onehost list  ID NAME              CLUSTER  RVM   TCPU   FCPU   ACPU    TMEM    FMEM STAT  1 node01     default    0    400    400    400    3.8G    383M   on

If an error is reported when onehost create is executed, view oned. log logs show that sudo: sorry, you must have a tty to run sudo, because OpenNebula requires remote ssh/sudo to execute commands, while requiretty, The sudo option of CentOS, is enabled by default, ssh requires a tty to be executed. Therefore, an error occurs in remote sudo ,:

# onehost create node01 im_xen vmm_xen tm_ssh# tail /var/log/one/oned.log Tue Feb 22 11:08:58 2011 [InM][I]: Command execution fail: 'if [ -x "/var/tmp/one/im/run_probes" ]; then /var/tmp/one/im/run_probes xen 172.16.39.111; else                              exit 42; fi'Tue Feb 22 11:08:58 2011 [InM][I]: STDERR follows.Tue Feb 22 11:08:58 2011 [InM][I]: sudo: sorry, you must have a tty to run sudoTue Feb 22 11:08:58 2011 [InM][I]: Error executing xen.rb...

The solution is to close (comment out) The requiretty line:

# chmod 600 /etc/sudoers# vi /etc/sudoers#Defaults    requiretty

Because the VPSee servers use HTTP proxy to access the Internet, OpenNebula reads the http_proxy environment variable of the system and finds the HTTP response error in the sched. log. In this case, you need to disable http_proxy:

# cat /var/log/one/sched.logTue Feb 22 14:27:39 2011 [HOST][E]: Exception raised: Unable to transport XML to server and get XML response back.  HTTP response: 504Tue Feb 22 14:27:39 2011 [POOL][E]: Could not retrieve pool info from ONE# unset http_proxy
Onevnet

Create and edit the virtual network configuration file, and then create an OpenNebula Virtual Network:

# vi small_network.netNAME = "Small network"TYPE = FIXEDBRIDGE = br0LEASES = [ IP="192.168.0.5"]LEASES = [ IP="192.168.0.6"]LEASES = [ IP="192.168.0.7"]# onevnet create small_network.net # onevnet list  ID USER     NAME              TYPE BRIDGE P #LEASES   0 oneadmin Small network    Fixed    br0 N       0
Onevm

Create and edit the startup profile for the VM, where centos.5.5.x86. img can be downloaded/downloaded from the http://stacklet.com (charged) or created by yourself using the Xen tool:

# wget http://stacklet.com/sites/default/files/centos/centos.5.5.x86.img.tar.bz2# tar jxvf centos.5.5.x86.img.tar.bz2# mv centos.5.5.x86.img /srv/cloud/one/var/images/# vi centos.one NAME   = centosCPU    = 1MEMORY = 256DISK = [  source   = "/srv/cloud/one/var/images/centos.5.5.x86.img",  target   = "sda1",  clone    = "yes",  readonly = "no" ]NIC = [ MAC = "00:16:3E:00:02:64", bridge = br0 ]OS = [ bootloader     = "/usr/bin/pygrub" ]

Start the VM configuration file above with the onevm create Command, and a virtual machine will be created on node01. You can view the prol status with the onevm list, indicating that the VM is being created, after creation, the status changes to runn:

# onevm create centos.one# onevm list   ID     USER     NAME STAT CPU     MEM  HOSTNAME        TIME    1 oneadmin   centos prol   0      0K  node01   00 00:09:09# onevm list   ID     USER     NAME STAT CPU     MEM  HOSTNAME        TIME    1 oneadmin   centos runn   0      0K  node01   00 00:22:17

In this way, we deployed a minimal cloud on the node00 (front) and node01 (node) servers, and ran an Xen-based Virtual Machine instance on node01.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.