CCS335 Lab Manual FINAL
CCS335 Lab Manual FINAL
: 1
DATE:
Aim:
PROCEDURE:
1. Download the Virtual box exe and click the exe file…and select next button.
1
2. Click the next button..
2
4. Click the YES button..
3
6. Then installation was completed..the show virtual box icon on desktop screen….
4
Steps to create Virtual Machine through opennebula
3. Click on instances, select VMs then follow the steps to create Virtaul machine
c. Then enter the VM name,no.of instance, cpu. d. Then click on create button.
e. Repeat the steps the C,D for creating more than one VMs.
5
6
APPLICATIONS:
There are various applications of cloud computing in today’s network world. Many search engines
and social websites are using the concept of cloud computing like www.amazon.com,
hotmail.com, facebook.com, linkedln.com etc. the advantages of cloud computing in context to
scalability is like reduced risk , low cost testing ,ability to segment the customer base and auto-
scaling based on application load.
RESULT:
7
EX.NO.:2
DATE:
Install a C compiler in the virtual machine created using virtual box and execute Simple
Programs
Aim:
To Install a C compiler in the virtual machine created using virtual box and execute Simple
Programs.
PROCEDURE:
8
Steps to run c program:
3. gedit hello.c
4. gcc hello.c
5. ./a.out
9
3. Type the c program
10
5. Display the output:
APPLICATIONS:
RESULT:
11
EX NO.:3
DATE:
Install Google App Engine. Create hello world app and other simple web applications using
python/java.
Aim:
To Install Google App Engine. Create hello world app and other simple web applications using
python/java.
Procedure:
Read this guide – how to install Google Plugin for Eclipse. If you install the Google App Engine
Java SDK together with “Google Plugin for Eclipse“, then go to step 2, Otherwise, get the
Google App Engine Java SDK and extract it.
In Eclipse toolbar, click on the Google icon, and select “New Web Application Project…”
Figure – Deselect the “Google Web ToolKit“, and link your GAE Java SDK via the “configure
SDK” link.
12
Click finished, Google Plugin for Eclipse will generate a sample project automatically.
13
3. Hello World
HelloWorld/
src/
...other configuration...
war/
14
...compiled classes...
Copy
The extra is this file “appengine-web.xml“, Google App Engine need this to run and deploy the
application.
File : appengine-web.xml
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>
<version>1</version>
<system-properties>
</system-properties>
</appengine-web-app> Copy
4. Run it local
Eclipse console :
//...
Copy
15
and also the hello world servlet – http://localhost:8888/helloworld
application.
File : appengine-web.xml
16
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>mkyong123</application>
<version>1</version>
<system-properties>
</system-properties>
</appengine-web-app>
Copy
Figure 1.2 – Sign in with your Google account and click on the Deploy button.
17
Figure 1.3 – If everything is fine, the hello world web application will be deployed to this URL –
http://mkyong123.appspot.com/
Result:
18
EX. NO.:4
DATE:
Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not present
in CloudSim.
Aim:
To Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not present
in CloudSim.
Steps:
CloudSim is written in Java. The knowledge you need to use CloudSim is basic Java programming
and some basics about cloud computing. Knowledge of programming IDEs suchas Eclipse or
NetBeans is also helpful. It is a library and, hence, CloudSim does not have to be installed.
Normally, you can unpack the downloaded package in any directory, add it to the Java classpath
and it is ready to be used. Please verify whether Java is available on your system.
2. Open Eclipse
The first step is to initialise the CloudSim package by initialising the CloudSim library, as follows
CloudSim.init(num_user, calendar, trace_flag)
5. Data centres are the resource providers in CloudSim; hence, creation of data centres is a second
step. To create Datacenter, you need the DatacenterCharacteristics object that stores the properties
of a data centre such as architecture, OS, list of machines, allocation policy that covers the time or
spaceshared, the time zone and its price:
19
7. The fourth step is to create one virtual machine unique ID of the VM, userId ID of the VM’s
owner, mips, number Of Pes amount of CPUs, amount of RAM, amount of bandwidth, amount
of storage, virtual machine monitor, and cloudletScheduler policy for cloudlets:
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared())
9. Create a cloudlet with length, file size, output size, and utilisation model:
10. Submit the cloudlet list to the broker: broker.submitCloudletList(cloudletList) Sample Output
from the Existing Example:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>null
: Broker: Cloud Resource List received with 1 resource(s) 0.0: Broker: Trying to Create VM #0
in Datacenter_0
VM #0
Simulation completed.
20
========== OUTPUT ==========
0 Start Time
400
0.1 400.1
Debt
3 35.6
CloudSimExample1 finished!
RESULT:
21
EX.NO.:5
DATE:
Aim:
Steps:
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:
And then make a sub-•‐folder in within apps called “ae-•01-•trivial” – the path to this folder would
be:
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:
script: index.py
Note: Please do not copy and paste these lines into your text editor – you might end
Then create a file in the ae-•01-•trivial folder called index.py with three lines in it:
22
Then start the Google App Engine Launcher 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,editthe index.pytochangethe name“Chuck” to yourownname and press Refresh in the
browser to verify your updates.
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:
23
Dealing With Errors
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:
24
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.
Result:
25
EX.NO:6
DATE:
Find a procedure to transfer the files from one virtual machine to another virtual machine.
Aim:
To Find a procedure to transfer the files from one virtual machine to another virtual machine.
Steps:
1. You can copy few (or more) lines with copy & paste mechanism.
For this you need to share clipboard between host OS and guest OS, installing
Guest Addition on both the virtual machines (probably setting bidirectional and restarting them).
You copy from guest OS in the clipboard that is shared with the host OS.
Then you paste from the host OS to the second guest OS.
2. You can enable drag and drop too with the same method (Click on the
3. You can have common Shared Folders on both virtual machines and
Installing Guest Additions you have the possibility to set Shared Folders too. As you put a file in
a shared folder from host OS or from guest OS, is immediately visible to the other. (Keep in
mind that can arise some problems for date/time of the files when there are different clock settings
on the different virtual machines).
If you use the same folder shared on more machines you can exchange files directly copying them
in this folder.
4. You can use usual method to copy files between 2 different computer with client-server
application. (e.g. scp with sshd active for linux, winscp... you can get some info about SSH servers
e.g. here)
You need an active server (sshd) on the receiving machine and a client on the sending machine.
Of course you need to have the authorization setted (via password or, better, via an automatic
authentication method).
26
Note: many Linux/Ubuntu distribution install sshd by default: you can see if
it is running with pgrep sshd from a shell. You can install with sudo apt-get install openssh- server.
5. You can mount part of the file system of a virtual machine via NFS or
SSHFS on the other, or you can share file and directory with Samba. You may find interesting the
article Sharing files between guest and host without VirtualBox shared folders with detailed step
by step instructions.
You should remember that you are dialling with a little network of machines with different
operative systems, and in particular:
Each virtual machine has its own operative system running on and acts as a physical machine.
Each virtual machine is an instance of a program owned by an user in the hosting operative system
and should undergo the restrictions of the user in the hosting OS.
E.g Let we say that Hastur and Meow are users of the hosting machine, but they did not allow each
other to see their directories (no read/write/execute authorization). When each of them run a virtual
machine, for the hosting OS those virtual machine are two normal programs owned by Hastur and
Meow and cannot see the private directory of the other user. This is a restriction due to the hosting
OS. It's easy to overcame it: it's enough to give authorization to
I mean I suggest you to enable Drag & drop to be cosy with the Windows
When you will need to be fast with Linux you will feel the need of ssh-keygen and
to Generate once SSH Keys to copy files on/from a remote machine without writing password
anymore. In this way it functions bash auto-completion remotely too!
PROCEDURE: Steps:
27
a. Click on infrastructure
e. Then select datastores tab, and select all datastores f. And then choose host under
infrastructure tab
g. Click on + symbol to add new host, name the host then click on create.
Before migration
Host:SACET
28
Host:one-sandbox
29
After Migration:
30
Host:one-sandbox
Host:SACET
APPLICATIONS:
Result:
31
EX.NO:7
DATE:
Install Hadoop single node cluster and run simple applications like wordcount.
Aim:
Steps:
Install Hadoop
Step 1: Click here to download the Java 8 Package. Save this file in your home directory.
2.7.3.tar.gz
32
Command: tar -xvf hadoop-2.7.3.tar.gz
5: Add the Hadoop and Java paths in the bash file (.bashrc). Open. bashrc
Command: vi .bashrc
For applying all these changes to the current Terminal, execute the source command.
33
To make sure that Java and Hadoop have been properly installed on your system and can be
accessed through the Terminal, execute the java -version and hadoop version commands.
Command: cd hadoop-2.7.3/etc/hadoop/
Command: ls
All the Hadoop configuration files are located in hadoop-2.7.3/etc/hadoop directory as you can
see in the snapshot below:
34
Fig: Hadoop Installation – Hadoop Configuration Files
Step 7: Open core-site.xml and edit the property mentioned below inside configuration
tag:
core-site.xml informs Hadoop daemon where NameNode runs in the cluster. It contains
configuration settings of Hadoop core such as I/O settings that are common to HDFS &
MapReduce.
Command: vi core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
35
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Step 8: Edit hdfs-site.xml and edit the property mentioned below inside
configuration tag:
Command: vi hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permission</name>
<value>false</value>
36
</property>
</configuration>
Step 9: Edit the mapred-site.xml file and edit the property mentioned below
In some cases, mapred-site.xml file is not available. So, we have to create the mapred- site.xml
file using mapred-site.xml template.
Command: vi mapred-site.xml.
<configuration>
<property>
<name>mapreduce.framework.name</name>
37
<value>yarn</value>
</property>
</configuration>
Step 10: Edit yarn-site.xml and edit the property mentioned below inside
configuration tag:
Command: vi yarn-site.xml
Step 11: Edit hadoop-env.sh and add the Java Path as mentioned below:
<?xml version="1.0">
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</ name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
38
</property>
hadoop-env.sh contains the environment variables that are used in the script to run Hadoop like
Java home path, etc.
Command: vi hadoop–env.sh
Command: cd
Command: cd hadoop-2.7.3
This formats the HDFS via NameNode. This command is only executed for the first time.
Formatting the file system means initializing the directory specified by the dfs.name.dir variable.
Never format, up and running Hadoop filesystem. You will lose all your data stored in the
HDFS.
Step 13: Once the NameNode is formatted, go to hadoop-2.7.3/sbin directory and start all the
daemons.
Command: cd hadoop-2.7.3/sbin
Either you can start all daemons with a single command or do it individually.
Command: ./start-all.sh
39
The above command is a combination of start-dfs.sh, start-yarn.sh & mr-jobhistory- daemon.sh
Start NameNode:
The NameNode is the centerpiece of an HDFS file system. It keeps the directory tree of all files
stored in the HDFS and tracks all the file stored across the cluster.
Start DataNode:
On startup, a DataNode connects to the Namenode and it responds to the requests from the
Namenode for different operations.
Start ResourceManager:
ResourceManager is the master that arbitrates all the available cluster resources and thus helps in
managing the distributed applications running on the YARN system. Its work is to manage
each NodeManagers and the each application’s
ApplicationMaster.
40
Fig: Hadoop Installation – Starting ResourceManager
Start NodeManager:
The NodeManager in each machine framework is the agent which is responsible for managing
containers, monitoring their resource usage and reporting the same to the ResourceManager.
Start JobHistoryServer:
JobHistoryServer is responsible for servicing all job history related requests from client.
Step 14: To check that all the Hadoop services are up and running, run the below command.
Command: jps
Step 15: Now open the Mozilla browser and go to localhost:50070/dfshealth.html to check the
NameNode interface.
41
Fig: Hadoop Installation – Starting WebUI
Result:
Thus, the Hadoop one cluster was installed and simple applications executed successfully.
42
EX.NO:8
DATE:
Aim:
Procedure:
2. Create a project
In order to create your first Docker application, I invite you to create a folder on your computer.
It must contain the following two files:
A ‘main.py’ file (python file that will contain the code to be executed).
A ‘Dockerfile’ file (Docker file that will contain the necessary instructions to create the
environment).
├── Dockerfile
└── main.py
0 directories, 2 files
43
#!/usr/bin/env python3
print("Docker is magic!")
Nothing exceptional, but once you see “Docker is magic!” displayed in your terminal you will
know that your Docker is working.
The first step to take when you create a Docker file is to access the DockerHub website. This site
contains many pre-designed images to save your time (for example: all images for linux or code
languages).
# So we write 'python' for the image name and 'latest' for the version.
FROM python:latest
# In order to launch our python code, we must import it into our image.
# The first parameter 'main.py' is the name of the file on the host.
# The second parameter '/' is the path where to put the file on the image.
COPY main.py /
# We need to define the command to launch when we are going to run the image.
Once your code is ready and the Dockerfile is written, all you have to do is create your image to
contain your application.
44
$ docker build -t python-test .
The ’-t’ option allows you to define the name of your image. In our case we have chosen
’python-test’ but you can put what you want.
You need to put the name of your image after ‘docker run’.
Result:
Thus, the creation and execution of container program using Docker executed successfully.
45
EX.NO:9
DATE:
Aim:
docker version
docker login
Step-3: Run the downloaded Docker Image & Access the Application
http://localhost/hello
docker ps
docker ps -a
docker ps -a -q
46
Step-7: Remove Container
docker rm <container-name>
docker images
Result:
47