CC Lab
CC Lab
Selvan/Selvi……………………………………………………..…………………………… of the……….
during the academic year 2024-2025 in the CCS335 Cloud Computing Laboratory
Mark
EX.NO DATE Name of the Experiment PageNo. Signature
Awarded
AIM:
PROCEDURE:
Step 1: Download and install Oracle VM Virtualbox in Windows platform (Host OS)
https://www.virtualbox.org/
Step 3: Choose the Latest version of Ubuntu and 32-bit and click “Start Download”
Step 4: Run VirtualBox by double-clicking the icon and Click “New” button on the top
left corner
Step 5: Click “Continue” on the pop-up window and Type VM name, select Linux for
the OS and choose “Ubuntu” for the version
Step 6: Choose the amount of memory to allocate (choosing between 512 MB to 1024
MB) and Click Continue or Next
Step 7: Choose create a new virtual hard disk and Click Continue or Next
Step 8: Choose VDI (VirtualBox Disk Image) and Click Continue or Create
Step 9: Install Ubuntu OS in VM and when finished, click Restart and press Enter
Thus the installation procedure for Virtualbox with different flavours of linux or windows
OS on top of windows7 was executed successfully.
Ex. No : 2
Install a C compiler in the virtual machine created using
Date : virtual box and execute Simple Programs
AIM:
To install a C compiler in the virtual machine created using virtual box and execute a
Simple Programs
PROCEDURE:
>gcc –version
Step 4: Open the editor
#include<stdio.h>
main()
{
printf("Hello World\n");
}
Step 6: Type ls command on Terminal to see all files under current folder
>./a.out
Step 8: If you see “Hello World” on the next line, you just successfully executed your
First C program!
OUTPUT:
RESULT:
Thus the installation of a C compiler in the virtual machine created using virtual box and
execution of a Simple Programs was executed successfully.
Ex. No : 3
Install Google App Engine. Create hello world app and other
Date : simple web applications using python/java.
AIM:
To Install Google App Engine, Create hello world app and other simple web applications
using python/java.
PROCEDURE:
https://www.python.org/downloads/
https://cloud.google.com/sdk/docs/install
runtime: python27
api_version: 1
threadsafe: false
handlers:
- url: /
script: text.py
>google-cloud-sdk\bin\dev_appserver.py “C:\Users\Administrator\Desktop\cc”
http://localhost:8080/
OUTPUT:
RESULT:
Thus the installation of Google App Engine, Create hello world app and other simple web
applications using python was executed successfully.
Ex. No : 4
Use GAE launcher to launch the web applications
Date :
AIM:
To Use GAE launcher to launch the web applications.
PROCEDURE:
AIM:
To simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not
present in CloudSim.
PROCEDURE:
• Java Installation and set path variable.
• Download CloudSim and additional jar file
o Download CloudSim 3.0.3
o Download commons math 3 jar file
• Eclipse IDE Installation
• Run CloudSim in Eclipse
o Put up commons-math-3.3.6.1.jar file into jar folder of CloudSim3.0.3
o Bulid a new java project with CloudSim3.0.3
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;
/**
* A simple example showing how to create a datacenter with one host and run one
* cloudlet on it.
*/
public class CloudSimExample1 {
// 4. Create Host 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(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
/**
* 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 + "Time" + indent
+ "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.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()
+ indent + indent
+ dft.format(cloudlet.getActualCPUTime()) + indent
+ indent + dft.format(cloudlet.getExecStartTime())
+ indent + indent
+ dft.format(cloudlet.getFinishTime()));
}
}}}
OUTPUT:
RESULT:
Thus the simulation of cloud scenario using CloudSim and running a scheduling
algorithm that is not present in CloudSim was executed successfully.
Ex. No : 6
Find a procedure to transfer the files from one virtual
Date : machine to another virtual machine
AIM:
To find a procedure to transfer the files from one virtual machine to another virtual
machine
PROCEDURE:
Three main options to share data between a virtual machine and a host PC:
• Drag and Drop (Copy and Paste)
• USB drive
• Shared Folder
AIM:
To Install Hadoop single node cluster and run simple applications like wordcount.
PROCEDURE:
Step 1: Download & install Hadoop 2.8.0 & Java JDK 1.8.0
Setup Java and Hadoop
Step 2: Check either Java 1.8.0 is already installed on your system or not, use “Javac -
version” to check.
Step 3: If Java is not installed on your system then first install java under “C:\JAVA”
Step 4: Extract file Hadoop 2.8.0.tar.gz or Hadoop-2.8.0.zip and place under
“C:\Hadoop-2.8.0”.
Step 5: Set the path HADOOP_HOME Environment variable on windows 7/10
Configuration
Step 6: Edit file C:/Hadoop-2.8.0/etc/hadoop/core-site.xml, paste below xml paragraph
and save this file.
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
Step 7: Rename “mapred-site.xml.template” to “mapred-site.xml” and edit this file
C:/Hadoop-2.8.0/etc/hadoop/mapred-site.xml, paste below xml paragraph and save this
file.
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
Step 8: Create folder “data” under “C:\Hadoop-2.8.0”
• Create folder “datanode” under “C:\Hadoop-2.8.0\data”
• Create folder “namenode” under “C:\Hadoop-2.8.0\data”
AIM:
To run simple applications like Hadoop wordcount MapReduce Program.
PROCEDURE:
Step 3: Open cmd in Administrative mode and move to “C:/Hadoop-2.8.0/sbin” and start
cluster
Start-all.cmd
Step 4: Create an input directory in HDFS
hadoop fs -mkdir /input_dir
Step 5: Copy the input text file named input_file.txt in the input directory (input_dir) of
HDFS
hadoop fs -put C:/input_file.txt /input_dir
Step 8: Verify input_file.txt available in HDFS input directory (input_dir)
hadoop fs -ls /input_dir/
Step 9: Verify content of the copied file
hadoop dfs -cat /input_dir/input_file.txt
Step 10: Run MapReduceClient.jar and also provide input and out directories
hadoop jar C:/MapReduceClient.jar wordcount /input_dir /output_dir
Step 11: Verify content for generated output file
Some Other useful commands in hadoop:
To leave Safe mode
hadoop dfsadmin –safemode leave
To Delete file from HDFS directory
hadoop fs -rm -r /iutput_dir/input_file.txt
To Delete directory from HDFS directory
hadoop fs -rm -r /iutput_dir
OUTPUT:
RESULT:
Thus the procedure to run simple applications like hadoop wordcount program was
executed successfully.
Ex. No : 8
Creating and Executing Your First Container Using Docker
Date :
Aim:
To create and execute the container using Docker.
Prerequisites
In order to create your first Docker application, I invite you to create a folder on your
computer. It must contain the following two files:
•
A ‘main.py’ file (python file that will contain the code to be executed).
•
A ‘Dockerfile’ file (Docker file that will contain the necessary instructions to
create the environment).
Normally you should have this folder architecture:
.
├── Dockerfile
└── main.py
0 directories, 2 files
#!/usr/bin/env python3
print("hello-world")
Nothing exceptional, but once you see “Docker is magic!” displayed in your terminal you
will know that your Docker is working.
The first step to take when you create a Docker file is to access the DockerHub website.
This site contains many pre-designed images to save your time (for example: all images
for linux or code languages).
# In order to launch our python code, we must import it into our image.
# We use the keyword 'COPY' to do that.
# The first parameter 'main.py' is the name of the file on the host.
# The second parameter '/' is the path where to put the file on the image.
# Here we put the file at the image root folder.
COPY main.py /
# We need to define the command to launch when we are going to run the image.
# We use the keyword 'CMD' to do that.
# The following command will execute "python ./main.py".
CMD [ "python", "./main.py" ]
Once your code is ready and the Dockerfile is written, all you have to do is create your
image to contain your application.
There you go, that’s it. You should normally see “hello-world” displayed in your
terminal.
Result:
Thus the creation and Execution of Container program using Docker executed
successfully.
Ex. No : 9
Run a Container From Docker Hub
Date :
Aim:
To run a container From Docker Hub.
docker version
docker login
Step-2: Pull Image from Docker Hub
Step-3: Run the downloaded Docker Image & Access the Application
• Copy the docker image name from Docker Hub
• docker run --name app1 -p 80:8080 -d stacksimplify/dockerintro-springboot-
helloworld-rest-api:1.0.0-RELEASE
• http://localhost/hello
docker ps
docker ps -a
docker ps -a –q
docker images
docker rmi <image-id>
Step-8: Remove Image
docker images
docker rmi <image-id
Result: