KEMBAR78
Cloud Computing Lab Manual (7th Sem) | PDF | Apache Hadoop | Virtualization
0% found this document useful (0 votes)
2K views50 pages

Cloud Computing Lab Manual (7th Sem)

Lab

Uploaded by

RAGHAV SINGHAL
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)
2K views50 pages

Cloud Computing Lab Manual (7th Sem)

Lab

Uploaded by

RAGHAV SINGHAL
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/ 50

MEERUT INSTITUTE OF ENGINEERING& TECHNOLOGY MEERUT

Lab File
For
Cloud Computing (KCS-751A)
B. Tech (4th Year)
CSE-IoT
Session -2024-2025 (Odd Semester)

DR. A.P.J. ABDUL KALAM TECHNICAL


UNIVERSITY LUCKNOW

1|Page
Cloud Computing Lab File (KCS751A)
Vision of Institute
To be an outstanding institution in the country imparting technical education, providing need-
based, value-based and career-based programs and producing self-reliant, self- sufficient
technocrats capable of meeting new challenges.

Mission of Institute

The mission of the institute is to educate young aspirants in various technical fields to fulfill
global requirement of human resources by providing sustainable quality education, training and
invigorating environment besides molding them into skilled competent and socially responsible
citizens who will lead the building of a powerful nation.
Vision of Department
To become a globally recognized department where talented frontier of the Internet
of things (IoT) are nurtured to meet the need of industry, society, and economy to
serve the nation and society.
Mission of Department
• To provide resources of excellence and fresh mind into highly competent
IoT application development, and enhanced their knowledge and skills
through covering technologies and multi-disciplinary engineering practices.
• To equip students and provide the state- of- the art facilities to develop
industry Ready IoT system.
• To promote industries collaborations to have the best careers.

Program Educational Objectives (PEOs)

To Lead Their Career as engineering practitioners to provide industry-accepted


PEO 1
solutions to solve the industry’s technological problems.
To engage engineering professionals to develop the talent of critical thinking, design,
PEO 2 and analysis to offer socially acceptable solutions to real-time problems in the domain of
computing with global competence in technology development.
To inculcate values, entrepreneurial skills, professional ethics, social awareness and
PEO 3
responsibility to emerging technology leaders.
To provide the technocrats with managerial and entrepreneur skills in a friendly
PEO 4
Environment for the successful pursuit of engineering and management.
To absorb lifelong learning with research and create the right path to pursue their
PEO 5
Careers to adapt to the dynamic changes in technology and solve society complex problems.

2|Page
Cloud Computing Lab File (KCS751A)
Safety Rules of Laboratory
(Lab Name: Cloud Computing Lab- KCS751A)
1. Computing lab should be maintained clean, organized, and properly
lighted.
2. Keep your workspace clean and free of clutter. Dust can affect computers
adversely.
Ensure that the machines are cleaned on a regular basis.
3. Everyone must understand and follow safety procedures
4. Follow the basic safety guidelines to prevent cuts, burns, electrical shock,
and damage to Eye sight.
5. Do not spill water or any other liquid on the machine. It can cause short
circuit fire as well as damage the machine.
6. Do not touch areas in printers that are hot or that use high voltage.
Remember that some components retain a high voltage even after the
printer is turned off.
7. Avoid contact with energized electrical circuits.
8. Disconnect the power source before servicing or repairing electrical
equipment.
9. If it is not unsafe to do so, work with only one hand, keeping the other hand
at your side or in your pocket, away from all conductive material. This
precaution reduces the likelihood of accidents that result in current passing
through the chest cavity.
10. If water or a chemical is spilled onto equipment, shut off power at the main
switch or circuit breaker and unplug the equipment.
11. If an individual meets a live electrical conductor, do not touch the
equipment, cord or person. Disconnect the power source from the circuit
breaker or pull out the plug using a leather belt.
3|Page
Cloud Computing Lab File (KCS751A)
Do and Don’ts in Laboratory
(Lab Name: Cloud Computing Lab- KCS751A)
Do's
1. Always sit at your assigned computer unless a teacher moves you.
2. Turn off the machine when you are no longer using it.
3. Always save your project.
4. Always maintain lab file of all your programs.
5. Do the connections neatly and firmly tightened.
6. Do only the experiment assigned to you.
7. Do the experiment carefully following the correct procedure.
8. Write the Objective of Program, Apparatus used, and Program, flow
chart with output/ Result by using the pencil in the left side of page

Don'ts
1. Don't run or play in the laboratory.
2. Don't eat, drink or smoke in laboratories.
3. Don't keep unwanted materials in the worktable.
4. Don't touch live conductor or wire with bare hands.
5. Don't clutter floor and tables with books, bags or cases.
6. Don't touch the screen- ever. Touching the screen with your fingers or
objects like pencils can
Damage the monitor.
7. Don't change the computer settings.

4|Page
Cloud Computing Lab File (KCS751A)
Index
S. No. Experiment Name Performed Grade Faculty Sign
Date with date
1 Install Virtual box/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 try
stack (Online Openstack Demo Version)
8 Install Hadoop single node cluster and run simple
applications like word count.
9 Install a C++ Compiler In The Virtual Machine and
Execute a Simple Program.
10 Installation and Configuration of virtualization using
KVM.

Faculty Signature

5|Page
Cloud Computing Lab File (KCS751A)
Program No. : 1 DATE:

Install Virtual box / VMware Workstation with different flavours of Linux or


windows OS on top of windows7 or 8.

Objective:

To Install Virtual box / VMware Workstation with different flavours of Linux or windows OS on
top of windows7 or 8.

PROCEDURE:

Steps to install Virtual Box:


1. Download the Virtual box exe and click the exe file…and select next button...

Fig 1. Virtual box exe file

2. Click the next button...

6|Page
Cloud Computing Lab File (KCS751A)
Fig 2. Custom Setup
3. Click the next button

Fig 3. Select Multiple Options.


Then installation was completed. The show virtual box icon on desktop screen…

7|Page
Cloud Computing Lab File (KCS751A)
Fig 4. Virtual Box Application
4. Steps to import Open nebula sandbox:
1. Open Virtual box
2. File import Appliance
3. Browse OpenNebula-Sandbox-5.0.ova file
4. Then go to setting, select USB and choose USB 1.1
5. Then Start the Open Nebula
6. Login using username: root, password:opennebula

Fig 5. Virtual Box nebula sandbox.

8|Page
Cloud Computing Lab File (KCS751A)
Fig 6. Steps to create Virtual Machine
5. Steps to create Virtual Machine through open nebula
1. Open Browser, type localhost:9869
2. Login using username: oneadmin, password: opennebula
3. Click on instances, select VMs then follow the steps to create Virtual Machine
a. Expand the + symbol
b. Select user oneadmin
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.

Fig 7. Nebula Login Panel

9|Page
Cloud Computing Lab File (KCS751A)
Fig 8. Create Virtual Machine.

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:
Thus the procedure to run the virtual machine of different configuration.

10 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers

1. What are the different types of VMware Workstation?

2. What is a VirtualBox in Linux?

3. What are the main uses of virtual machine?

11 | P a g e
Cloud Computing Lab File (KCS751A)
4. What are the two types of virtual machines?

5. What is the main function of a hypervisor?

12 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 2 DATE:

Install a C compiler in the virtual machine created using virtual box and execute
Simple Programs

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

PROCEDURE:
1. Steps to import .ova file:
1. Open Virtual box
2. File import Appliance
3. Browse ubuntu_gt6.ova file
4. Then go to setting, select USB and choose USB 1.1
5. Then Start the ubuntu_gt6
6. Login using username: dinesh, password:99425.

2. Steps to run c program:


1. Open the terminal
2. Type cd /opt/axis2/axis2-1.7.3/bin then press enter
3. gedit hello.c
4. gcc hello.c
5. ./a.out
3. Algorithm to add 3 numbers and print their sum:
1. START
2. Declare 3 integer variables num1, num2, and num3.
3. Take the three numbers, to be added, as inputs in variables num1, num2, and num3
respectively.
4. Declare an integer variable sum to store the resultant sum of the 3 numbers.
5. Add the 3 numbers and store the result in the variable sum.
6. Print the value of the variable sum
7. END

APPLICATIONS:
Simply running all programs in grid environment.

13 | P a g e
Cloud Computing Lab File (KCS751A)
Codes: (To be written by the student)

Output :( To be written by the student as shown on the computer screen)

14 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers

1. Write a Program in C to multiply two Floating-Point Numbers.

2. Write a program in C to addition two numbers

3. What is %d in C?

15 | P a g e
Cloud Computing Lab File (KCS751A)
4. Write a Program to print prime numbers from 1 to 100.

5. Write a Program to Calculate Fahrenheit to Celsius.

16 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 3 DATE:

Install Google App Engine. Create hello world app and other simple web
applications using python/java.
Objective:
Google App Engine. Create hello world app and other simple web applications using
python/java.

Procedure:
1. Install Google Plugin for Eclipse
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.
2. Create New Web Application Project
In Eclipse toolbar, click on the Google icon, and select “New Web Application Project…”

Fig 9. Create Web Application Project.

3. Hello World
Review the generated project directory.

17 | P a g e
Cloud Computing Lab File (KCS751A)
Fig 10. Standard Java web project structure
File: appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>


<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>
<version>1</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

18 | P a g e
Cloud Computing Lab File (KCS751A)
Result:

Fig 11. Output of the Program.

Thus the simple application was created successfully.

19 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers

1. Create a Java app in the App Engine flexible environment.

2. What is app environment?

20 | P a g e
Cloud Computing Lab File (KCS751A)
3. What are different app environments?

4. Why do we need different environments?

21 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 4 DATE:

Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is
Not Present in CloudSim.
Objective:
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 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 class path
and it is ready to be used. Please verify Whether Java is available on your system.
To use CloudSim in Eclipse:
1. Download CloudSim installable files
From https://code.google.com/p/cloudsim/downloads/list and unzip
2. Open Eclipse
3. Create a new Java Project: File -> New
4. Import an unpacked CloudSim project into the new Java Project
The first step is to initialize the CloudSim package by initializing the CloudSim library, As follows
CloudSim.init (num_user, calendar, trace flag)
5. Data centers are the resource providers in CloudSim; hence, creation of data centers is a second
step. To create Datacenter, you need the Datacenter Characteristics object that stores the properties
of a data center such as architecture, OS, list of machines, allocation policy that covers the time or
spaceshared, the time zone and its price: Datacenter datacenter9883 = new Datacenter (name,
characteristics, new VmAllocationPolicySimple(hostList), s
6. The third step is to create a broker:
DatacenterBroker broker = createBroker ();
7.The fourth step is to create one virtual machine unique ID of the VM, user ID ID of the VM’s
owner, mips, number Of amount of CPUs, amount of RAM, amount of bandwidth, amount of
storage, virtual machine monitor, and cloudlet Scheduler policy for cloudlets: Vm vm = new
Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared())

8. Submit the VM list to the broker: broker.submitVmList (vmlist)


9. Create a cloudlet with length, file size, output size, and utilisation model:
Cloudlet cloudlet = new Cloudlet (id, length, pesNumber, fileSize, outputSize, utilizationModel,
utilizationMode
10. Submit the cloudlet list to the broker: broker.submitCloudletList (cloudletList) Sample Output
from the Existing Example:
Starting
CloudSimExample1... Initialising...
Starting CloudSim version 3.0 Datacenter_0 is starting...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>null

22 | P a g e
Cloud Computing Lab File (KCS751A)
Broker is starting... Entities started.
: Broker: Cloud Resource List received with 1 resource(s) 0.0: Broker: Trying to Create VM #0 in
Datacenter_0
: Broker: VM #0 has been created in Datacenter #2, Host #0 0.1: Broker: Sending cloudlet 0 to
VM #0
400.1 : Broker: Cloudlet 0 received
: Broker: All Cloudlets executed. Finishing 400.1: Broker: Destroying VM #0
Broker is shutting down... Simulation: No more future events
CloudInformationService: Notify all CloudSim entities for shutting down. Datacenter_0 is
shutting down...
Broker is shutting down Simulation completed.
Simulation completed.

========== OUTPUT ==========


Cloudlet ID STATUS Data center ID Finish Time 0 SUCCESS 2
0.1 400.1 VM ID Time 0 Start Time
400
*****Datacenter: Datacenter_0***** User id
Debt
3 35.6
CloudSimExample1 finished!

Result:
The simulation was successfully executed.

23 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers
1. What is the dataset for task scheduling in Cloud using CloudSim?

2. How do you simulate a cloud scenario using CloudSim?

24 | P a g e
Cloud Computing Lab File (KCS751A)
3. What is the data set in CLoudsim?

4. What parameters of a cloud system can be simulated by CloudSim?

25 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 5 DATE:

Use GAE launcher to launch the web applications.

Objective:
To Use GAE launcher to launch the web applications.

Steps:

MakingyourFirstApplication
Now you need to create simple application. We could use the “+”option to have the launcher make
us an application– but instead we will do it by hand to get a better sense of what is going on.

Make a folder for your Google App Engine applications. I am going to make the Folder on my
Desktop called “apps” – the path to this folder is
C:\Documents and Settings\csev\Desktop\apps
And then make a sub-• folder in within apps called “ae-•01-•trivial” – the path to this folder would
be:
Note: Please do not copy and paste these lines into your text editor– you might
end up with strange characters – simply type them into your editor. Then create a file in the ae-
•01-•trivial folder called index.py with three lines in it:
Print 'Content-Type: text/plain ‘print ' '
Print 'Hello there Chuck'
Then start the 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.

Fig 12. Engine Launcher.

26 | P a g e
Cloud Computing Lab File (KCS751A)
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:

Fig 12. Output of the Launcher.

Result:

Thus the GAE web applications was created.

27 | P a g e
Cloud Computing Lab File (KCS751A)
1. How many applications can I create with Google App Engine?

2. How to deploy a web application in Google App Engine?

28 | P a g e
Cloud Computing Lab File (KCS751A)
3. How do I add a custom domain to Google App Engine?

4. What are the challenges of GAE?

29 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 6 DATE:

Find a procedure to transfer the files from one virtual machine to another virtual
machine.
Objective:
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.

PROCEDURE:
Steps:
1. Open Browser, type localhost:9869
2. Login using username: oneadmin, password: opennebula
3. Then follow the steps to migrate VMs
a. Click on infrastructure
b. Select clusters and enter the cluster name
c. Then select host tab, and select all host
d. Then select Vnets tab, and select all vnet
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.
4. On instances, select VMs to migrate then follow the stpes
a. Click on 8th icon, the drop down list display
b. Select migrate on that, the popup window display
c. On that select the target host to migrate then click on migrate.

30 | P a g e
Cloud Computing Lab File (KCS751A)
APPLICATIONS:
Easily migrate your virtual machine from one pc to another.

Fig 13. Migrate your virtual machine from one pc to another.

Result:
Thus the file transfer between VM was successfully completed…..

31 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers
1. Which command can be used to transfer file from one server to another?

2. How to copy files from one virtual machine to another in Linux?

32 | P a g e
Cloud Computing Lab File (KCS751A)
3. How do I copy a VM to another VM?

4. How to migrate VM from one storage to another?

33 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 7 DATE:

Find a procedure to launch virtual machine using trystack (Online Openstack Demo
Version)
Objective:
OpenStack is primarily used for deploying an infrastructure as a service (IaaS) solution
like Amazon Web Service (AWS). In other words, you can make your own AWS by using
OpenStack. If you want to try out OpenStack, TryStack is the easiest and free way to do it.

Steps:
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.

Fig 14. TryStack Homepage.

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:

34 | P a g e
Cloud Computing Lab File (KCS751A)
Fig 15. OpenStack Compute Dashboard

Overview: What we will do?


In this post, I will show you how to run an OpenStack instance. The instance will be accessible
through the internet the final topology will like:

35 | P a g e
Cloud Computing Lab File (KCS751A)
Fig 16. Network topology

Step 1: Create Network


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.
1. Go to Network > Networks and then click Create Network.
2. In Network tab, fill Network Name for example internal and then click next.
3. In Subnet tab,
1. Fill Network Address with appropriate CIDR, for example 192.168.1.0/24. Use
private network CIDR block as the best practice.
2. Select IP Version with appropriate IP version, in this case IPv4.
3. Click Next.
4. In Subnet Details tab, fill DNS Name Servers with 8.8.8.8 (Google DNS) and
then click Create.
Step 2: Create Instance
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.
1. Go to Compute > Instances and then click Launch Instance.
2. In Details tab,
1. Fill Instance Name, for example Ubuntu 1.
2. Select Flavor, for example m1.medium.
3. Fill Instance Count with 1.
4. Select Instance Boot Source with Boot from Image.
5. Select Image Name with Ubuntu 14.04 amd64 (243.7 MB) if you want install
Ubuntu 14.04 in your virtual machine.
3. In Access & Security tab,
1. Click [+] button of Key Pair to import key pair. This key pair is a public and
private key that we will use to connect to the instance from our machine.
2. In Import Key Pair dialog,
1. Fill Key Pair Name with your machine name (for example Edward-Key).
2. Fill Public Key with your SSH public key (usually is in
~/.ssh/id_rsa.pub). See description in Import Key Pair dialog box for more
information. If you are using Windows, you can use Puttygen to generate key pair.
3. Click Import key pair.
4. In Security Groups, mark/check default.
5. In networking tab,
In Selected Networks, select network that have been created in Step 1, for example
Internal.
6. Click Launch.
7. If you want to create multiple instances, you can repeat step 1-5. I created one more
instance with instance name Ubuntu 2.

Step 3: Create Router


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

36 | P a g e
Cloud Computing Lab File (KCS751A)
that running as the gateway to the internet.

1. Go to Network > Routers and then click Create Router.


2. Fill Router Name for example router1 and then click Create router.
3. Click on your router name link, for example router1, Router Details page.
4. Click Set Gateway button in upper right:
1. Select External networks with external.
2. Then OK.
5. Click Add Interface button.
1. Select Subnet with the network that you have been created in Step 1.
2. Click Add interface.
6. 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.
Step 4: Configure Floating IP Address

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.

Step 5: Configure Access & Security

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.
6. You can open other ports by creating new rules.

Step 6: SSH to Your Instance


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.

Result:

37 | P a g e
Cloud Computing Lab File (KCS751A)
Thus the openstack demo worked successfully.

Questions and Answers

1. How do I launch a virtual machine using OpenStack?

2. How do I start a virtual machine in Linux?

38 | P a g e
Cloud Computing Lab File (KCS751A)
3. How do I connect to a virtual machine online?

4. How to connect to VM using command prompt?

39 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 8 DATE:

Install Hadoop single node cluster and run simple applications like word count.
Objective:
To Install Hadoop single node cluster and run simple applications like word count.
Steps:
Install Hadoop
Step 1: Click here to download the Java 8 Package. Save this file in your home directory.
Step 2: Extract the Java Tar File.
Command: tar -xvf jdk-8u101-linux-i586.tar.gz
Step 3: Download the Hadoop 2.7.3 Package.
Command: wget https://archive.apache.org/dist/hadoop/core/hadoop-2.7.3/hadoop- 2.7.3.tar.gz
Step 4: Extract the Hadoop tar File.
Command: tar -xvf 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
Then, save the bash file and close it.
For applying all these changes to the current Terminal, execute the source command.
Command: source .bashrc
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.
Step 6: Edit the Hadoop Configuration files.
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:

Fig 17: Hadoop Configuration Directory.

Step 7: Edit the mapred-site.xml file and edit the property mentioned below
Inside configuration tag:

40 | P a g e
Cloud Computing Lab File (KCS751A)
Mapred-site.xml contains configuration settings of Map Reduce application like number of JVM
that can run in parallel, the size of the mapper and the reducer process, CPU cores available for a
process, etc.

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: cp mapred-site.xml.template mapred-site.xml


Command: vi mapred-site.xml.

Fig 18: Configuring mapred-site.xml


Step 8: Edit yarn-site.xml and edit the property mentioned below inside
configuration tag:
Yarn-site.xml contains configuration settings of Resource Manager and Node Manager like
application memory management size, the operation needed on program & algorithm, etc.

Command: vi yarn-site.xml

Fig 19: Configuring yarn-site.xml

Result:
Thus the Hadoop one cluster was installed and simple applications executed successfully.

41 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers

1. How can I make Hadoop run faster?

2. How to install Hadoop cluster?

42 | P a g e
Cloud Computing Lab File (KCS751A)
3. How to add a node in Hadoop cluster?

4. How do I run Hadoop application?

43 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 9 DATE:

INSTALL A C++ COMPILER IN THE VIRTUAL MACHINE AND EXECUTE


A SAMPLE PROGRAM.
Objective:
To install a C compiler in the virtual machine and execute a sample program.
Procedure:
step1:
Install the centos or ubuntu in the open nebula as per previous commands.
Step 2:
Login into the VM of installed OS.
Step 3:
If it is ubuntu then, for gcc installation
$ sudo add-apt-repository ppa: ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-6 gcc-6-base
Step 4:
Algorithm to Swap Two Numbers in C++:
Start: Begin the process.
Initialize Variables: Define three variables, a, b, and temp. Assign values to a and b that you want
to swap.
Swap Numbers:
Assign the value of a to temp.
Assign the value of b to a.
Assign the value of temp to b.
Display Swapped Numbers: Print the values of a and b after the swap.
End: The process is complete.
Step 5:
First we need to compile and link our program. Assuming the source code is saved in a file
welcome.cpp, we can do that using GNU C++ compiler g++, for example
g++ -Wall -o welcome welcome.cpp

Code: (To be written by the student)

44 | P a g e
Cloud Computing Lab File (KCS751A)
Output: (To be written by the student as shown on the computer screen)

45 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers
1. Write a Program in C++ to Find LCM of Two Numbers using Simple Method.

2. Write a Program in C++ to Find Factorial of a Number Using Iteration.

46 | P a g e
Cloud Computing Lab File (KCS751A)
3. Write a Program in C++ to Find Largest Among Three Numbers.

4. Write a C++ program to add two numbers and accept them from the keyboard.

5. Write a C++ program that calculates the volume of a sphere.

47 | P a g e
Cloud Computing Lab File (KCS751A)
Program No. : 10 DATE:
Installation and Configuration of virtualization using KVM.
Objectives:
From this experiment, the student will be able to,
• Understand the concepts of virtualization.
• Understand KVM architecture and its configuration.

Virtualization is software that separates physical infrastructures to create various dedicated


resources. It is the fundamental technology that powers cloud computing.
The technology behind virtualization is known as a virtual machine monitor (VMM) or virtual
manager, which separates compute environments from the actual physical infrastructure.
Virtualization makes servers, workstations, storage and other systems independent of the physical
hardware layer. This is done by installing a Hypervisor on top of the hardware layer, where the
systems are then installed.

Procedure:
Step 1: #sudo grep -c "svm\|vmx" /proc/cpuinfo
Step 2: #sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
Step 3: #sudoadduserrait
After running this command, log out and log back in as rait
Step 4: #sudoadduserraitlibvirtd
After running this command, log out and log back in as rait
Step 5: Open Virtual Machine Manager Application and Create Virtual Machine
#virt-manager as shown below
Step 6: Create a new virtual machine as shown below
Step 7: Install windows operating system on virtual machine
Step 8: Installation of windows on virtual machine
Step 9: Installation of windows 7 on virtual machine
Step 10: Initialization of windows

Result:

48 | P a g e
Cloud Computing Lab File (KCS751A)
Questions and Answers

1. How do I enable virtualization in KVM?

2. How do I enable KVM in VMware?

49 | P a g e
Cloud Computing Lab File (KCS751A)
3. How to connect KVM to PC?

4. How do I connect to KVM?

50 | P a g e
Cloud Computing Lab File (KCS751A)

You might also like