Sunday, 28 October 2012

Eucalyptus Cloud Computing



Eucalyptus is opensource cloud computing software designed for private as well as public clouds. It pools together existing virtualized infrastructure to create cloud resources for compute, network and storage.

Today I am going to tell you how to install and operate Eucalyptus software that can help you to build the cloud VM instances.
VM instances are the instances, that are the end product of the software. We go through a number of steps to install Cloud software. In the VM instances we will have the IP of the virtual machine. We can enter that machine using various tools such as SSH and work on that machine. We can also clone that machine and use whenever we required.
Since I am working with opensource projects, so I will work with eucalyptus on RedHat Enterprise linux 5.6, however it doesn't matter which Operating system you are using.

Installation Steps: 

1. Install rhel 5.6 on a machine, suggested machine should have larger resources than a normal machine. Also turn off the features such as firewall, IPtables etc on the boot time. Also ensure that yum is working on the system.

2. Download the java modules from the website. Following modules are sufficient.

a) jdk-6u29-linux-x64-rpm.bin

b) jre-6u29-linux-x64-rpm.bin

install using

./jdk-6u29-linux-x64-rpm.bin

./jre-6u29-linux-x64-rpm.bin

3. Install ntp on the machine and sync your system with pool.ntp.org as

# yum install ntp

# ntpdate pool.ntp.org

4. Now install following packages, these are the dependencies for installing the main packages. Resolve the dependencies and install as:

# yum install -y ant ant-nodeps dhcp bridge-utils perl-convert-ASN1.noarch scsi-target-utils httpd

5. Download the main packages from following links:

-->

http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/eucalyptus-2.0.3-centos-x86_64.tar.gz&nid=1346
-->

http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/euca2ools-1.3.1-centos-x86_64.tar.gz&nid=1346

Extract the downloaded tar files and create a repository from that. Copy those packages in a directory and make that make that repository available by yum.
Now install the main eucalyptus tools as:

# yum install eucalyptus-cloud eucalyptus-cc eucalytpus-walrus eucalyptus-sc euca2ools

6. Restart the services of eucalyptus:

# /etc/init.d/eucalyptus-cc restart; chkconfig eucalyptus-cc on

 
#/etc/init.d/eucalytpus-cloud restart; chkconfig eucalytus-cloud on
Now Install a virtual machine on the same system, you can use KVM virtual machine. If you don't know how to do this, refer to my post KVM.



After you successfully install the virtual machine, create yum on that virtual machine in the same way as on the base machine.
 On node controller(VM):

Now sync the time zone with pool.ntp.org as

# yum install ntp -y

# ntpdate pool.ntp.org

Now install xen on the virtual machine as:

# yum install xen -y

when completed, restart the system with xen kernel and modify the following:

# sed --in-place 's/#(xend-http-server no)/(xend-http-server yes)/' /etc/xend/xend-config.sxp 

# sed --in-place 's/#(xend-address localhost)/(xend-address localhost)/' /etc/xend/xend-config.sxp 

Restart the service of xend as:

# /etc/init.d/xend restart

Make sure that all the security features are disabled, for example, firewall IPTABLES. Now install the node controller on VM machine.

# yum install eucalyptus-nc -y

When completed open the configuration file of libvirtd and add

# vim /etc/libvirt/libvirt.conf

uncomment the following lines:

unix_sock_group="libvirt"
unix_sock_ro_perms="0777"
unix_sock_rw_perms="0770"

save and exit.

Now restart the service of node controller.

# /etc/init.d/eucalyptus-nc restart; chkconfig eucalyptus-nc on

This document describe the steps to install eucalyptus on single machine. However, these components if installed on different machines then we need to register all the components so that they can communicate with each other. For making these components to communicate with each other we will register all the components as:
 We assume that all the components are installed and running.

# $EUCALYPTUS/usr/sbin/euca_conf --register-walrus 192.168.100.1

# $EUCALYPTUS/usr/sbin/euca_conf --register-cluster cluster_name 192.168.100.1

# $EUCALYPTUS/usr/sbin/euca_conf --register-sc cluster_name 192.168.100.1

# $EUCALYPTUS/usr/sbin/euca_conf --register-walrus 192.168.100.1# $EUCALYPTUS/usr/sbin/euca_conf --register-walrus 192.168.100.1 # $EUCALYPTUS/usr/sbin/euca_conf --register-nc "192.168.100.2# $EUCALYPTUS/usr/sbin/euca_conf --register-walrus 192.168.100.1"  

Where 192.168.100.1 is the IP of the base machine and 192.168.100.2 is the IP of the virtual machine. When all the components are registered successfully, login to 

https://localhost:8443

this will prompt you username and password, which by default set to admin  and admin.

When you login, you will be forced to change the password for admin and your email address will be asked.
Now download the credentials from graphical menu.

# mkdir /.euca

# unzip euca2-admin* -d /.euca/

The above command will unzip the contents in the above directory. Run this command to use your credentials if required.

# . /.euca/eucarc

Now download the 64 bit image from following url:

# wget http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://www.eucalyptussoftware.com/downloads/eucalyptus-images/euca-centos-5.3-x86_64.tar.gz&nid=4305 

Extract the downloaded image as:

To enable a VM image as an executable entity, a user/admin must add a root disk image, a kernel/ramdisk pair (ramdisk may be optional) to Walrus and register the uploaded data with Eucalyptus.
Each is added to Walrus and registered with Eucalyptus separately, using three EC2 commands. The following example uses the test image that we provide. Unpack it to any directory. Add the kernel to Walrus, and register it with Eucalyptus (WARNING: your bucket names must not end with a slash!):

# tar zxvf euca-centos-5.3-x86_64.tar.gz 

# cd euca-centos-5.3-x86_64
 

# euca-bundle-image -i xen-kernel/vmlinuz-2.6.27.21-0.1-xen --kernel true
 

# euca-upload-bundle -b centos-kernel-bucket -m /tmp/vmlinuz-2.6.27.21-0.1-xen.manifest.xml
 

# euca-register centos-kernel-bucket/vmlinuz-2.6.27.21-0.1-xen.manifest.xml
 

# euca-bundle-image -i xen-kernel/initrd-2.6.27.21-0.1-xen --ramdisk true
 

# euca-upload-bundle -b centos-ramdisk-bucket -m /tmp/initrd-2.6.27.21-0.1-xen.manifest.xml
 

# euca-register centos-ramdisk-bucket/initrd-2.6.27.21-0.1-xen.manifest.xml
 

Next, add the root filesystem image to Walrus:
 

# euca-bundle-image -i centos.5-3.x86-64.img --kernel eki-8D7316E7 --ramdisk eri-87EE16CF
 

# euca-upload-bundle -b centos-image-bucket -m /tmp/centos.5-3.x86-64.img.manifest.xml
 

# euca-register centos-image-bucket/centos.5-3.x86-64.img.manifest.xml
 

=> Now, configure the dhcp server.
 

First copy the /usr/share/doc/dhcp3.0.5/dhcpd.conf.sample to /etc/dhcpd.conf
 

# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
 

# vim /etc/dhcpd.conf
 

Configure DHCP in this file.
 

=> Restart the service of dhcp
 

# /etc/init.d/dhcpd restart

Once the image is added, you can see the added image as:

# euca-describe-images

# euca-describe-instances

# euca-describe-avalability-zones

# euca-describe-keypairs

Adding keypair:
 We add keypairs to ssh the remote computer with password authentication.

# euca-add-keypair mykey > mykey.private

change the permission of mykey.private

#chmod 0600 mykey.private

Now run instances using following command:

# euca-run-instances -k mykey -n 1 <emi-id> 

# euca-describe-instances

This will show the list of the instances, with ipaddresses.

Now ssh to the ip using following command.

# ssh -i .euca/mykey.private -l root 192.168.100.1 -v


you will get the command line access of the vm created.
 

No comments:

Post a Comment