There are generally three types of cloud computing we mention: Software as a Service (SaaS), Platform as a Service (PaaS) and Infrastructure as a Service (IaaS). When the cloud concept first came out, people said it was confusing and unclear. Now cloud technology has been deeply rooted in people's hearts. Maybe you are using the cloud without realizing it. For example, the Gmail you use every day is on Google Cloud. In order to better understand these three different clouds, we can take Google as an example. This company happens to provide three forms of cloud services. First, look at SaaS. Apps such as Google Gmail/Docs/Gtalk/Maps all run on Google Cloud. , so they provide "software as a service" for ordinary users; Google also provides AppEngine for developers, which allows developers to use Python, java and other languages and the APIs they provide to develop software and services, so they provide developers with "Platform as a Service"; Google itself has built a huge basic cloud infrastructure based on GFS, BigTable, and MaPReduce to provide its own internal staff with "Infrastructure as a Service". These are the three different types of clouds.
OpenNebula is a set of open source cloud computing basic management tools that facilitate administrators to uniformly deploy, create, allocate and manage a large number of virtual machines in the data center. Enterprise data centers can use this set of tools to build their own private clouds and provide internal Provides IaaS services, similar open source products include Eucalyptus, openQRM, etc. The following installation process is completed on two servers of VPSee equipped with CentOS 5.5 system. One server is used as the OpenNubula front end (node00), and the other server is used as the node (node01) to build a minimal "cloud". If If you want to expand this cloud, you only need to gradually add nodes (node02, node03, ...).
Install and configure the front-end (Front-End)
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 the 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 that comes with CentOS does not work. You need to download and compile sqlite 3.6.17 version:
# 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
After downloading and compiling the opennebula 2.0.1 source package, decompress, compile and install:
# 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
Before starting OpenNebula, you need to configure the ONE_AUTH environment variable. This environment variable is read from the file $HOME/.one/one_auth, so you must first create the one_auth file and then start one (OpenNebula service program):
# cd /root/
# mkdir .one
# cd .one/
# cat "oneadmin:passWord" > one_auth
# one start
OpenNebula supports three virtualization technologies: KVM, Xen and VMware. We also need to tell OpenNebula which one 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 the node (Compute Node)
A Xen or KVM virtual environment needs to be installed on each node. For details, please search for reference: Installing and configuring Xen on CentOS and Installing and configuring KVM on CentOS. A ruby operating environment is also required:
# yum install ruby
Exchange SSH Key
Because the communication between OpenNebula Front and Nodes is through SSH, SSH password-less login must be set up between the front and nodes to avoid entering a password when the front runs scripts on nodes or clones images. First configure sshd on the front and nodes:
# vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
# /etc/init.d/ssh restart
Create the key on the front (node00) and copy it to the node (node01):
# ssh-keygen -t rsa
# ssh-copy-id -i ~/.ssh/id_rsa.pub node01
Create the key on one node (node01) and copy it to the front (node00):
# ssh-keygen -t rsa
# ssh-copy-id -i ~/.ssh/id_rsa.pub node01
onehost
After the front can communicate with each node through password-less ssh, you can use the onehost create command on the front to join the nodes one by one, and use onehost list to check whether the creation is successful:
# 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 executing onehost create, check the oned.log log and find the words sudo: sorry, you must have a tty to run sudo. The reason is that OpenNebula requires remote ssh/sudo to execute commands, and CentOS’s sudo option requiretty is turned on by default. ssh A tty is required to execute, so remote sudo will cause an error:
# 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 sudo
Tue Feb 22 11:08:58 2011 [InM][I]: Error executing xen.rb
The solution is to turn off (comment out) the requiretty line:
# chmod 600 /etc/sudoers
# vi /etc/sudoers
#Defaults requiretty
Because the two servers of VPSee use HTTP proxy to access the Internet, OpenNebula read the system's http_proxy environment variable and found an HTTP response error in the sched.log log. At this time, http_proxy needs to be closed:
# cat /var/log/one/sched.log
Tue Feb 22 14:27:39 2011 [HOST][E]: Exception raised: Unable to transport XML to server and get XML response back. HTTP response: 504
Tue Feb 22 14:27:39 2011 [POOL][E]: Could not retrieve pool info from ONE
# unset http_proxy
Create and edit the virtual network configuration file, then create an OpenNebula virtual network:
# vi small_network.net
NAME = "Small network"
TYPE=FIXED
BRIDGE = br0
LEASES = [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 configuration file of the virtual machine. The centos.5.5.x86.img here can be downloaded from http://stacklet.com/ (for a fee) or you can create one yourself using Xen tools:
# 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 = centos
CPU = 1
MEMORY = 256
DISK = [
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 = xenbr0 ]
OS = [ bootloader = "/usr/bin/pygrub" ]
Use the onevm create command to start the above VM configuration file, and a virtual machine will be created on node01. Use onevm list to check and you will see the prol status, indicating that the creation process is in progress. After the creation is completed, the status will change 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 two servers, node00 (front) and node01 (node), and ran a Xen-based virtual machine instance on node01.
Article source: http://www.vpsee.com/2011/02/install-opennebula-on-centos/