Cloud Lab Manual
Cloud Lab Manual
LIST OF EXPERIMENTS
Exp. Page
Name of The Experiments
No. No.
Install Virtualbox/VMware Workstation with different flavours of 3
1 linux or windows OS on topof windows7 or 8
Ex.No : 1
INSTALL VIRTUALBOX/VMWARE WORKSTATION
AIM
Find procedure to Install Virtualbox/VMware Workstation with different flavours of linux
orwindows OS on top of windows7 or 8.
PROCEDURE TO INSTALL
Step 1- Download Link
Link for downloading the software is
https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html. Download
the software for windows. Good thing is that there is no signup process. Click and download
begins. Software is around 541 MB.
screenshot
Step 5- VMware Workstation Setup wizard
Now you will see VMware Workstation setup wizard dialog box. Click next to continue.
P
This time you should see End User Licence Agreement dialog box. Check “I accept the terms in the
Licence Agreement” box and press next to continue.
Next step is to select the place you want the shortcut icons to be placed on your system to launch
the application. Please select both the options, desktop and start menu and click next.
P
Screenshot for VMware Workstation 15 pro installation begin confirmation dialog box on windows 10.
At the end you will see installation complete dialog box. Click finish and you are done with the installation
process. You may be asked to restart your computer. Click on Yes to restart.
If you see the dialog box asking for licence key, click on trial or enter the licence key. Then what
you have is the VMware Workstation 15 Pro running on your windows 10 desktop. If don’t have
the licence key, you will have 30 days trial.
At some point of time if you decide to buy the Licence key, you can enter the Licence key by
goingto Help->Enter a Licence Key You can enter the 25 character licence key in the
dialog box shown below and click OK. Now you havethe licence version of the software.
P
Ex.No:2
INSTALL A C COMPILER IN THE VIRTUAL MACHINE CREATED
Aim:
To install a C compiler in the virtual machine created virtual box and execute simple programs
InstallVirtualBox
● Visit http://www.virtualbox.org/wiki/downloads
● DownloadVirtualBox platform packages for your OS
● Open the Installation Package by double
clicking PC
● MAC
MAC PC
P
● When finished installation,close the window.
Download Linux
MAC PC
MAC PC
P
5. Choose the amount of memory to allocate (I suggestchoosing between 5I2 MB to I024 MB)
6. Click Continue or Next
MAC PC
MAC PC
MAC PC
11. Choose“DynamicallyAllocated” click continue. This way,the size of yourVirtual Hard
Disk will growas you use.
P
MAC PC
12. Click the folder icon and choose the ubuntu isofile you downloaded.
13. Select the size of the Virtual Disk (I recommendchoosing 8 GB) and click continue
MAC PC
I4.Click Create
MAC PC
P
Running Linux
MAC PC
3. Click the folder icon and choose the ubuntu iso file you downloaded and click continue and start
MAC PC
P
6. Choose “Erase disk and install Ubuntu” and click Forward (Don’t worry,it won’t
wipe your computer)
C Programming on Linux
1. OpenTerminal (Applications-Accessories-Terminal)
2. Open gedit by typing“gedit &” on terminal (You can also use any otherText Editor application)
9. If you see“HelloWorld” on the next line, you just successfully ran your first C program!
10. Try other codes from“A Shotgun Introduction to C” on professor Edwards’s webpage.You
can also findmanyC programing guides online.(just google it!) Enjoy :)
P
Ex.No:3
INSTALLING AND RUNNING THE GOOGLE APP
ENGINE ON WINDOWS
AIM:
To install Google App Engine, Create a “hello world” app and other simple web application
using PythonJava
PROCEDURE
Pre-•Requisites: Python 2.5.4
http://www.python.org/download/releases/2.5.4/
You can download the Google App Engine SDK by going to:
http://code.google.com/appengine/downloads.html
Click through the installation wizard, and it should install the App Engine. If you donot
have Python 2.5, it will install Python 2.5 as well.
Once the install is complete you can discard the downloaded installer
Now you need to create a simple application. We could use the “+” option to havethe
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 theFolder 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: application: ae-
01-trivial version: 1
runtime: python
api_version: 1 P
handlers:
- url: /.*
script:
index.py
Note: Please do not copy and paste these lines into your text editor – you might endup 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 addedthe 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 yourapplication
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:8080into your browser and you should see yourapplication as follows:
Just for fun, edit the index.py to change the name “Chuck” to your own name andpress Refresh
You can watch the internal log of the actions that the web server is performing whenyou 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:
P
Each time you press Refresh in your browser – you can see it retrieving the outputwith a GET
request.
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 startand 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 caseI made a
Python syntax error on line one of our one-••line application.
Reference: http://en.wikipedia.org/wiki/Stack_trace
P
When you make a mistake in the app.yaml file – you must the fix the mistake andattempt to
start the application again.
If you make a mistake in a file like index.py, you can simply fix the file and pressrefresh in your
browser – there is no need to restart the server.
f
P
P
Ex.No :5 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.
PROCEDURE
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 such
as 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.
6. 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 coversthe time or
spaceshared, the time zone and its price:
8. 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())
P
10. Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel,
utilizationMode
14. Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel,
utilizationMode
Simulation completed.
OUTPUT
CloudSimExample1 finished!
P
Ex.No : 6 FIND A PROCEDURE TO TRANSFER THEFILES 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.
PROCEDURE
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 machine,
settings, general, advanced, drag and drop: set to bidirectional )
3. You can have common Shared Folders on both virtual machines and use one of
the directory shared as buffer to copy.
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).
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.
6. 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.
P
7. You can enable drag and drop too with the same method (Click on the machine,
settings, general, advanced, drag and drop: set to bidirectional )
8. You can have common Shared Folders on both virtual machines and use one of
the directory shared as buffer to copy.
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.
9. 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).
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.
10. 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 read/write/execute to a directory or to chose a different directory
in which both users can read/write/execute.
AIM
To find a procedure to launch a virtual machine using trystack (online openstack demo version)
PROCEDURE
In order to try OpenStack in TryStack, you must register yourself by joining TryStack
Facebook Group. The acceptance of group needs a couple days because it’s approved
manually. After you have been accepted in the TryStack Group, you can log in TryStack.
TryStack.org Homepage
I assume that you already join to the Facebook Group and login to the dashboard.
After you log in to the TryStack, you will see the Compute Dashboard like
P
In this post, I will show you how to run an OpenStack instance. The instance will be accessible
through the internet (have a public IP address). The final topology will like:
Network topology
As you see from the image above, the instance will be connected to a local network and the local
network will be connected to internet.
Network? Yes, the network in here is our own local network. So, your instances will be not
mixed up with the others. You can imagine this as your own LAN (Local Area Network) in
the cloud.
P
Now, we will create an instance. The instance is a virtual machine in the cloud, like AWS
EC2. You need the instance to connect to the network that we just created in the previous
step.
I guess you already know what router is. In the step 1, we created our network, but it is
isolated. It doesn’t connect to the internet. To make our network has an internet connection,
we need a router that running as the gateway to the internet.
P
1. Go to Network > Routers and then click Create Router.
Fill RouterName for example router1 and then click Create router
2. Click on your router name link, for example router1, Router Details page.
3. Click Set Gateway button in upper right:
1. Select External networks with external.
2. Then OK.
4. Click Add Interface button.
1. Select Subnet with the network that you have been created in Step 1.
2. Click Add interface.
5. Go to Network > Network Topology. You will see the network topology. In the example,
there are two network, i.e. external and internal, those are bridged by a router. There are
instances those are joined to internal network.
Floating IP address is public IP address. It makes your instance is accessible from the
internet. When you launch your instance, the instance will have a private network IP, but no
public IP. In OpenStack, the public IPs is collected in a pool and managed by admin (in our
case is TryStack). You need to request a public (floating) IP address to be assigned to your
instance.
1. Go to Compute > Instance.
2. In one of your instances, click More > Associate Floating IP.
3. In IP Address, click Plus [+].
4. Select Pool to external and then click Allocate IP.
5. Click Associate.
6. Now you will get a public IP, e.g. 8.21.28.120, for your instance.
OpenStack has a feature like a firewall. It can whitelist/blacklist your in/out connection. It is
called Security Group.
1. Go to Compute > Access & Security and then open Security Groups tab.
2. In default row, click Manage Rules.
3. Click Add Rule, choose ALL ICMP rule to enable ping into your instance, and then click Add.
4. Click Add Rule, choose HTTP rule to open HTTP port (port 80), and then click Add.
5. Click Add Rule, choose SSH rule to open SSH port (port 22), and then click Add.
You can
open other
ports by
creating
new rules.
Now, you can SSH your instances to the floating IP address that you got in the step 4. If you
are using Ubuntu image, the SSH user will be ubuntu.
P
AIM
To install hadoop single node cluster and run simple applications like word count.
INSTALL HADOOP
Step 1: Click hereto download the Java 8 Package. Save this file in yourhome directory.
Command: wget
https://archive.apache.org/dist/hadoop/core/hadoop-2.7.3/hadoop- 2.7.3.tar.gz
Step 5: Add the Hadoop and Java paths in the bash file (.bashrc).Open. bashrc file. Now, add Hadoop
and Java Path as shown below.
Command: vi .bashrc
P
For applying all these changes to the current Terminal, execute the source command.
To make sure that Java and Hadoop have been properly installed on your systemand can be
accessed through the Terminal, execute the java -version and hadoopversion 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:
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
Step 8: Edit hdfs-site.xml and edit the property mentioned below inside
configuration tag:
Command: vi hdfs-site.xml
P
Step 9: Edit the mapred-site.xml file and edit the property mentioned below
inside configuration tag:
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.
Step 10: Edit yarn-site.xml and edit the property mentioned below inside configuration tag:
Command: vi yarn-site.xml
P
Step 11: Edit hadoop-env.sh and add the Java Path as mentioned below:
hadoop-env.sh contains the environment variables that are used in the script to runHadoop
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 firsttime.
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 inthe
HDFS.
Step 13: Once the NameNode is formatted, go to hadoop-2.7.3/sbin directoryand 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
Start NameNode:
The NameNode is the centerpiece of an HDFS file system. It keeps the directory tree ofall
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.
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 thebelow command.
Command: jps