0% found this document useful (0 votes)
48 views28 pages

CC LAB MANUAL (5b)

Cloud computing manual
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)
48 views28 pages

CC LAB MANUAL (5b)

Cloud computing manual
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/ 28

CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

EX.NO.1 INSTALL VIRTUALBOX WITH LINUX OS ON TOP OF WINDOWS


DATE:

AIM:

To install Virtualbox with different flavours of linux or windows OS on top of windows


host operating system.

Step 1:
Download the following
VMware package
Guest OS (Ubuntu) ISO file

Step 2: Navigate to the directory where the above files are downloaded.

Step 3:
Change the permissions of the VMware package. Use the following command, chmod a+x
<VMWARE_PACKAGE_NAME> That is,

1
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

chmod a+x VMware-Workstation-Full-16.1.2-17966106.x86_64.bundle


Run the next command to install the VMware.
sudo ./VMware-Workstation-Full-16.1.2-17966106.x86_ 64.bundle

2
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Step 4:
Open VMware Player
Accept all the agreements, terms and conditions.
Select all the default settings and continue.
VMware is successfully installed on your Host Machine.

3
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

4
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

5
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Step 5:
Select “Create a new Virtual Machine”
Select “Use ISO image” and Browse your Guest OS ISO image path and click “Next”.
Use your password as “admin” and click “Next”.
Click “Next”
Select your disk size upto a maximum of 25GB and Click “Next”.

6
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

7
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Select Finish

Guest OS is installed Successfully.

RESULT:

Thus installation of Virtualbox with different flavours of linux or windows OS on


top of windows host operating system is completed successfully.

8
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Ex.No: 2 INSTALL GCC COMPILERS IN VIRTUAL MACHINE


Date :

AIM:
To install a C compiler in the virtual machine and execute a sample program.

ALGORITHM:
Step 1: To check Gcc compiler is installed or not.
$ dpkg - l | grep gcc
Step 2: If GCC compiler is not installed in VM, to execute the following command
$sudo apt-get install gcc (or) $sudo apt-get install build-essential
Step 3: Open a Vi Editor
Step 4: Get the no. of rows and columns for first and second
matrix. Step 5: Get the values of x and y matrix using for loop.
Step 6: Find the product of first and second and store the result in multiply
matrix. multiply[i][j]=multiply[i][j]+(first[i][k]*second[k][j]);
Step 7: Display the resultant
matrix. Step 8: Stop the program.

PROGRAM:
#include <stdio.h>
int main()
{
int a[10][10],b[10][10],mul[10][10],r,c,i,j,k;

printf("enter the number of row=");


scanf("%d",&r);
printf("enter the number of column=");
scanf("%d",&c);
printf("enter the first matrix element=\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the second matrix element=\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&b[i][j]);
}

9
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

printf("multiply of the matrix=\n");


for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
mul[i][j]=0;
for(k=0;k<c;k++)
{
mul[i][j]+=a[i][k]*b[k][j];
}
}
}
//for printing result
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("%d\t",mul[i][j]);
}
printf("\n");
}
return 0;
}
OUTPUT:
Compile: cse105@it105-HP-ProDesk-400-G1-SFF:~$ gcc matrix.c
Run: cse105@cse105-HP-ProDesk-400-G1-SFF:~$ ./a.out
enter the number of row=2
enter the number of column=2
enter the first matrix element=
1
1
1
1
enter the second matrix element=
1
1
1
1
multiply of the matrix=
2 2
2 2
RESULT :

Thus a C compiler in the virtual machine to execute a sample program has been executed
successfully.

10
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

EXNO: 3 INSTALLING GOOGLE APP ENGINE

AIM:

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

STEP 1
 Download google cloud SDK from the google cloud website
[ https://cloud.google.com/sdk/docs/install ]
( OR )
 Click the following link to download the required Google Cloud SDK
[ https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-
sdk-357.0.0-linux-x86_64.tar.gz ]
Extract the zip folder in Downloads/ folder

STEP 2
 Open new terminal in Downloads/ folder and install the google cloud
./google-cloud-sdk/install.sh

 Open a new terminal and initialized the gcloud


./google-cloud-sdk/bin/gcloud init

 Login to your google account and continue the process by accepting the terms and
conditions

11
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

 Create a main.py file and app.yaml file in your desired folder

 Inside main.py write a simple hello world program

print("hello world ")

 In app.yaml type the following code

STEP 3
 Finally run the app using

$ python ./google-cloud-sdk/bin/dev_appserver.py /home/user/GAE/Ex3

12
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Go to http://localhost:8000/

RESULT :

Thus installation of Google App Engine is completed and hello world app using python is
completed successfully

13
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

EXNO: 4 GAE LAUNCHER TO LAUNCH THE WEB APPLICATIONS

AIM:
To use GAE launcher to launch the web applications.

PROCEDURE :

Step 1 – Go to Cloud SDK

https://cloud.google.com/sdk/docs/install

Step 2 – Download Linux 64-bit (x86_64)

Step 3 – Extract the Zip File from downloads

Step 4 – Open Terminal in Downloads

Step 5 – Run the following command

./google-cloud-sdk/install.sh

14
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Step 6 – Init the cloud sdk using the following command


./google-cloud-sdk/bin/gcloud init
Step 7 – Create Project Folder, Download the zip file from the below link and unzip it.
https://drive.google.com/file/d/18gHSvne6r11yT70X6x7HtmJlpLTBieYq/view?usp=sha
ring
Step 8 - Create a App.yaml file
App.yaml
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: project/index.html
upload: project/index.html
- url: /
static_dir: project

Step 9 - Go to the Project Folder and open the terminal


$ python ./google-cloud-sdk/bin/dev_appserver.py /home/user/GAE/Project

Step 10 - Go to http://localhost:8000
“If Localhost not opening then run this command”
fuser -n tcp -k 8080

OUTPUT :

RESULT :

Thus the GAE launcher has been successfully used to launch the web applications.

15
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

EXNO: 5 A STUDY ON CLOUDSIM IS A SIMULATION TOOLKIT

AIM:

To study about the tools and features of Cloud sim.

DESCRIPTION:
CloudSim is a simulation toolkit that supports the modeling and simulation of the core
functionality of cloud, like job/task queue, processing of events, creation of cloud
entities(datacenter, datacenter brokers, etc), communication between different entities,
implementation of broker policies, etc.
This toolkit allows to:
 Test application services in a repeatable and controllable environment.
 Tune the system bottlenecks before deploying apps in an actual cloud.
 Experiment with different workload mix and resource performance scenarios
on simulated infrastructure for developing and testing adaptive application
provisioning techniques
Core features of CloudSim are:
 The Support of modeling and simulation of large scale computing
environment as federated cloud data centers, virtualized server hosts, with
customizable policies for provisioning host resources to virtual machines and
energy-aware computational resources
 It is a self-contained platform for modeling cloud’s service brokers,
provisioning, and allocation policies.
 It supports the simulation of network connections among simulated system
element
Support for simulation of federated cloud environment that inter-networks resources
from both private and public domains.
 Availability of a virtualization engine that aids in the creation and
management of multiple independent and co-hosted virtual services on a data
center node.
 Flexibility to switch between space shared and time shared allocation of
processing cores to virtualized services.
The cloudsim allows to model and simulate the cloud system components,
therefore to support its function different set of classes has been developed by its
developers like:
 To simulating the regions and datacenters the class named “Datacenter.java”
is available in org.cloudbus.cloudsim package.
 To simulate the workloads for cloud, the class named as “Cloudlet.java” is
available in org.cloudbus.cloudsim package.
 To simulate the load balancing and policy-related implementation the classes
named “DatacenterBroker.java”,

16
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

“CloudletScheduler.java”, “VmAllocationPolicy.java”, etc are available


under org.cloudbus.cloudsim package.
 Now because all the different simulated hardware models are required to
communicate with each other to share the simulation work updates for this
cloudsim has implemented a discrete event simulation engine that keeps
track of all the task assignments among the different simulated cloud
components.

Cloudsim is used for


 Load Balancing of resources and tasks
 Task scheduling and its migrations
 Optimizing the Virtual machine allocation and placement policies
 Energy-aware Consolidations or Migrations of virtual machines
 Optimizing schemes for Network latencies for various cloud scenarios

Cloudsim simulation toolkit setup is easy. Before you start to setup CloudSim,
following resources must be Installed/downloaded on the local system
 Java Development Kit(JDK)
 Eclipse IDE for Java developers
 Download CloudSim source code
 Download Common Math libraries

RESULT:
Thus the study on cloudsim simulation tool is done successfully.

17
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

EXNO: 5 B SIMULATE A CLOUD SCENARIO USING CLOUDSIM


AIM:
To simulate a cloud scenario using CloudSim and run a scheduling algorithm.
DESCRIPTION:
Cloudsim is a simulation toolkit that supports the modeling and simulation of the
core functionality of the cloud. This article discusses the overview of the cloudsim
toolkit and helps you get started along with reference to the relevant resources.
Procedure:

1. Check for git installation


git –version

2. If git is not installed,


Use sudo apt-get install git

18
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

3. After making sure git is installed, Clone the project from github url
https://github.com/michaelfahmy/cloudsim-task-scheduling
Use command : git clone https://github.com/michaelfahmy/cloudsim-task-scheduling

4. Open netbeans 8.x and create a new java project from files

19
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

5. Now find the cloned project folder which generally in linux will be in
/home/Netbeansproject1/javaapplication1

6. Open the src folder and copy the folders

20
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Paste the folders in the src folder of the newly created netbeans project

7. Also copy the cloudsim-task-scheduling.iml to the netbeans project

21
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

8. Go to netbeans and right click on project’s libraries to add jars

22
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Select the folder where you cloned the git project and go to jars

And double click

23
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

Select the jar file - cloudsim-3.0.3.jar and click Ok


Similarly add jswarm-pso_2_08.jar

9. To run any scheduling , expand the folder and right click on the file ending on
_scheduler and run file
For FCFS, run FCFS_Scheduler,java

PROGRAM:
package org.cloudbus.cloudsim.examples; import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared; import
org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics; import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.Pe; import
org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple; import
org.cloudbus.cloudsim.VmSchedulerTimeShared; import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple; import
org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; import
org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;

/**

24
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

An example showing how to create


scalable simulations.
*/public class CloudSimExample6 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
private static List<Vm> createVM(int userId, int vms) {
//Creates a container to store VMs. This list is passed to the broker later LinkedList<Vm> list =
new LinkedList<Vm>();
//VM Parameters
long size = 10000; //image size (MB) int ram = 512; //vm memory (MB) int mips = 1000;
long bw = 1000;
int pesNumber = 1; //number of cpus String vmm = "Xen"; //VMM name
//create VMs
Vm[] vm = new Vm[vms];
for(int i=0;i<vms;i++){
vm[i] = new Vm(i, userId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerTimeShared());
//for creating a VM with a space shared scheduling policy for cloudlets:
//vm[i] = Vm(i, userId, mips, pesNumber, ram, bw, size, priority, vmm, new
CloudletSchedulerSpaceShared());
list.add(vm[i]);
}
return list;
}
private static List<Cloudlet> createCloudlet(int userId, int cloudlets){
// Creates a container to store Cloudlets LinkedList<Cloudlet> list = new LinkedList<Cloudlet>();
//cloudlet parameters long length = 1000; long fileSize = 300; long outputSize = 300; int
pesNumber = 1;
UtilizationModel utilizationModel = new UtilizationModelFull(); Cloudlet[] cloudlet = new
Cloudlet[cloudlets];
for(int i=0;i<cloudlets;i++){
cloudlet[i] = new Cloudlet(i, length, pesNumber, fileSize, outputSize, utilizationModel,
utilizationModel, utilizationModel);
// setting the owner of these Cloudlets cloudlet[i].setUserId(userId);
list.add(cloudlet[i]);
}
return list;
}
////////////////////////// STATIC METHODS ///////////////////////
/**
* Creates main() to run this example*/
public static void main(String[] args) { Log.printLine("Starting CloudSimExample6...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of grid users Calendar calendar = Calendar.getInstance(); boolean
trace_flag = false; // mean trace events
// Initialize the CloudSim library CloudSim.init(num_user, calendar, trace_flag);

25
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a
CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0"); @SuppressWarnings("unused")
Datacenter datacenter1 = createDatacenter("Datacenter_1");
//Third step: Create Broker DatacenterBroker broker = createBroker(); int brokerId =
broker.getId();
//Fourth step: Create VMs and Cloudlets and send them to broker vmlist =
createVM(brokerId,20); //creating 20 vms
cloudletList = createCloudlet(brokerId,40); // creating 40 cloudlets
broker.submitVmList(vmlist); broker.submitCloudletList(cloudletList);
// Fifth step: Starts the simulation CloudSim.startSimulation();
// Final step: Print results when simulation is over List<Cloudlet> newList =
broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList); Log.printLine("CloudSimExample6 finished!");
}
catch (Exception e)
{
Log.printLine("The simulation has been terminated due to an unexpected
}
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store one or more
// Machines
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
// create a list to store these PEs before creating a Machine.
List<Pe> peList1 = new ArrayList<Pe>(); int mips = 1000;
// 3. Create PEs and add these into the list.
//for a quad-core machine, a list of 4 PEs is required:
peList1.add(new Pe(0, new PeProvisionerSimple(mips)));
// need to store Pe id and MIPS Rating
peList1.add(new Pe(1, new PeProvisionerSimple(mips))); peList1.add(new Pe(2, new
PeProvisionerSimple(mips))); peList1.add(new Pe(3, new PeProvisionerSimple(mips)));
//Another list, for a dual-core machine List<Pe> peList2 = new ArrayList<Pe>();
peList2.add(new Pe(0, new PeProvisionerSimple(mips))); peList2.add(new Pe(1, new
PeProvisionerSimple(mips)));
//4. Create Hosts with its id and list of PEs and add them to the list of machines int hostId=0;
int ram = 2048; //host memory (MB) long storage = 1000000; //host storage int bw = 10000;
hostList.add(
new Host( // This is our first machine hostId++;
hostList.add(new Host(hostId,new RamProvisionerSimple(ram), new BwProvisionerSimple(bw),
storage,peList2,new VmSchedulerTimeShared(peList2))); // Second machine
//To create a host with a space-shared allocation policy for PEs to VMs:
//hostList.add(new Host(hostId,new CpuProvisionerSimple(peList1),new
RamProvisionerSimple(ram),new BwProvisionerSimple(bw),storage,new
VmSchedulerSpaceShared(peList1) new wProvisionerSimple(bw), storage, peList1,
new VmSchedulerTimeShared(peList1)
Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of Resource // Machines, allocation policy:
time- or space-shared, time zone // and its price (G$/Pe time unit).

26
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

String arch = "x86"; // system architecture String os = "Linux"; // operating system


String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
hostId,double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource double costPerStorage =
0.1; // the cost of using storage in this resource
double costPerBw = 0.1; // the cost of using bw in this
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not
adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics( arch, os, vmm, hostList,
time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object. Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList),
storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets
according to the specific rules of the simulated scenario private static DatacenterBroker
createBroker(){
DatacenterBroker broker = null; try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
e.printStackTrace(); return null;
}return broker;
}
/**
Prints the Cloudlet objects
@param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size(); Cloudlet cloudlet; String indent = " "; Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + indent + "Time" + indent + "Start Time" + indent +
"Finish Time");
DecimalFormat dft = new DecimalFormat("###.##"); for (int i = 0; i < size; i++) {cloudlet = ist.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){ Log.print("SUCCESS");
Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent +
cloudlet.getVmId() +dft.format(cloudlet.getActualCPUTime()) +indent + indent + indent +
indent + indent +dft.format(cloudlet.getExecStartTime())+ indent + indent + indent +
dft.format(cloudlet.getFinishTime()));}
}
}
}

27
CS1707- Cloud Computing Laboratory Department of CSE 2024 - 2025

OUTPUT :

RESULT:
Thus the study on cloudsim simulation tool is done successfully.

28

You might also like