DR - Ait Cloud Computing Lab Manual
DR - Ait Cloud Computing Lab Manual
Installation of Opennebula
Aim:
To install opennebula in ubuntu operating system for creating virtualization in cloud.
Procedure:
Step 1. Installation of opennenula in the Frontend
1.1. Install the repo
1. Open Terminal (ctrl+alt+t) or from dashdoard type terminal
2. Here # indirectly tells to work on root.
$ indirectly tells to work on normal user
Add the OpenNebula repository: # - root user
# wget -q -O- http://downloads.opennebula.org/repo/Ubuntu/repo.key | apt-key add # echo "deb http://downloads.opennebula.org/repo/4.12/Ubuntu/14.04/ stable
opennebula" \
> /etc/apt/sources.list.d/opennebula.list
1.2. Install the required packages
# apt-get update
# apt-get install opennebula opennebula-sunstone nfs-kernel-server
1.3. Configure and Start the services
There are two main processes that must be started, the main OpenNebula daemon: oned, and
the graphical user interface: sunstone.
Sunstone listens only in the loopback interface by default for security reasons. To change it
edit
# gedit /etc/one/sunstone-server.conf
and change :host: 127.0.0.1 to :host: 0.0.0.0.
Now we must restart Sunstone:
# /etc/init.d/opennebula-sunstone restart
1.4. Configure SSH Public Key
OpenNebula will need SSH for passwordless from any node (including the frontend) to any
other node.
To do so run the following commands:
# su - oneadmin
$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
Add the following snippet to ~/.ssh/config so it doesnt prompt to add the keys to the
known_hosts file:
$ cat<< EOT > ~/.ssh/config#Type the below commands
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOT
$ chmod 600 ~/.ssh/config
Step 3. Basic Usage
The default password for the oneadmin user can be found in ~/.one/one_auth which is
randomly generated on every installation.
$ nano~/.one/one_auth
Result :
Thus, opennebula has been installed successfully.
To find the procedure to run the virtual machine of different configuration and to
Check how many virtual can be create.
root@linux:$ /etc/init.d/opennebula-sunstone restart
Procedures:
Step 1: Check the processor virtualization in boot settings.
Step 2: Execute all the commands in root user if the command start with #, and one
admin user if command start with $.
a. Moving to roo user in terminal
linux@linux:~$ sudo bash
[sudo] password for linux:
Enter the password.
Step 3: Checking the virtualization support in terminal from root user.
root@linux:~# grep -E 'svm|vmx' /proc/cpuinfo
Have to install the missing packages with the following commands in terminal.
root@linux:~# sudo apt-get install opennebula-node
root@linux:~# sudo apt-get install opennebula-gate
root@linux:~# sudo apt-get install opennebula-flow
root@linux:~# sudo apt-get install libopennebula-java
Now check the dependencies by giving the cammand in terminal where all packages shows as
installed
root@linux:~# dpkg -l opennebula-common ruby-opennebula opennebula
opennebula-node opennebula-sunstone opennebula-tools opennebula-gate
opennebula-flow libopennebula-java
## package name
[ OK ]
[ OK ]
[ OK ]
Step 8: Changing the network interface and bridge configuration manually. The
network configuration in the ubuntu is stored under /etc/network/interfaces
root@linux:~# gedit /etc/network/interfaces
It has only few lines.
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
Now we have to change the br0.cfg file manually which is located at
/etc/network/interfaces.d/br0.cfg
root@linux:~# gedit /etc/network/interfaces.d/br0.cfg
And paste the following lines there.
#auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports em1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
Now move the configuration file to the interfaces.
root@linux:~# cat /etc/network/interfaces.d/br0.cfg >> /etc/network/interfaces
Now, open and view the interface file.
root@linux:~# gedit /etc/network/interfaces
(or)
root@linux:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#auto br0
iface br0 inet static
address 192.168.0.10
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports em1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
Step 9: Change the settings at /etc/network/interfaces as
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.0.28
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports p5p1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
Step 10: Up the changes of bridge through
## Getting interface which changed for bridge bro by ifup br0
root@linux:~# ifup br0
#######error
Step 13: Creating the kvm for localhost. It helps to create image, template and template
instantiate to work.
oneadmin@linux:~$ onehost create localhost -i kvm -v kvm -n dummy
ID: 0
#### - I -information driver v- virtual driver n network driver
oneadmin@linux:~$ onehost list
oneadmin@linux:~$ ls -l
total 312
-rw-rw-r-- 1 oneadmin oneadmin 3339 Jul 1 05:04 config
drwxr-xr-x 5 oneadmin oneadmin 4096 Jul 1 04:12 datastores
-rw-r--r-- 1 dovenull nova
93 May 28 16:07 mynetwork.one
-rw-r--r-- 1 oneadmin oneadmin 287744 Jul 1 05:51 one.db
drwxr-xr-x 9 oneadmin oneadmin 4096 Jun 14 01:55 remotes
drwxrwxr-x 2 oneadmin oneadmin 4096 Jun 14 16:52 sunstone_vnc_tokens
drwxr-xr-x 2 oneadmin oneadmin 4096 Nov 26 2015 vms
Step 14: Create and Modifying the mynetwork.one at /var/lib/onemynetwork.one
oneadmin@linux:~$ sudo bash
root@linux:~# cd /var/lib/one
TYPE = IP4,
IP = 192.168.0.141,
SIZE = 5
]
root@linux:/var/lib/one# sudo - oneadmin
oneadmin@linux:~$ cat mynetwork.one
NAME = "private"
BRIDGE = br0
AR = [
TYPE = IP4,
IP = 192.168.0.141,
SIZE = 5
]
Step 15: Creating the virtualnetwork as onevnet and viewing it's properties.
oneadmin@linux:~$ onevnet create mynetwork.one
oneadmin@linux:~$ onevnet list
oneadmin@linux:~$ onevnet show 0
Step 16: Installing Virtual Machines, before that check list of oneimage, onetemplate
and onevm.
oneadmin@linux:~$ oneimage list
ID USER
GROUP NAME
DATASTORE
Step 17: Updating the .ssh for passwordless handshaking with oneadmin web service.
oneadmin@linux:~$ cat ~/.ssh/id_rsa.pub
## You can see the key, copy that fully and paste it in by visiting localhost:9869/
Click oneadmin and choose configuration and deselect the public ssh and finally paste it.
The above image before creating the vm. Refresh and check once the above commands are
executed.
Click the corner computer symbol icon, it will and ask the username and password. By default
the username is root and password is password.
Step 20: Similarly you can create as much vm your machine supports and can access
only 5vm at a time since we limited our ip range upto 5 in mynetwork.one
You can install ubuntu, centos and etc.,
Change the unbold data in the below cammand and install for various vm size.
Creating One Template:
oneadmin@linux:~/datastores$ onetemplate create --name "ttylinux" --cpu1 --vcpu 1 -memory 512 --arch x86_64 --disk "ttylinux" --nic "private" --vnc ssh
Instantiating OneVm (oneemplate)
oneadmin@linux:~/datastores$ onetemplate instantiate "ttylinux"
Result:
Thus the procedure for running the virtual machine of different configuration has
been successfully implemented in opennebula.
Find procedure to attach virtual block to the virtual machine and check
whether it holds the data even after the release of the virtual machine.
Aim:
To Find the procedure for attaching virtual block to the virtual machine and check whether it
holds the data even after the release of the virtual machine.
Procedure:
Step 1: Create the Oneimage, onetemplate and onevm through the commands
Creating oneimage
oneadmin@linux:~/datastores$ oneimage create --name "ttylinux" path
"/home/linux/Downloads/source/ttylinux.img" --driver raw --datastore default
Creating One Template:
oneadmin@linux:~/datastores$ onetemplate create --name "ttylinux" --cpu 1 --vcpu 1 -memory 512 --arch x86_64 --disk "ttylinux" --nic "private" --vnc ssh
Instantiating OneVm (oneemplate)
oneadmin@linux:~/datastores$ onetemplate instantiate "ttylinux"
Creating oneimage
oneadmin@linux:~/datastores$ oneimage create --name "Ubuntu" path
"/home/linux/Downloads/source/tubuntu1404-5.0.1.qcow2c" --driver qcow2 -datastore default
Creating One Template:
oneadmin@linux:~/datastores$ onetemplate create --name "ubuntu1" --cpu 1 --vcpu 1
--memory 1024 --arch x86_64 --disk "Ubuntu" --nic "private" --vnc ssh
Instantiating OneVm (oneemplate)
oneadmin@linux:~/datastores$ onetemplate instantiate "ubuntu1"
Step 2: Power off Virtual os
oneadmin@ubuntu:~/datastores$ onevm poweroff 1
oneadmin@ubuntu:~/datastores$ onevm poweroff 2
oneadmin@ubuntu:~/datastores$ onevm list
Step 3: Starting service
oneadmin@ubuntu:~/datastores$ onevm resume 0
Step 4: Deleting created VM
After power off do the operations
oneadmin@ubuntu:~/datastores$ onevm delete 1
oneadmin@ubuntu:~/datastores$ onevm list
oneadmin@ubuntu:~/datastores$ onevm delete 2
oneadmin@ubuntu:~/datastores$ onevm list
ALLOCATED_MEM STAT
Result:
Thus the procedure to attach virtual block to the virtual machine and check whether it holds
the data even after the release of the virtual machine has been successfully implemented.
Result:
Thus the GCC compiler has been successfully installed and executed a sample program.
Show the virtual machine migration based on the certain condition from
one node to the other
Aim:
To show the virtual machine migration based on the certain condition from one node
to the other.
Procedure:
Step 1: Open Opennebula service from root user and view in localhost:9869
root@linux:$ /etc/init.d/opennebula-sunstone restart
Step 2: Create oneimage, onetemplate and onevm as like earlier
Creating oneimage
oneadmin@linux:~/datastores$ oneimage create --name "Ubuntu" path
"/home/linux/Downloads/source/tubuntu1404-5.0.1.qcow2c" --driver qcow2 --datastore
default
Creating One Template:
oneadmin@linux:~/datastores$ onetemplate create --name "ubuntu1" --cpu 1 --vcpu 1 -memory 1024 --arch x86_64 --disk "Ubuntu" --nic "private" --vnc ssh
Instantiating OneVm (oneemplate)
oneadmin@linux:~/datastores$ onetemplate instantiate "ubuntu1"
Step 3: To perform a migration. We use onevm command with VM id as VID = 0 to
host02(HID=1)
oneadmin@linux:~/datastores$ onevm migrate --live 0 1
This will move the VM from host01 to host02. The onevm list shows something like the
following
oneadmin@linux:~/datastores$ onevm list
ID
USER
GROUP
NAME
0
oneadmin
oneadmin
one-0
STAT CPU
runn 0
Result :
Thus the virtual machine migration based on the certain condition from one node to
the other has been executed successfully.
$ sshlocalhost
### It also will ask ask root password
$ ssh-copy-id -ilocalhost
</property>
</configuration>
(v) Modiy yarn-site.xml
>gedit yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
4036 ResourceManager
4172 NodeManager
3685 SecondaryNameNode
Step 10. only four services will run. To start datanode and name node we have to add some
lines in hdfs- site.xml
In Terminal
$ cd $HADOOP_PREFIX/etc/hadoop
$gedit hdfs-site.xml
(Paste the below lines)
<property>
<name>dfs.namenode.name.dir</name>
<value>/opt/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/opt/data</value>
</property>
Next do these procedures, for creating permanent log storage to namenode and datanode.
$ sudomkdir /opt/name
$ sudomkdir /opt/data
$ ls /opt/
$ ls -l /opt/ ##To change the directory from root user to admin user
$sudo chown vrscet:vrscet -R /opt (root should be replaced by your system
username)
$ ls -l /opt/
Result:
Thus single node hadoop cluster has been successfully created.
localhost:50070
localhost:8088
Step 3:
Creating folder in web interface (HDFS) from terminal.
$ bin/hadoop fs -mkdir /bala
Wait until the command executes.
Step 4:
Open the localhost:50070
Utilities --> Browse the filesytem.
An folder has been created which we had given in terminal
bin/hadoop ----> represents the location of hdfs
fs
---> file system
-mkdir
------> create a folder
/
------> root in hdfs
bala
----> folder name