0% found this document useful (0 votes)
137 views83 pages

CS8711 Cloud Lab Manual

Lab manual

Uploaded by

Bhuvanesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views83 pages

CS8711 Cloud Lab Manual

Lab manual

Uploaded by

Bhuvanesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

K S R INSTITUTE FOR ENGINEERING AND TECHNOLOGY,

TIRUCHENGODE
Department of Computer Science and Engineering

Vision, Mission, Program Educational Objectives (PEOs) and Program Outcomes (POs), PSOs

Vision
To produce globally competitive Computer Science Engineers and Entrepreneurs with moral values.
Mission
DM1 Provide quality education to enhance problem solving skills, leadership qualities,team-
(Quality spirit and ethical responsibilities.
Education)
DM2 Enable the students to adapt to the rapidly changing technologies by providing
(State of art advanced laboratories and facilities.
Laboratory)
DM3 Promote research based activities in the emerging areas of techno-environment in
(Research) order to meet industrial and societal needs.

Program Educational Objectives (PEOs)


Graduates will acquire a strong foundation in mathematical,
PEO1 Core Competency scientific and engineering fundamentals necessary to formulate,
solve and analyze Computer Science and Engineering problems.
Graduates will practice the profession with ethics, integrity and
PEO2 Professionalism leadership to relate engineering to global perspective issues and
social context.
Graduates will be prepared for their careers in the software industry
Higher Studies and or in higher studies leading to research and for applying the spirit of
PEO3
Entrepreneurship innovation and entrepreneurship in their career and continuing to
develop their professional knowledge on a life long basis.
PROGRAMME OUTCOMES (POs)

PO1: Engineering knowledge: Ability to apply the knowledge of mathematics, physical sciences and
computer science and engineering specialization to the solution of complex engineering problems.
PO2: Problem analysis: Ability to identify, formulate and analyze complex real life problems in
order to provide meaningful solutions by applying knowledge acquired in computer science and
engineering.
PO3: Design/development of solutions: Ability to design cost effective software / hardware solutions
to meet desired needs of customers/clients.
PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions in the field of computer science and engineering.
PO5: Modern tool usage: Create, select and apply appropriate techniques, resources and modern
computer science and engineering tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive clear
instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one‟s own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage
in independent and life-long learning in the broadest context of technological change.

PROGRAMME SPECIFIC OUTCOMES ( PS O’s)

PSO1: Software System Design and Development: The ability to apply software development life
cycle principles to design and develop the application software that meet the automation needs of
society and industry.
PSO2: Computing and Research ability: The ability to employ modern computer languages,
environments and platforms in creating innovative career paths in SMAC (Social, Mobile, Analytics
and Cloud)technologies
CS8711 Cloud Computing Laboratory

LIST OF EXPRIMENTS TOTAL : 60 PERIODS

1. Install Virtualbox/VMware Workstation with different flavours of linux or windows OS on top of


windows7 or 8.
2. Install a C compiler in the virtual machine created using virtual box and execute Simple Programs
3. Install Google App Engine. Create hello world app and other simple web applications using
python/java.
4. Use GAE launcher to launch the web applications.
5. Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not present in
CloudSim.
6. Find a procedure to transfer the files from one virtual machine to another virtual machine.
7. Find a procedure to launch virtual machine using trystack (Online Openstack Demo Version)
8. Install Hadoop single node cluster and run simple applications like wordcount.

1
2
EX: NO: 1 INSTALL VIRTUALBOX/VMWARE WORKSTATION
WITHDIFFERENT FLAVOURS OF LINUX OR
DATE:
WINDOWS OS ON TOP OF WINDOWS 7 OR 8

AIM:
To learn the Virtualization setup with xen system and installing ubuntu in virtual machine

PROCEDURE:

INTRODUCTION OF THE CONCEPT/TOOL:


Xen is a free open source software virtual machine monitor for Intel /PowerPC
architectures. It is software that runs on a host operating systemand allows several guest
operating systems to be run on top of the host onthe same computer hardware at the same time.
Virtual machine monitors (also known as hypervisors) often operate on mainframes
andlarge servers running IBM, HP, and other systems. Internet hosting service
companiesincreasingly use hypervisors to provide virtual private servers. Both Amazon EC2
andRackspace Cloud use Xen as the VM hypervisor.
Server virtualization can provide benefits such as:
● Consolidation
●Increased utilization
● Rapid provisioning
● Dynamic fault tolerance against software failures (through rapidbootstrapping or
rebooting)
● Hardware fault tolerance (through migration of a virtual machine todifferent hardware)
● The ability to securely separate virtual operating systems
● The ability to support legacy software as well as new OS instances on thesame
computer
● Types of virtualization
○ Paravirtualization, requiring porting of guest systems
○ Hardware assisted virtualization, allowing for unmodifiedguests

3
OUTPUT:

4
DESCRIPTION OF THE EXERCISE:
● In this exercise, we would be installing and configuring xen on the base system
● We would be installing and configuring libvirtd
● We would create a sample machine on top of xen+libvirtd
● Installing a ubuntu in a virtual machine

PREREQUISITE:
● Fedora 12 installed with root access (root access for configurationpurposes)
● LAN connection with a network setup to access network resources /internet
● selinux disabled “setenforce 0 “ can be given at command line to disableit runtime
● FOSS lab Server or Internet Connectivity for downloading/installingpackages

DETAILED STEPS FOR THE EXERCISE:


Note:In the description (steps), all greyed out lines are actual commands/configurations
done on the server
Step 1: Preparing the Base System For Virtualization
Install the required packages for virtualization using the following command
# yum install xen virtmanagerkernelxenqemu libvirt
configure xend to start up on boot
# chkconfig xend on
Reboot the machine to boot into the new kernel
# reboot
Step 2: Creatinga Virtual Machine
# virtmanager&
for ease in configuration please use GUI tool called virtmanager:
a) Click on file connect to connect to localhost
b) In the base menu, please rightclickon the localhost (QEMU) to create a newVM. Please name
the VM as per your choice Once the name of the vm is entered, please click on “forward”
c ) In the next screen, select the Use ISO image option then click the Browseoption.
In the next screen click the Browse Local option on the bottomleftsection of thescreen.
In the next screen please select the ISO image file of your own choice (Ubuntu,centos, fedora
etc) After selecting the ISO file please select OS Type as Linux and Version as Generic2.6.x
kernel.

5
6
d) In the next screen, please select the CPU and RAM limits for the VM. By default
they are 512M and one CPU.
e) In the next screen, please select the required size for the VM (By default 8GB)
f) In the next screen, by default no networking is selected without using a bridge.
If required networking can be enabled for the VM by creating a bridge. Pleaseclick on
Finish to start creating the machine. Once the machine is created, thesame would be displayed on
the virtmanagerscreen and the VM can be started,stopped by selecting the VM and
rightclickingto select options.
g) Please wait until Ubuntu installation wizard appear.
h) In the next screen select Install Ubuntu 10.04 LTS option to install the UbuntuOS in your
virtual manager.
In the next screen select Region and Time zone as India and India Timerespectively.
j) Please select the Keyboard layout as default.
k) In the next window select Specify partitions manually(advanced) option to do
partition for your Ubuntu OS.
l) In the next screen please select the New Partition Table option. It will shows the following
confirmation window. Please select Continue option toin that window to continue the installation
process.Then in the next screen select the free space and click add option to do partition.
m) In the next screen select the size for primary partition and mount point as root(/)and Use as
Ext4 journaling file system.
n) In the next screen again select the free space and click add option to dopartition.
o) To do partition for Swap selects the size for swap area and use as Swap areaand select the
Logical option.
p) In the next window click Forward.
q) In the next window click Install to trigger the installation process.
r) The next screen shows the Ubuntu installation process. Please wait until theinstallation process
is over.
s) In the next screen click Restart Now option to restart the virtual manager.
t) The next screen shows logon window. Please give password to logon into
yournew Virtual operating system.

7
8
9
10
PRELAB VIVA QUESTIONS:

1. What is meant by virtualization?


2. What does virtual machine do?
3. What is the role of VM Ware in virtual machine?
4. Is 32 bit processor supports Virtual Machine?
5. What is meant by IBM and HP?

POSTLAB VIVA QUESTIONS:


1. Explain the steps to install oracle virtual box?
2. How to create two VMs on your laptop?
3. How to specify an amount of disk space to allocate for a virtual machine?
4. Specify the full names of (.iso, .rar, .nrg) files.
5. What is meant by Para virtualization?

RESULT:
Thus the Virtualization Environment was created using ubuntu.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

11
12
EX: NO: 2 INSTALL A C COMPILER IN THE VIRTUAL MACHINE
CREATED USING VIRTUAL BOX AND EXECUTE
DATE:
SIMPLE PROGRAMS

AIM:
To install a C compiler in the virtual machine created using virtual box and execute
Simple Programs.

PROCEDURE:
INTRODUCTION:
Open source software is distributed in source code form. In case of popular software Linux
distributions will often have the software packaged in their repositories. If the package is not
package is not in the repository the user has to compile the software from source. To dothisthe
user has to understand about the build system used in the project.
The GNU build system, also known as the Autotools, is a suite of programming
toolsdesigned to assist in making source-code packages portable to many Unix-like systems. It
canbe difficult to make a software program portable: the C compiler differs from system to
system;certain library functions are missing on some systems; header files may have different
names.One way to handle this is write conditional code, with code blocks selected by means of
preprocessor directives (#ifdef); but because of the wide variety of build environments this approach
quickly becomes unmanageable. The GNU build system is designed to address this problem more
manageably.

Tools included in the GNU build system


The GNU build system comprises the GNU utility programs Autoconf, Automake, and
Libtool.Other related tools frequently used with the GNU build system are GNU‟s make program,
GNUgettext, pkg-config, and the GNU Compiler Collection, also called GCC.

1. Make
We will be using a simple program written in C and write a makefile to compile the program.
> mkdir gnumake
> cd gnumake
> gedit squareroot.c

13
OUTPUT:

14
The Code:
// A simple program that computes the square root of a number
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char *argv[])
{
if (argc <2)
{
fprintf(stdout,"Usage: %s number\n",argv[0]);
return 1;
}
double inputValue = atof(argv[1]); double
outputValue = sqrt(inputValue);
fprintf(stdout,"The square root of %g is %g\n",
inputValue, outputValue);
return 0;
}

Test it by compiling it once:


> gcc squareroot.c -o squareroot -lm
> ./sqaureroot 49
> The square root of 49 is 7

15
16
17
18
PRELAB VIVA QUESTIONS:
1. What is meant guest OS?
2. What is meant by host OS?
3. Why the RAM size to be allocated to your guest OS?
4. Why to provide connectivity between guest OS and host OS?
5. What is meant by GNU build system?

POSTLAB VIVA QUESTIONS:

1. If guest OS takes the 50% of your physical machine„s RAM size what happens?
2. Why to create a Virtual Hard disk for your Virtual Machine?
3. What does .vdi extension file contains inside the virtual machine?
4. Define the ― Dynamically expanding disk.
5. What are the tools involved in GNU build system?

RESULT:
Thus the program to compile from source is implemented an executed successfully using
various build system.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

19
20
INSTALL GOOGLE APP ENGINE CREATE HELLO WORLD
EX: NO: 3
APP AND OTHERSIMPLE WEB APPLICATIONS USING
DATE:
PYTHON/JAVA
AIM:
To install google app engine in PC and create hello world app and other simple web
applications using python/java.

PROCEDURE:
Install the latest Cloud SDK version (303.0.0)
Step 1: Download the Cloud SDK installer.

(New-Object
Alternatively, open a PowerShell terminal and run the following PowerShell commands.
Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/cha
nnels/ra
pid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")

& $env:Temp\GoogleCloudSDKInstaller.exe

Step 2: Launch the installer and follow the prompts. The installer is signed by Google LLC.
Cloud SDK requires Python. Supported versions are 3.5 to 3.7, and 2.7.9 or higher.

The installer will install all necessary dependencies, including the needed Python version. While
Cloud SDK currently uses Python 2 by default, you can use an existing Python installation if
necessary by unchecking the option to 'Install Bundled Python'. .

Note: Cloud SDK uses Python 2 by default, but will soon move to Python 3 (run gcloud topic
startup for exclusions and more information on configuring your Python interpreter to use a
different version). Consider upgrading to Python 3 to avoid disruption in the future.

Step 3: After installation has completed, accept the following options:


Start Cloud SDK Shell
Run gcloud init

21
OUTPUT:

22
The installer starts a terminal window and runs the gcloud init command.
Step 4: The default installation does not include the App Engine extensions required to deploy
an application using gcloud commands. These components can be installed using the Cloud SDK
component manager.
Optional: Enable accessibility features
For a more streamlined screen reader experience, the gcloud command-line tool comes with an
accessibility/screen_reader property.

gcloud config set accessibility/screen_reader true

Percentage progress bars: Progress will be displayed as a percentage, outputted to stderr.

Boxed tables drawn with ASCII characters: Boxed tables are the default output of many list
commands. Instead of being drawn with Unicode, they will be rendered using ascii characters.
Also, consider using the --format flag to define your own format.
To enable these accessibility features, run:

$ gcloud config set accessibility/screen_reader true

Additional resources
Alternate documentation experiences
 To search the gcloud CLI reference docs for a keyword or command, use gcloud help.
This runs a search for all commands with help text matching the given argument or
arguments.

Refining gcloud CLI output

 To adjust the verbosity level of a command, you can set the gcloud CLI-wide flag --
verbosity with either debug, info, warning, error, critical, or none.

 For list commands, you can further refine your output by using the --limit flag to set a
maximum number of resources to list. You can also use the --page-size flag to define the
number of resources per page if the service lists output in pages. To sort, use the --sort-
by flag with the relevant field to sort.

 To disable interactive prompting, use the --quiet flag.

23
24
 To structure and produce more meaningful output, you can use the format, filter and
projection flags to fine-tune your output.

 If you'd like to define just the format of your output, use the --format flag to
produce a tabulated or flattened version of your output (for interactive display) or
a machine-readable version of the output (json, csv, yaml, value).

 To format a list of keys that select resource data values, use projections.

 To further refine your output to a criteria you'd like to define, use the --
filter flag.

Filing feedback

To file a bug, provide feedback, or send suggestions, use gcloud feedback to help
improve the gcloud command-line tool experience. This command will open the public issue
tracker in a browser window.

You can also directly log issues using issue tracker. Be sure to toggle the 'Type' field to
reflect the nature of the issue you're filing (Bug, Feature Request, etc.) to help make responses
more efficient.

To enable this property, run:

 Download Google Cloud SDKhttps://cloud.google.com/sdk/docs

 Login to google account and verify the account with google for the successful
authentication.
 Download webapp2 module from https://pypi.org/project/webapp2/

 Write down simple hello world python program.


import webapp2
class MainPage(webapp2.RequestHandler)
def get(self):
self.response.write("Hello World")

app = webapp2.WSGIApplications([('/',MainPage)], debug=True)

 Create app.yaml which has url link


25
26
 runtime: python3 api_version: 1
threadsafe: true

handlers:
-url: /
script: test.app

 Run the gcloud prompt and give Yes option to proceed further.
Install gcloud components using the command
gcloud components install cloud-datastore-emulator

27
28
PRELAB VIVA QUESTIONS:
1. What is Google app Engine and why it is used?
2. What two programming languages do App Engine‟s tool use?
3. Do you have to use a server to upload your application?
4. What is YAML?
5.How can we refine gcloud?
POSTLAB VIVA QUESTIONS:
1. How to download Cloud SDK?
2. What is the importance of command prompt ?
3. What is the version of python you are using?
4. What is the installation type?
5. How can we download Google Cloud?

RESULT:
Thus the installation of google app engine in PC and executed the simple hello world
application using python and output was verified successfully.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

29
30
EX: NO: 4
USE GAE LAUNCHER TO LAUNCH THE WEBAPPLICATIONS
DATE:

AIM:

To use GAe – Google App Engine launcher to launch the web application in google cloud.

PROCEDURE:
Setting Up Your Development Environment
To set up your environment for developing on Python 3:
1. Download and install the latest release of Python 3.

See Python 3 Runtime Environment for a list of the supported versions.

2. Download, install, and then initialize the Cloud SDK. If you already have the Cloud SDK
installed, run the gcloud components update command to update to the latest
release.

The Cloud SDK provides you the gcloud command-line tooling for deploying and
managing your apps.

By downloading, you agree to be bound by the Terms that govern use of the Cloud SDK
for App Engine.

Download and Install the Cloud SDK

Note: Avoid using a package manager such as apt or yum to install the Cloud SDK.
Installing optional tools
For access to code, samples, libraries, and tools in GitHub, install Git:
Download and install Git

Install your preferred tooling or framework, for example you can use any of the following
frameworks to develop your Python 3 app:

 Flask

 Django

31
32
 Pyramid

 Bottle

 web.py

 Tornado

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.

 css/: Directory to store stylesheets.


 style.css: Basic stylesheet that formats the look and feel of your site.
 images/: Optional directory to store images.
 index.html: An HTML file that displays content for your website.
 js/: Optional directory to store JavaScript files.
 Other asset directories.

Creating the app.yaml file

The app.yaml file is a configuration file that tells App Engine how to map URLs to your static
files. In the following steps, you will add handlers that will load www/index.html when someone
visits your website, and all static files will be stored in and called from the www directory.

Create the app.yaml file in your application's root directory:

1. Create a directory that has the same name as your project ID. You can find your project
ID in the Console.

2. In directory that you just created, create a file named app.yaml.

33
34
3. Edit the app.yaml file and add the following code to the file:
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>
<linkrel="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>

Deploying your application to App Engine


When you deploy your application files, your website will be uploaded to App Engine.
To deploy your app, run the following command from within the root directory of your
application where the app.yaml file is located:

gcloud app deploy

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]

To learn more about deploying your app from the command line, see Deploying a Python 2 App.

35
36
Viewing your application

To launch your browser and view the app


at https://PROJECT_ID.REGION_ID.r.appspot.com, run the following command:

gcloud app browse

Step 1 : Download the basic housekeeping stuff

No matter what platform you build products on, there is always some housekeeping stuff
you need to put in place before you can hit the ground running. And deploying apps within the
Google App Engine is no exception.

Download Python 2.7


As of when this article was written, the Google App Engine standard environment
supports Python only upto version 2.7. However, it is only a matter of time before support for
Python 3.x is added. You can check the App Engine docs for the latest info.

Download Google Cloud SDK

This will allow you to fork apps onto your local machine, make changes (edit and
develop the app), and deploy your app back to the cloud.

Set the Python path in the Google App Engine launcher

After downloading the SDK, launch the App Engine launcher, go to Edit -> Preferences
and make sure you set the path for where you installed Python in step 1 above.
Set the Python path in Google App Engine launcher That‟s all you need. Your local machine
should now be ready to build webapps.

Step 2 : App Engine sign-up

This is often the most confusing part of the entire setup. Things you should know when
you sign-up:

1. Currently, App Engine offers a free trial for one year.


2. The trial includes $300 of credit that can be used during the one year trial period.

37
38
3. You will need to add a credit card to sign-up (for verification purposes).
4. You will not be charged during the sign-up process.
5. You will not be charged during the trial period as long as you do not cross the credit limit
offered.

Here are the steps you need to follow to sign-up:

1. Go to the Google Cloud landing page


2. Follow the sign-up process and go to your App Engine dashboard
Most of the hard work is complete after a successful sign-up.
Step 3 : Create a new project

The next step is to create a new Python project that you can work on. Follow the
screenshots below to create a new project.

Launch the new project wizard.


Give your app a name and make a note of your project ID.

Hit the create button and Google should take a few minutes to set up all that is necessary for your
newly created app.

Step 4 : Fork the app to develop it locally

The next step in the process is to fork the app on your local machine. This will allow you to
make changes to the app locally and deploy it whenever you wish to.

Go to Google App Engine launcher and create a new application.


Enter the project ID of your newly created app. Also, provide the folder (local destination) where
you wish to store the app locally. Make sure you select the Python 2.7 as your runtime engine.

Hit the create button, and you should see your app listed on the window that follows. You should
also check that you now see some files in your local storage (the directory you chose in the
screenshot above) after this step.
Step 5 : Run the app locally

Before you go ahead and make some changes to the app, it is important to check whether
or not you have executed all the above steps correctly. This can be done by simply running the
app locally.

39
40
Select the app and hit the run button on the window.
Wait for a few seconds until you can hit the Browse button. Once the Browse button
becomes clickable, click it. This should take you to the browser, and you should see the hello
world text appear in your browser window. Alternatively, you can manually go to the browser
and use the port specified to access the app.
As long as you see the above screen, you are all set.

Step 6 : Understand the app structure

It is finally time to look at the lines of code which are running this webapp. Open your
app folder in the text editor of your choice. I recommend Sublime text or VS Code. However,
feel free to choose the one you prefer.

Here is a description of the various files.


app.yaml

This file is a basic markup file that stores information (some metadata) about the app. It is
important to note the following crucial parts of the file.
1. application

This is the project ID which you should never change. This is the unique identifier for the app

2. url -> script


This is the homepage for the app. In other words, this file will be rendered in your
browser when you launch the app

3. libraries
This is where you can include external libraries to use within the webapp
main.py
This is the homepage of the app (as discussed above). Note that the hello world text in the
browser window (step 5) is due to the code you see highlighted below.

Step 7 : Make your changes and deploy the new app

No hello world app is ever complete without the developer changing the hello world text
to something else just to make sure that everything happening behind the scenes is working as it
should.
41
42
Go ahead and change the text in the above screenshot to something else.
Save the changes, go to the browser and refresh the page. You should see the page with the text
“MEOW” displayed.
Finally, it is time to deploy your changes to the cloud to make them globally accessible
via a URL. Go to the App Engine launcher, select the app, and hit the Deploy button.

Step 8 : Misc

Congratulations, you‟ve finally gotten your first Python webapp deployed on the Google App
Engine. Here are some other points which you may find useful.

1. Jinja 2 is an amazing front end templating library for Python that can do some cool stuff,
such as passing objects form Python to HTML, using for loops, if conditions, and so on
directly out of the box
2. Here‟s a very useful Udacity course on web development that I have personally found
quite resourceful
3. Viewing the logs while running your webapp can be handy to debug and also discover
some bugs on the fly.

43
OUTPUT:

44
PRELAB VIVA QUESTIONS:

1. What is GAE stands for?

2. What are the features of GAE?

3. What are the programming languages have to create to launch web applications?

4. How web browser is important to run GAE?

5. What is meant by web applications?

POSTLAB VIVA QUESTIONS:

1. How to launch GAE?

2. What is the command prompt used to display the web browser link ?

3. Where this installation is used in real time application ?

4. What you have understand about app structure?

5. How can we deploy the new app?

RESULT:

Thus the GAE – Google App Engine launcher has been launched and the web application
in google cloud has been deployed and executed the static web app successfully.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

45
46
EX: NO: 5 SIMULATE A CLOUD SCENARIO USING CLOUDSIM
AND RUN A SCHEDULING ALGORITHM THAT IS NOT
DATE:
PRESENT IN CLOUDSIM

AIM:

To simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not
present in CloudSim.

PROCEDURE:

Basics of Scheduling
In computers, Scheduling is a process of arranging the submitted jobs/task into a very
specific sequence of execution. It is an essential characteristic of any software operating
environment, which is handled by a very special program known as a scheduler.

Scheduling in Cloud
As cloud computing is the virtualized operating environment, and the virtual machines
are the primary computing component which is responsible for the execution of the
workloads(tasks). The virtual machine(s) are powered by a physical server host machine (i.e.)
hardware. Depending on the requirement of the Virtual Machine(VM) there could be „one to
one‟ or „many to one‟ mapping between the VM and host machine. That means in cloud
computing the scheduling is done at both the mapping levels that are:

 Virtual Machine to Host Machines


 Tasks to Virtual Machines
Both of VM to Host as well as Workload(task) to VM mappings may utilize space-share
or time-shared or any other specialized scheduling algorithm.

47
48
Scheduling in Cloudsim
The Cloudsim simulation toolkit framework has effectively addressed the Scheduling
scenario and implemented it as a set of the programmable class hierarchies with parent class as:

1. VmScheduler
2. CloudletScheduler
Also, Virtual Machine(VM) and Task( Cloudlet) scheduling are one of the most important
and the popular use case to be simulated by researchers using the CloudSim simulation toolkit.

Note: In cloudsim, the task is called as cloudlet, therefore in the following text instead of
‘task’ we will be using the ‘cloudlet’.

Cloudsim Virtual Machine Scheduling

 VmSchedulerTimeShared: This class implements the VM scheduling policy that allocates


one or more processing elements to a single Virtual machine and allows the sharing of
processing elements by multiple virtual machines with a specified time slice. This class
also considers the overhead of VM allocation switching(similar to context switching) in
policy definition. Here, the VM allocation will fail if the number of processing elements
requested is not available. for example, if the VM request for quad-core processor
whereas the allocated host has an only dual-core the allocation will fail.
 VmSchedulerSpaceShared: This class implements the VM scheduling policy that
allocates one or more processing elements to a single virtual machine, but this policy
implementation does not support sharing of processing elements (i.e.) all the requested
resources will be used by the allocated VM till the time the VM is not destroyed. Also,
Under this allocation policy, if any virtual machine requests a processing element and is
not available at that time, the allocation fails.
 VmSchedulerTimeSharedOverSubscription: This is an extended implementation of
VMSchedulerTimeShared VM scheduling policy, which allows over-subscription of
processing elements by the virtual machine(s) (i.e.) the scheduler still allows the
allocation of VMs that require more CPU capacity that is available. And this
oversubscription results in performance degradation.
49
50
The application of the VmScheduler classes is while instantiating the host model.
Following is the code snippet used in CloudsimExample1.java from line number 160 to 174:

int hostId = 0;
int ram = 2048; // host memory (MB)
long storage = 1000000; // host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine

This is where the processing element list is passed as a parameter to the


VmSchedulerTimeShared() class call and during the simulation, the cloudsim will simulate the

timeshare behavior for the virtual machines. Also, in case you want to test other VmScheduler
you may replace it with VmSchedulerTimeShared() call with appropriate parameters, this
includes your own designed custom virtual machine scheduler.

Cloudsim Cloudlet Scheduling


 CloudletSchedulerSpaceShared: This class implements a policy of scheduling for Virtual
machine to execute cloudlet(s) in space shared environment (i.e.) only one cloudlet will
be executed on a virtual machine at a time. It means cloudlets share the same queue and
requests are processed one at a time per computing core. Space-sharing is similar to batch
processing.
 CloudletSchedulerTimeShared: This class implements a policy of cloudlet scheduling for
Virtual machines to execute cloudlets in a time-shared environment (i.e.) more than one
cloudlet will be submitted to the virtual machine and each will get its specified share of
time. It means several requests (cloudlets) are processed at once but they must share the
computing power of that virtual machine(by simulating context switching), so they will
affect each other‟s processing time. It basically influences the completion time of a
51
52
cloudlet in CloudSim. Time-sharing is probably referring to the concept of sharing
executing power (such as CPU, logical processor, GPU) and is commonly known as the
round-robin scheduling.
 CloudletSchedulerDynamicWorkload: This implements a special policy of scheduling for
virtual machine assuming that there is just one cloudlet which is working as an online
service with a different requirement of workload as per the need of peak/offpeak user
load at a specified period of time.

53
OUTPUT:

54
PRELAB VIVA QUESTIONS:
1. What is Cloudsim?
2. What are the features of cloudsim?
3. What are the algorithms is already installed in cloudsim?
4. Why Scheduling algorithm is implemented in cloudsim?
5. What is meant by Cloudsim Virtual Machine Scheduling?

POSTLAB VIVA QUESTIONS:


1. How to download java installer?
2. How to download Cloudsim?
3. Why Round Robbin algorithm is executed in cloudsim?
4. Explain about Cloudsim Cloudlet Scheduling.
5. Explain about VMscheduler.

RESULT:

Thus the round robin scheduling algorithm which is exist in


CloudletSchedulerTimeShared() class has been executed using cloudsim and output was verified.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

55
56
EX: NO: 6 FIND A PROCEDURE TO TRANSFER THE FILES FROM
ONE VIRTUAL MACHINE TO ANOTHER VIRTUAL
DATE:
MACHINE.

AIM:

To transfer the files from one virtual machine to another virtual machine.

PROCEDURE:

To be able to transfer files between the guest machine and the host machine.

Find instructions for the following methods:

 Creating a Shared Folder in VirtualBox


 Dragging and Dropping Files in VirtualBox
 Managing Files with NextCloud

Creating a Shared Folder in VirtualBox

A shared folder is a folder which makes its files available on both the guest
machine and the host machine at the same time. Creating a shared folder between the guest and
the host allows you to easily manage files which should be present on both machines. Virtual
machines are ready to use shared folders right away, but if you are using the virtual machine on
your personal computer you will need to specify which folder to use as shared storage.

If you are using a VM on a lab computer, it is likely that a shared folder has already been
setup for you. On the desktop of your VM you should notice a folder titled SharedFolders. Inside
of this you will find any folders that have been shared between the VM and lab computers.

Shared Folders on Personal Computers

If you are using your own personal machine, you will need to configure VirtualBox to
look in the right place for your shared files.

57
58
First, click on the guest machine you intend to share files with. From there, you can select
the guest Settings and navigate to Shared Folders on the left side menu. To create a new shared
folder, either click the New Folder icon on the right menu or right click the empty list of shared
folders and click Add Shared Folder. From here, there are six options:

 Folder Path: The folder name on the host machine. Click the drop down menu and
navigate to the folder you would like to share.
 Folder Name: This is the name of the folder as it will appear on the guest machine.

 Read-Only: If you check read-only, the guest machine will be unable to write changes to
the folder. This is valuable when you only want to send files to the virtual machine, but
do not want to risk having the files modified by the guest.
 Auto-Mount: When any external storage is connected to a computer it must be mounted
in order to be used. It is recommended that you turn on auto-mounting, unless you are
familiar with the process of mounting a drive yourself.
 Mount Point: Unless you already know about mount points, leave this blank.
 Make Permanent: If you check this, the shared folder will be a permanent machine folder.
If it is not checked, the folder will not be shared after a shutdown.

Setting Up the Shared Folder

1. Select the guest machine you wish to share files with

2. Click Settings > Shared Folders

3. Right-click and select Add Shared Folder and use the following settings
a. Folder Path: Click the dropdown arrow, select Other, and navigate to the folder
you would like to share
b. Folder Name: Anything to identify it on the guest machine
c. Read-Only: Unchecked (Checked, if you are exclusively pulling files from the
host)
d. Auto-Mount: Checked
e. Mount Point: Leave blank
4. Click OK

59
60
Dragging and Dropping Files in VirtualBox

If you only need to transfer a few files quickly, you can simply drag and drop the files in. On
the top bar of the running guest machine, click on Devices > Drag and Drop and make sure
that Bidirectional is selected. This means that you will be able to drag files from the host to the guest
and from the guest to the host. Once bidirectional drag and drop is checked, you should be able to
begin dragging and dropping files.

You can also drag files from the guest machine into the host. To do this, simply open the file
browser on the host to where you would like to drop the files and drag the files from the virtual

machine into the file browser of the host. File transfers should be pretty quick; if the virtual machine
seems stuck when transferring, simply cancel the transfer and try again.

Managing Files with NextCloud

If you can access the NextCloud services, you can browse the various file storage
services available to you:

 Linux Home: These are the files from your SCS Linux Account
 Windows Home: These are the files from your SCS Windows Account and your lab Z:\
drive.
 NextCloud: In addition to the other storage accounts provided to you by the SCS, you can
also upload up to 20GB of files directly to NextCloud.

Uploading Files to NextCloud from a Lab Computer

If you would like to upload files from a lab computer, the easiest way to do this is to
place the files you would like to transfer into your Z:\ drive. These files will be automatically
backup into your NextCloud storage under the Windows Home folder. After that, you can move
them into the main NextCloud storage or choose to keep them in your Z:\drive.

Uploading Files to NextCloud from a VM or Other PC

If you would like to upload files from either a VM or any other computer, you can login
to the NextCloud service using any of the available interfaces, such as the web interface. Press

61
62
the “+” icon in the top left of the file browser and select Upload File. From here, you can choose
to keep it in the main NextCloud storage, move it into your Windows Account storage (the
Windows Home folder), or into your Linux Account storage (the Linux Home folder).

Downloading NextCloud Files to a VM or Other PC

Once your files are uploaded you will be able to download those files onto any machine
which can connect to NextCloud. First, log in to your preferred NextCloud interface (eg. the web
interface). N to the folder which contains the files you would like to download. Once you are in
the target folder, click the checkbox next to each file you would like to download. Above the file
listing you should notice the context bar changing to tell you how many files you have selected
and a button labelled Actions. Click Actions > Download.

If you have selected a single file, it will prompt you to confirm the download. If you have
chosen more than one file, NextCloud will place all of the selected files into a zip archive.
Before you can use the files, you will need to extract them from the archive. Once you have
downloaded your file, or extracted your archive, you are ready to use your files on your machine.

You can move files between virtual machines in several ways:

 You can copy files using network utilities as you would between physical computers on
your network. To do this between two virtual machine:
o Both virtual machines must be configured to allow access to your network. Any
of the networking methods (host-only, bridged and NAT) are appropriate.
o With host-only networking, you copy files from the virtual machines to the host
and vice-versa, since host-only networking only allows the virtual machines see
your host computer.
o With bridged networking or NAT enabled, you can copy files across your
network between the virtual machines.
 You can create a shared drive, either a virtual disk or a raw partition, and mount the drive
in each of the virtual machines.

63
OUTPUT:

64
PRELAB VIVA QUESTIONS:
1. What is meant guest OS?
2. What is meant by host OS?
3. Why the RAM size to be allocated to your guest OS?
4. Why to provide connectivity between guest OS and host OS?
5. What is the purpose of virtual box?

POSTLAB VIVA QUESTIONS:


1. If guest OS takes the 50% of your physical machine„s RAM size what happens?
2. Why to create a Virtual Hard disk for your Virtual Machine?
3. What does .vdi extension file contains inside the virtual machine?
4. How can we transfer the files from one virtual machine to another?
5. What is the purpose of Dragging and Dropping Files in VirtualBox

RESULT:

Thus the experiment was done successfully and files are transferred between two
different virtual environment and windows to virtual environment.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

65
66
EX: NO: 7
FIND A PROCEDURE TO LAUNCH VIRTUAL MACHINE
DATE: USING TRYSTACK (ONLINE OPENSTACK DEMO
VERSION)
AIM:
To learn how to create images and launch an instance of an image (virtual machine) in
OpenStack and how to gain control over an instance via SSH.
PROCEDURE:
Requirements
 Install OpenStack in RHEL and CentOS 7
 Configure OpenStack Networking Service
Step 1: Allocate Floating IP to OpenStack
1. Before you deploy an OpenStack image, first you need to assure that all pieces are in place
and we‟ll start by allocating floating IP.
Floating IP allows external access from outside networks or internet to an Openstack virtual
machine. In order to create floating IPs for your project, login with your user credentials and go
to Project -> Compute -> Access & Security -> Floating IPs tab and click on Allocate IP to
The Project.
Choose external Pool and hit on Allocate IP button and the IP address should appear in
dashboard. It‟s a good idea to allocate a Floating IP for each instance you run.
Step 2: Create an OpenStack Image
2. OpenStack images are just virtual machines already created by third-parties. You can create
your own customized images on your machine by installing an Linux OS in a virtual machine
using a virtualization tool, such as KVM, VirtualBox, VMware or Hyper-V.

Once you have installed the OS, just convert the file to raw and upload it to your OpenStack
cloud infrastructure.
To deploy official images provided by major Linux distributions use the following
links todownload the latest packaged images:
1. CentOS 7 – http://cloud.centos.org/centos/7/images/
2. CentOS 6 – http://cloud.centos.org/centos/6/images/
3. Fedora 23 – https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/

67
68
4. Ubuntu – http://cloud-images.ubuntu.com/
5. Debian – http://cdimage.debian.org/cdimage/openstack/current/
6. Windows Server 2012 R2 – https://cloudbase.it/windows-cloud-images/#download

Step 3: Launch an Image Instance in OpenStack


3. Once you‟ve created an image you‟re good to go. Now you can run the virtual machine based
on the image created earlier in your cloud environment.
Move to Project -> Instances and hit on Launch Instance button and a new window will
appear.
4. On the first screen add a name for your instance, leave the Availability Zone to nova, use one
instance count and hit on Next button to continue.
Choose a descriptive Instance Name for your instance because this name will be used to form
the virtual machine hostname.
5. Next, select Image as a Boot Source, add the Cirros test image created earlier by hitting
the + button and hit Next to proceed further.
6. Allocate the virtual machine resources by adding a flavor best suited for your needs and click
on Next to move on.

7. Finally, add one of the OpenStack available networks to your instance using the + button and
hit on Launch Instance to start the virtual machine.
8. Once the instance has been started, hit on the right arrow from Create Snapshot menu button
and choose Associate Floating IP.
Select one of the floating IP created earlier and hit on Associate button in order to make the
instance reachable from your internal LAN.

9. To test the network connectivity for your active virtual machine issue a ping command against
the instance floating IP address from a remote computer in your LAN.
10. In case there‟s no issue with your instance and the ping command succeeds you can remotely
login via SSH on your instance.
Use the instance View Log utility to obtain Cirros default credentials as illustrated on the below
screenshots.
11. By default, no DNS name servers will be allocated from the internal network DHCP server
for your virtual machine. This problem leads to domain connectivity issues from instance
counterpart.

69
OUTPUT:

70
To solve this issue, first stop the instance and go to Project -> Network -> Networks and edit
the proper subnet by hitting the Subnet Details button.

71
72
PRELAB VIVA QUESTIONS:

1. What is VirtualBox?

2. What are the procedure to install ubuntu ?

3. What is trystack?

4. What is Openstack?

5. What is the purpose of Ubuntu?

POSTLAB VIVA QUESTIONS:

1. What are the difference between trystack and openstack?

2. What is the output expected in openstack ?

3. What is the commands used to display final output?

4. How to install OpenStack?

5. How to configure OpenStack?

RESULT:
Thus the installation of Virtual Machine in OpenStack has been done successfully.

MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

73
74
EX: NO: 8 INSTALL HADOOP SINGLE NODE CLUSTER AND RUN
DATE: SIMPLE APPLICATIONS LIKE WORDCOUNT

AIM:
To install Hadoop single node cluster and run simple applications like wordcount.

PROCEDURE:

Open in any Browser

 Open in any Browser NameNode - http://localhost:50070/


 Open in any Browser JobTracker - http://localhost:50030/
 Open hadoop/hadoop-1.2.1 create a document type something in that document and save
it as test.txt
 bin/hadoop fs -ls /
o Found 1 items
o drwxr-xr-x - vishal supergroup 0 2014-04-15 01:13 /tmp
 bin/hadoop fs -mkdir example
 bin/hadoop fs -ls /user/vishal/
o Found 1 items
o drwxr-xr-x - vishal supergroup /user/vishal/example
 bin/hadoop fs -copyFromLocal test.txt /user/vishal/example
 bin/hadoop jar hadoop-examples-1.2.1.jar wordcount /user/vishal/example/test.txt /hello
 In Eclipse New  Java Project  Provide Project Name  Next  Select Libraries 
Add Externals JARs  Go to Hadoop  hadoop-1.2.1  select all jar files  again
click on Add External JARs  go to hadoop  hadoop-1.2.1  lib  select all JAR
files  click on Finish.
 Right Click on Src Folder  Select Class  Provide a Class name: WCE  Package
name: com.WordCount.Example  Click on Finish.

75
76
Program
package com.WordCount.Example
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;

import org.apache.hadoop.util.*;
public class WCE
{
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text,
Text, IntWritable>
{
private final static IntWritable one = new
IntWritable(1); private Text word = new Text();
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException
{
String line = value.toString();
StringTokenizer tokenizer = new
StringTokenizer(line); While
(tokenizer.hasMoreTokens())
{
word.set(tokenizer.nextToken());
output.collect(word, one);
}
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable,

77
78
Text, IntWritable>
{
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text,
IntWritable> output, Reporter reporter) throws IOException
{
int sum = 0;
while (values.hasNext())
{
sum += values.next().get();
}
output.collect(key, new IntWritable(sum));
}
}
public static void main(String[] args) throws Exception
{
JobConf conf = new
JobConf(WCE.class);
conf.setJobName("wordcount");
conf.setOutputKeyClass(Text.class);

conf.setOutputValueClass(IntWritable.class);
conf.setMapperClass(Map.class);
conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
FileInputFormat.addInputPath(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new
Path(args[1])); JobClient.runJob(conf);
}
}

79
OUTPUT:

80
PRELAB VIVA QUESTIONS:

1. Have Hadoop has how many layers?


2. What are the different operation modes of Hadoop?
3. What are the platforms can be supported by Hadoop?
4. What are the different operations can be performed by SSH?
5. What is meant by Cluster?

POSTLAB VIVA QUESTIONS:

1. Define master node.


2. Define data node.
3. What is name note?
4. Define slave node.
5. What is the application have been used to count the word?

RESULT:

Hence we have implemented Map Reduce example such as Word Count program on an
file which will count the number of times a word repeats in the given file.
MARK ALLOCATION
Marks Marks
DETAILS
Allotted Awarded
Pre Lab Questions 10
Algorithm & Logic
30
Explanation
Coding 30
Execution and Output 20
Post Lab Questions
10
(Viva)
Total 100

81

You might also like