Cc-Lab Edited Manual.
Cc-Lab Edited Manual.
S ENGINEERING COLLEGE
(Approved by AICTE &Affiliated to Anna University, Chennai) Peruvoyal, (Near Kavaraipettai),
NAME : ………………………………………………
REG NO :……………………………………….
DEPARTMENT : ..…………………………………………….
YEAR/SEM : ………………………………………………
T.J.S ENGINEERING COLLEGE
(Approved by AICTE &Affiliated to Anna University, Chennai) Peruvoyal,
NAME : …………………………………………
DEPARTMENT : …………………………………………
YEAR/SEM : ………………………………………
REGISTER
NUMBER :
Certified that this is the Bonafide record of practical work done by the aforesaid student
in the
During the year
.
AIM:
To Install VMware workstation with different flavours of linux on top of windows
PROCEDURE:
RESULT:
Thus, Virtualbox with different flavours of linux on top of windows was successfully
installed.
EX.NO:02 Install a C compiler in the virtual machine created
DATE: using virtual box and execute Simple Programs
AIM:
To install a C Compiler in the virtual machine using Virtual Box and then to execute
simple program
PROCEDURE:
****If gcc and / or g++ and it’s related Development Tools are not installed in your system by
default, you can install the latest available from the repositories as follow****
STEP 1: Press ‘i’ for insert mode STEP 2: Type the following code:
OUTPUT:
[frontend@frontend Desktop]$ gcc sum.c -o sum [frontend@frontend Desktop]$
./sum
Enter two numbers to add, Separated by a space: 145 216 The sum of 2 numbers
is : 361
RESULT:
Thus C Compiler in the virtual machine using Virtual Box was installed and then
simple program was executed successfully.
EX.NO:03 Install Google App Engine. Create hello world app and
other simple web applications using python/java
DATE:
AIM:
To install Google App engine to create helloworld App web application using
python
PROCEDURE:
This procedure describes the installation of the Google App Engine Software
Development Kit (SDK) on a Microsoft Windows and running a simple “hello world” application.
The App Engine SDK allows you to run Google App Engine Applications on your local computer.
It simulates the run--‐ time environment of the Google App Engine infrastructure.
Pre--Requisites: Python 2.5.4
If you don't already have Python 2.5.4 installed in your computer, download and Install Python 2.5.4
from: http://www.python.org/download/releases/2.5.4/
Download the Windows installer – the simplest thing is to download it to your Desktop or another
folder that you remember.
Double Click on the GoogleApplicationEngine installer.
Click through the installation wizard, and it should install the App Engine. If you do not have
Python 2.5, it will install Python 2.5 as well.
Once the install is complete you can discard the downloaded installer
Making your First Application
Now you need to create a simple application. We could use the “+” option to have the launcher
make us an application – but instead we will do it by hand to get a better sense of what is going on.
Make a folder for your Google App Engine applications. I am going to make the Folder on my
Desktop called “apps” – the path to this folder is:
C:\Documents and Settings\csev\Desktop\apps
And then make a sub--‐ folder in within apps called “ae--01--trivial” – the path to this folder would
be:
C:\ Documents and Settings \csev\Desktop\apps\ae--01--trivial
Using a text editor such as JEdit (www.jedit.org), create a file called app.yaml in the ae--01--trivial
folder with the following contents:
Note: Please do not copy and paste these lines into your text editor – you might end up with strange
characters – simply type them into your editor.
Then create a file in the ae--01--trivial folder called index.py with three lines in it:
print 'Content-Type: text/plain' print ' ' print 'Hello there Chuck'
Then start the GoogleAppEngineLauncher program that can be found under Applications. Use the
File --> Add Existing Application command and navigate into the apps directory and select the ae--
01--trivial folder.
Once you have added the application, select it so that you can control the application
using the launcher.
Once you have selected your application and press Run. After a few moments your application will
start and the launcher will show a little green icon next to your application. Then press Browse to
open a browser pointing at your application which is running at http://localhost:8080/
Paste http://localhost:8080 into your browser and you should see your application as follows:
Just for fun, edit the index.py to change the name “Chuck” to your own name and press Refresh
in the browser to verify your updates.
RESULT:
Thus Google App engine was installed to create helloworld App web application using
python
EX.NO:4 Use GAE launcher to launch the web applications.
DATE:
AIM:
To launch the web applications using GAE launcher.
PROCEDURE:
You can use Google App Engine to host a static website. Static web pages can contain client- side
technologies such as HTML, CSS, and JavaScript. Hosting your static site on App Engine can cost less
than using a traditional hosting provider, as App Engine provides a free tier.
Creating a website to host on Google App Engine Basic structure for the project
This guide uses the following structure for the project:
• app.yaml: Configure the settings of your App Engine application.
• www/: Directory to store all of your static files, such as HTML, CSS, images, and
JavaScript.
handlers:
- url: /
static_files: www/index.html upload: www/index.html
More reference information about the app.yaml file can be found in the app.yaml reference
documentation.
Creating the index.html file
Create an HTML file that will be served when someone navigates to the root page of your website.
Store this file in your www directory.
<html>
<head>
<title>Hello, world!</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<h1>Hello, world!</h1>
<p>
This is a simple static HTML file that will be served from Google App
Engine.
</p>
</body>
</html>
Optional flags:
Include the --project flag to specify an alternate Cloud Console project ID to what you
initialized as the default in the gcloud tool. Example: --project
[YOUR_PROJECT_ID]
Include the -v flag to specify a version ID, otherwise one is generated for you. Example:
-v [YOUR_VERSION_ID] Viewing your application
To launch your browser and view the app at , run the following command:
https://PROJECT_ID.REGION_ID.r.appspot.com
gcloud app browse
Watching the Log
You can watch the internal log of the actions that the web server is performing when you are
interacting with your application in the browser. Select your application in the Launcher and press the
Logs button to bring up a log window:
Each time you press Refresh in your browser – you can see it retrieving the output with a
GET request.
With two files to edit, there are two general categories of errors that you may encounter. If you make
a mistake on the app.yaml file, the App Engine will not start and your launcher will show a yellow
icon near your application:
To get more detail on what is going wrong, take a look at the log for the application:
In this instance – the mistake is mis--‐ indenting the last line in the app.yaml (line 8).
If you make a syntax error in the index.py file, a Python trace back error will appear in your
browser.
The error you need to see is likely to be the last few lines of the output – in this case I made a
Python syntax error on line one of our one--‐ line application.
Reference: http://en.wikipedia.org/wiki/Stack_trace
When you make a mistake in the app.yaml file – you must the fix the mistake and attempt to start
the application again.
If you make a mistake in a file like index.py, you can simply fix the file and press refresh in
your browser – there is no need to restart the server.
To shut down the server, use the Launcher, select your application and press the Stop
button.
OUTPUT:
RESULT:
Thus GAE launcher was initiated and web application was launched successfully.
EX.NO:5 Simulate a cloud scenario using CloudSim and run a
DATE: scheduling algorithm that is not present in CloudSim
AIM:
To simulate cloud scenario using cloudsim and to run a scheduling algorithm.
PROCEDURE:
CloudSim is a simulation toolkit that supports the modeling and simulation of the core functionality
of cloud, like job/task queue, processing of events, creation of cloud entities(datacenter, datacenter
brokers, etc), communication between different entities, implementation of broker policies, etc. This
toolkit allows to:
• The Support of modeling and simulation of large scale computing environment as federated
cloud data centers, virtualized server hosts, with customizable policies for provisioning host
resources to virtual machines and energy-aware computational resources
• Flexibility to switch between space shared and time shared allocation of processing
cores to virtualized services.
• cloudsim-4.0.zip: This is the same as above the only difference is that it is windows specific.
• Source code(zip): This file contains the complete source code of the cloudsim simulation
framework project. As the cloudsim uses the maven build tool for its DevOps. Therefore to
set up this project you require to use an IDE that supports maven project imports. How do
you identify that its a maven based project? you will find a “pom.xml” file in the project root
folder. This zip is windows operating system specific file.
• Source code(tar.gz): This file contains a similar structure as mentioned above, but it is
specific to Linux How to install?
Cloudsim setup is very easy, for this you may follow the following link: cloudsim-setup-
usingeclipse/. This link describes in detail all the steps that are required to successfully configure the
Cloudsim 3.0.3 version. The cloudsim 3.0.3 version is best to start with that once you understand the
basic working and architecture then you can move to any latest version.
• To simulating the regions and datacenters the class named “Datacenter.java” is available
in org.cloudbus.cloudsim package.
• To simulate the load balancing and policy-related implementation the classes named
“DatacenterBroker.java”, “CloudletScheduler.java”, “VmAllocationPolicy.java”, etc are
available under org.cloudbus.cloudsim package.
• Now because all the different simulated hardware models are required to communicate with
each other to share the simulation work updates for this cloudsim has implemented a discrete
event simulation engine that keeps track of all the task assignments among the different
simulated cloud components.
How to run my first cloudsim simulation scenario?
Once you have completed your installation/setup and understand the basic working of the cloudsim,
the next step is to implement your own custom scenario. Any simulation will go through the following
steps:
• Initialize the CloudSim with the current clock time and this will also initialize the core
CloudInformationService entity.
• Create Datacenter(s) as Datacenters are the resource providers in CloudSim. We need at list
one of them to run a CloudSim simulation.
• Create Broker to simulate the user workload scheduling as well as virtual machine allocation
and placements.
• Create one/more virtual machine and submit to the broker for further submitting it to the
respective DataCenters for its placement and execution management during the simulation
run.
• Create one/more Cloudlet and submit the cloudlet list to the broker for further task
scheduling on the active virtual machines for its processing during the simulation run.
• Starts the simulation, this will initiate all the entities and components created above and put
them into execution for supporting various simulation operations.
• Stop the simulation, concludes simulation and flush all the entities & components before the
exit of a simulation run.
• Print results when the simulation is over, where you will be able to display which cloudlet
executed on which virtual machine along with how much time it spent in execution, its start
time as well as its finish time.
The main() method is the pointer from where the execution of this example starts public
static void main(String[] args)
There are eleven steps that are followed in each example with some variation in them, specified as
follows:
• Set the Number of users for the current simulation. This user count is directly proportional to
a where the createDatacenter() method itself initializes the various datacenter characteristics
along with the host list. This is the most important entity without this there is no way the
simulation of hosting the virtual machine is applicable.
int hostId = 0;
int bw = 10000;
hostList.add(
new Host(
hostId,
storage,
peList,
new VmSchedulerTimeShared(peList)
);
DatacenterCharacteristics characteristics = ne w
Cloudlet cloudlet;
Log.printLine();
cloudlet = list.get(i);
indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS)
Log.print("SUCCESS");
Log.printLine(indent + indent +
cloudlet.getResourceId()
cloudlet.getVmId()
+ indent + indent +
dft.format(cloudlet.getActualCPUTime())
+ indent + indent +
dft.format(cloudlet.getExecStartTime())
+ indent + indent +
dft.format(cloudlet.getFinishTime()));
OUTPUT:
Once you Run the example the output for cloudsimExample1.java will be displayed like:
CloudsimExample1.java console output
RESULT:
Thus simulation of cloud scenario using cloudsim was done successfully.
EX.NO:6 Find a procedure to transfer the files from one virtual
DATE: machine to another virtual machine.
AIM:
To execute the procedure for transfer the file from one virtual machine to another
virtual machine.
Goto Terminal, [oneadmin@frontend ~]$ onevm list OUTPUT:
ID USER GROUP NAME STATU CPU UMEM HOST TIME
3 oneadmin oneadmin kvm1 runn 2 512M kvm2.saec.com 0d 00h01 2 oneadmin
oneadmin kvm2 runn 2 512M kvm1.saec.com 0d 00h02
Goto Browser , Virtual Resources-> Virtual Machine -> Click -> oneadmin -> Migrate [live]
Select host -> click “Migrate”
RESULT:
Thus procedure for transferring the files from one virtual machine to another machine
was executed successfully
EX.NO:7 Find a procedure to launch virtual machine using trystack
DATE:
AIM:
To execute the procedure to launch virtual machine using trystack
1.1 Host file Entry in centos 7
***** Add following entry in /etc/hosts file on kvm1 kvm2 frontend ***** #vi
/etc/hosts
1.8 Check nfs SE Boolean settings only in kvm1 and kvm2 servers
# systemctl status firewalld|grep -i active
****Active: inactive (dead)****
# getsebool -a | grep use_nfs_home_dirs
EOT /
1.11 Install the required packages in kvm1 and kvm2 servers # yum -y install opennebula-node-
kvm
1.12 Install the gems package and dependencies in frontend1 servers
**On frontend1, now run install_gems to install all the gem dependencies (Select Cent-
OS/Redhat)** #
/usr/share/one/install_gems
****lsb_release command not found. If you are using a RedHat based distribution install
redhatlsb****
Sunstone listens only in the loopback interface by default for security reasons. To change it
edit
/etc/one/sunstone-server.conf and change :host: 127.0.0.1 to :host: 0.0.0.0.****on 31th line Now
we can start the services
# serviceopennebula-sunstone start
Check to see service is enabled for different runlevels to start on reboot;
# chkconfig --list 2>/dev/null|grep -i open opennebula 0:off 1:off 2:on 3:on 4:on 5:on 6:off
opennebula-sunstone 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#vi /etc/exports
/var/lib/one/ *(rw,sync,no_subtree_check,no_root_squash,insecure)
# exportfs –ra On KVM1 and KVM2 servers ,check NFS
# showmount -e frontend1
****Refresh the NFS exports by doing on FRONT end 1****
#systemctl status nfs.service #systemctl start nfs.service #systemctl enable nfs-server.service
****On kvm1 and kvm2****
#systemctl status nfs-client.target #systemctl start nfs-client.target
1.16 On KVM1 and KVM2 servers ,check NFS #systemctl | grep -i nfs
# mount -a -t nfs
# df -h /var/lib/one (check to see if it is mounted)
Reboot kvm1 and kvm2 to see if homedirs are mounted on reboot
# df -h /var/lib/one (check to see if it is mounted)
1.18.On frontend1 server configure ssh public key
OpenNebula will need to SSH passwordlessly from any node (including the frontend) to any other
node.
Add the following snippet to ~/.ssh/config as oneadmin so it doesn’t prompt to add the keys to
the known_hosts file:
# su - oneadmin
$ cat<< EOT > ~/.ssh/config Host * StrictHostKeyChecking no
UserKnownHostsFile /dev/null EOT
#vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
DEVICE=eno16777736 BOOTPROTO=none NM_CONTROLLED=no ONBOOT=yes
TYPE=Ethernet
****BRIDGE=br0****
#vi /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE=br0
TYPE=Bridge ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=no
****Password is here****
****On frontend1****
#su - oneadmin
#cat ~/.one/one_auth
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
Goto Run -> type cmd -> ipcongif Check the IP ADDRESS of your system.
Goto FrontEnd,
OUTPU
T:
ID USER GROU NAME CLUSTE BRIDGE LEASES 1
P R
oneadmin oneadmin private - br0 0
Name : TTYLinux_1.0
Type: Select “DATABLOCK “
Image Location : Select “Empty Datablock”
Size: 512
FS: qcow2
CLICK “CREATE”
Goto Terminal,
[oneadmin@frontend ~]$ oneimage list
ID USER GROUP NAME DATASTORE SIZE TYPE PER STAT RVMS
2 oneadmin oneadmin TTYLinux_1.0 default 512M DB No rdy 0
Goto Terminal,
[oneadmin@frontend ~]$ onetemplate list OUTPUT:
ID USER GROUP NAME REGTIME
2 oneadmin oneadmin TTYLinux_1.o 08/21
12:38:42
Goto Virtual Resources -> Templates -> click the file Now click Instantiate ->
VM NAME : kvm1
Click -> Instantiate
Goto Terminal,
[oneadmin@frontend ~]$ onevm list
OUTPUT:
ID USER GROUP NAME STATU CPU UMEM HOST TIME
3 oneadmin oneadmin kvm1 runn 2 512M kvm2.saec.com 0d 00h01 2
oneadmin oneadmin kvm2 runn 2 512M kvm1.saec.com 0d 00h02
RESULT:
Thus procedure to launch virtual machine using trystack was done successfully
EX.NO:08 Install Hadoop single node cluster and run simple
DATE: applications like wordcount.
AIM:
To install Hadoop single node cluster and run simple applications like wordcount
PROCEDURE:
Step 1:Log on to your Cent OS machine by root User name->root
Password->redhat
Step2:Disable your firewall & set the selinux mode Permissive
#systemctl disable firewalld # systemctl stop firewalld
# systemctl status firewalld
#setenforce 0 #getenforce
Uninstall your previous java version:
#yum erase java*
Install epel release:
#yum install epel-release
Install new java version (java 1.8.0_91) #yum install java 1.8.0* Adding hadoop user:
#useraddhadoop #hadooppasswd
Enter your password here: Retype your pass word: Switch to hadoop
user:
#su – hadoop
Key generation:
#key-gen **(on root)**
#ssh-copy-id hadoop@hadoop12
$key-gen (on hadoop)
$ ssh-copy-id root@hadoop12
$vi ~/.bashrc
export HADOOP_HOME=/home/hadoop/hadoop
export HADOOP_INSTALL=$HADOOP_HOME export
HADOOP_MAPRED_HOME=$HADOOP_HOME export
HADOOP_COMMON_HOME=$HADOOP_HOME export
HADOOP_HDFS_HOME=$HADOOP_HOME export
YARN_HOME=$HADOOP_HOME export
HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native export
PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
$vi $HADOOP_HOME/etc/hadoop/hadoop-env.sh
Delete previous path
Add this path export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-1.b14.el7_2.x86_64
Edit core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Edit hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>
</configuration>
Edit mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
Edit yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
Format Namenode
Now format the namenode using following command, make sure that Storage directory is
$ hdfsnamenode –format
Now run start-dfs.sh script.
$ start-dfs.sh
http://IP_ADDRESS:50070
Then check datanodes :
***In Datanode the single node was added***
open hadoop
{
Char ch[]= new char[s.length()]; for(i=0;i<s.length();i++)
{ ch[i]=
s.charAt(i);
$java wrdcnt
OUTPUT:
RESULT:
Thus installation of Hadoop single node cluster and running of simple applications like
wordcount was executed successfully