Cloud Computing Manual (Final)
Cloud Computing Manual (Final)
CCS335-CLOUD COMPUTING
NAME :
REGISTER NUMBER :
DEPARTMENT : CSE
REGULATION : 2021
VISION
MISSION
To provide quality education in emerging technologies in accordance with industrial
trends.
To build good research capabilities and support new innovations.
DEPARTMENT OF CSE
VISION
To create young software professionals to compete the global challenges in the field of computer
science and engineering and be researcher to meet the need of society.
MISSION
To provide quality education to develop software for real time problem in scientific and
business application for various needs of industry.
To provide learning ambience to enhance innovations, problem solving skill, leadership
qualities, team spirit and ethical responsibility to serve the society.
PEO
The graduates will be able to design and to adapt modern tools to innovate ideas and
develop computational solution for technological problem.
The graduates will be able to develop professional skills for employment and understand
the need of lifelong learning for a successful professional career.
To develop an ability to become successful professional, entrepreneur and urge for
AIM:
To Install Virtual box/VMware Workstation with different flavours of linux or windows OS on top of
windows7 or 8 Procedure
1
3. Type the Name for the virtual machine, like Ubuntu 16. VirtualBox will try to predict the
Type and Version based on the name you enter. Otherwise, select:
Type: Linux
Version: Ubuntu (64-bit)
and click Next.
4. Next we need to specify how much memory to allocate the virtual machine. According to the
Ubuntu system requirements handle it.
Basically the higher you can set the memory without severly impacting your host machine, the
better the performance of the guest machine. If not sure, stick with 2GB.
2
5. On the Hardware screen select Create a virtual hard disk now and click Create
6. Accept the default option VDI for Hard disk file type (or change it if you and click
Next
7. Next we are prompted for Storage on physical hard disk. The options are Dynamically
allocated and Fixed size. use the default of Dynamically allocated. Click Next
8. Choose the hard disk size and storage location. The Ubuntu system requirements recommend
25GB. Remember, we choose Dynamically allocated as our storage option in the last step, so we
allocate it as required,
up to the maximum 25GB we specified. Click Create
9. The wizard will finish and we are returned to the main VirtualBox window. Click Settings
10. In the left pane select Storage, then in the right select the CD icon with the word Empty
beside it.
3
11. Under Attributes click the CD icon (highlighted in the screenshot above) and select
Choose Virtual Optical Disk File and browse to the downloaded file ubuntu-16.04.1- desktop-
[Link]
12. Click OK to close the Settings dialog window. The virtual machine should now be ready
to start.
Install Ubuntu
In VirtualBox your VM should be showing as Powered Off, and the optical drive configured to pointto
the Ubuntu ISO file we downloaded previously.
1. In VirtualBox, select the virtual machine Ubuntu 16 and click Start. VirtualBox will launcha
new window with the vm and boot from the iso.
4
2. Click Install Ubuntu
5. You will be prompted with a warning saying the changes will be written to disk. Click
Continue
5
6. Select your timezone and click Continue
7. Select your keyboard layout. I accepted the default of English (US) and click Continue
8. Enter a username and password, then click Continue
9. The Ubuntu installation may take several minutes to run, so have another coffee.
6
10. When the installation is finished you will be prompted to restart. Save and close
anything else you may have open and click Restart Now
11. Now when the vm reboots you may see this message.
7
From the menu select Machine > Settings.
Navigate back into the Storage settings where we previously selected the iso file. If the Ubuntu
iso file is still there, remove it. Otherwise close the Settings window and in the vm press Enter to
proceed.
12. If all went well the VM should boot to the Ubuntu login screen. Enter your password to
continue.
Ubuntu should run normally in the VirtualBox environment. If everything is far too small, you can adjust
the by selecting View > Scale Factor > 200%.
Have fun!
8
Result:
Thus the Virtual box/Oracle Virtual machine has installed Succesfully.
9
[Link] INSTALL A C COMPILER IN THE
VIRTUAL MACHINE AND EXECUTE A
DATE:
SAMPLE PROGRAM.
Aim :
Procedure:
step1:
Install the centos or ubuntu in the VMware or Oracle Virtual Machine 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:
Write a sample program like
[Link]
#include<iostream.h>
using namespace std;
int main()
{
return 0;
}
10
Step 5:
First we need to compile and link our program. Assuming the source code is saved in a file
[Link], we can do that using GNU C++ compiler g++, for example g++ -Wall -o
welcome [Link] and output can be executed by ./welcome
Result:
Thus the GCC compiler has installed and executed in this sample program successfully.
11
[Link] Install Google App Engine. Create hello world app
and other simple web applications using
DATE:
python/java
Aim:
To install Google App Engine (GAE) and create a Hello World application and simple
web applications using Python / Java.
Procedure:
Step1:
12
Step 2:
Step 3:
Click Console.
13
Step 4:
The Google Cloud Platform Dashboard is displayed. Scroll down and select the APIs & Services
option.
Step 5:
Select Library.
14
Step 6:
A search bar appears. Type App Engine in the search bar.
15
Step 7:
Select App Engine Admin API and click on Enable.
Step 8:
Click Activate Cloud Shell in the top left corner and click Continue.
16
Step 9:
The Cloud Shell terminal window appears as shown in the figure.
Step 10:
To open the Python source code, GitHub can be used. The GitHub link is given below.
17
Python GitHub Code Link:
GitHub - GoogleCloudPlatform/python-docs-samples: Code samples used on [Link]
Step 11:
Select code.
Step 12:
After selecting the source code, the repository URL is displayed. Copy the URL.
18
Step 13:
19
Step 14:
Enter the command git clone <copied URL> in the Cloud Shell terminal. Remove .git from the
end of the URL and press Enter.”
Step 15:
Type ls to list out the items.
20
Step 16:
Enter the command cd python-docs-samples to move into the project directory.
Step 17:
Enter the command ls to display the files and folders present inside the python-docs-samples
directory.
Step 18:
Enter the command cd appengine to navigate to the App Engine directory.
21
Step 19: Type ls to list out the items.
Step 20: Enter the command cd standard_python3 to navigate to the directory, and then type ls
to list the items.
Step 21: Enter the command cd hello_world to navigate to the Hello World application
directory.
Step 22: Enter the command ls to display the files. Here, [Link] represents the configuration
file and [Link] represents the source file.
Step 23:
To display the contents of the [Link] source file, use the command cat [Link].
22
Step 24:
The source code of the [Link] file used for the Hello World application is shown below.
Step 25:
Enter the command python3 [Link] to run the Python program. After successful
execution, the application URL is displayed.
23
Step 26:
By clicking the generated URL, the output of the application is displayed in the web browser.
Result:
Google App Engine was successfully installed and configured. A Hello World application
and simple web applications were developed and deployed using Python and Java.
24
[Link] USE GAE LAUNCHER TO LAUNCH THE
WEB APPLICATIONS
DATE:
AIM:
To use GAE launcher to launch the web applications.
PROCEDURE:
Step 1: Install Python 2.7.3 on the system.
25
Step 2:
Install Google App Engine Launcher version 1.9.62 using the link provided below.
[Link]
Step 3:
Select Search → Google App Engine Launcher to open the application.
26
27
Step 4:
Go to the Desktop and create empty folder.
Step 6:
28
Step 7: Choose File → Create New Application from the menu.
Step 9: In the dialog box, enter the Application Name and specify the Parent Directory as the
folder created earlier.
29
Step 10: When the created folder is opened, the configuration file and source code file can be
seen.
Step 11: Select the created App Engine application (it will be highlighted in blue).
Step 12: Select the current App Engine application and click Run.
30
Step 14: The result can be viewed on port number 8080. Open a web browser and type
localhost:8080 in the address bar.
Result:
Thus the Google App Engine has launched in this sample program agreeably.
31
[Link] SIMULATE A CLOUD SCENARIO USING CLOUDSIM
AND RUN A SCHEDULING ALGORITHM THAT IS NOT
DATE: IN CLOUDSIM
AIM:
Simulate a cloud scenario using cloudsim and run a scheduling algorithm that is not in
Cloudsim.
PROCEDURE:
32
c. Install java setup
33
The above address should be copied and the copied address should be pasted in the Edit the
system environment variables window.
Type Edit the system environment variables in the search box and open it.
34
35
1. Click on Edit the system environment variables and select Environment Variables
in the System Properties window.
36
3. Click New to add a new environment variable.
37
4. Paste the copied address in the given field and click OK.
1. Open a web browser and type “CloudSim 3.0.3 zip download” in the search bar.
2. Select a reliable source and download the CloudSim 3.0.3 ZIP file to your system.
38
3. Download the [Link] file and extract it to the desired location on the system.
1. Open a web browser and type “Commons Math 3” in the Google search bar
39
2. Select the first link from the search results.
40
[Link] and extract the ZIP file.
41
6. Paste the copied JAR file inside the CloudSim jars directory to complete the setup.
42
7. Copy the cloudsim-3.0.3 folder and paste it into the Documents folder for further use.
43
Step 3: Eclipse IDE Installation
a. If java 64 bit installed then download 64 bit Eclipse, otherwise if java 32 bit then download 32
bit Eclipse.
44
45
b. Install Eclipse IDE
46
2. It will be opening like this.
47
3. Select Create a Java Project.
48
4. Give Project name.
49
5.
50
6. Navigate to the Documents folder and Select cloudsim-3.0.3.
51
7. Click Next.
52
8. Click Finish.
53
8. Expand cloudsim2.
9. Under it, go to examples → [Link].
10. Select the first program listed. It will be displayed in the editor.
Step 9:
Click on Run.
Select Proceed to execute the program.
54
Step 10:
Result:
Thus the cloud scenario using cloudsim and run a scheduling algorithm that is not in
Cloudsim was run successfully.
55
[Link] Find a procedure to transfer the files from one
virtual machine to another virtual machine.
DATE:
AIM:
To find a procedure to transfer the files from one virtual machine to another virtual
machine.
Procedure:
Step 1:
Install ubuntu OS in the VMware or Oracle Virtual Machine as per previouscommands .
Step 2:
Login into the VM of installed OS.
Step 3:
[Link] the Terminal window in the Ubuntu system .
56
Step 4:
1. After installing the OpenSSH server, go to the Devices menu in the virtual machine
window.
57
Step 5:
Type the following command to view the network configuration.
ifconfig
Press Enter to display the IP address and network interface details of the system.
58
Step 6:
1. Open a web browser in the Windows system.
4. Run the downloaded setup file and follow the installation instructions.
59
Step 7:
1.A login dialog box will appear.
[Link] the Host Name field, enter the IP address obtained using the ifconfig command.
60
The connection will be established successfully, and the files of the remote Upuntu
System will be displayed in WinSCP.
61
Step 8:
In WinSCP , locate the required document in the system files panel.
Drag and drop or copy the document from the local system to the Ubuntu
machine.
The selected document will be successfully transferred to the Ubuntu System.
62
Step 9:
Open the Ubuntu system.
Go to the Files folder in Ubuntu.
The transferred file can be seen inside the Ubuntu files directory.
Result:
The file was successfully transferred from one virtual machine to another virtual
machine.
63
[Link] Install Hadoop single node cluster and run simple
applications like word count.
DATE:
Aim:
To Install Hadoop single node cluster and run simple Applications like word count.
Steps:
Install Hadoop.
Step1:
Click here to download the Java 8 Package. Save this file in your home directory.
Step2:
Command:[Link]
Step3:
Download the Hadoop2.7.3 Package.
Command: [Link]
65
Step5:Add the Hadoop and Java paths in the bash file (.bashrc). Open. bashrc
Command:vi .bashrc
For applying all these changes to the current Terminal, execute the source command.
Command: [Link]
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.
66
Fig: Hadoop Installation Checking Java Version
Step6:
Command: cdhadoop-2.7.3/etc/hadoop/
Command: ls
67
All the Hadoop configuration files are located in hadoop-2.7.3/etc/hadoop directory as you can
see in the snapshot below:
Step 7:
Open [Link] and edit the property mentioned below inside configuration tag:
[Link] informs Hadoop daemon where NameNode runs in the cluster. It contains
configuration settings of Hadoop core such as I/O settings that are common to HDFS & Map
Reduce.
Command: [Link]
1
2 <configuration>
3 <property> 68
<name>[Link]</name>
4 <value>hdfs://localhost:9000</v
5 alue>
</property>
Step8:
Edit [Link] and edit the property mentioned below inside
configurationtag:
[Link] contains configuration settings of HDFS daemons (i.e. NameNode, DataNode,
Secondary NameNode). It also includes the replication factor and block size of HDFS.
Command:[Link]
1
2
3
<configuration>
4 <property>
5 <name>[Link]</name>
6 <value>1</value>
7 </property>
<property>
8 <name>[Link]</name>
9 <value>false</value>
10 </property>
</configuration>
11
Step9:
Edit the [Link] file and edit the property mentioned below
Inside configuration tag:
69
[Link] contains configuration settings of MapReduce 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, [Link] file is not available. So, we have to create the mapred- [Link]
file using [Link] template.
1
2
3 <configuration>
4 <property>
5 <name>[Link]</name>
<value>yarn</value>
6 </property>
7 </configuration>
Step 10:
70
Edit [Link] and edit the property mentioned below inside configuration tag:
[Link] contains configuration settings of Resource Manager and Node Manager like
application memory management size, the operation needed on program & algorithm, etc.
Command: [Link]
1
2
3 <configuration>
4 <property>
5 <name>[Link]-services</name>
<value>mapreduce_shuffle</value>
6 </property>
7 <property>
8
9 name>
<value>[Link]</value>
1 </property>
0 </configuration>
1
71
Command: vihadoop [Link]
Command: cd
Command: cd hadoop-2.7.3
Command: bin/hadoopnamenode-format
This formats the HDFS via Name Node. This command is only executed for the first time.
Formatting the file system means initializing the directory specified by the [Link]
variable.
Never format, up and running Hadoop file system. You will lose all your data stored in the
HDFS.
Step13:
Once the Name Node is formatted, go to hadoop-2.7.3/sbin directory and start all the
daemons.
72
Command:cdhadoop-2.7.3/sbin
Either you can start all daemons with a single command or do it individually.
Command:./[Link]
The Name Node is the center piece of an HDFS file system. It keeps the directory tree of all files
stored in the HDFS and tracks all the file stored across the cluster.
73
Fig:Hadoop Installation Starting Name Node
On startup, a Data Node connects to the Name node and it responds to the requests from the
Name node for different operations.
Fig:HadoopInstallation StartingDataNode
Resource Manager is the master that arbitrates all the available cluster resources and thus helps
in managing the distributed applications running on the YARN system. Its work is to manage
each Node Managers and the each Application Master.
74
Fig: Hadoop Installation Starting Resource Manager
The Node Manager in each machine framework is the agent which is responsible for managing
containers, monitoring their resource usage and reporting the same to the Resource Manager.
Job History Server is responsible for servicing all job history related requests from client.
Command:./[Link] starthistoryserver
Step14:
To check that all the Hadoop services are up and running, run the below command.
75
Command:jps
Step15:
Now open the Mozillabrowser and go
To localhost:50070/[Link] to check the Name Node interface.
Fig:HadoopInstallation StartingWebUI
Result:
Thus the Hadoop one cluster was installed and simple applications executed successfully.
76
[Link] Creating And Executing Your First Container
Using Docker.
DATE:
AIM:
Once the installation is complete, you can verify it by checking the Docker version and making
sure the Docker daemon is running.
STEP:2
Verifying the Installation and Accessing the Docker CLI
For those using the Ubuntu operating system, you can verify the Docker installation by running
the following command:
[Link] --version
[Link] systemctl status docker
With Docker successfully installed, you can now access the Docker command-line interface (CLI)
to start creating and managing containers.
The CLI provides a set of commands for interacting with Docker, allowing you to build, run, and
manage containers with ease.
77
STEP 3 :
Crafting Your First Dockerfile
Some of the key concepts in Docker revolve around creating a Dockerfile, which is a text
document that contains all the commands a user could call on the command line to assemble an
image.
The Docker file contains all the information Docker needs to build the image. Let’s take a look at
how to define a simple Dockerfile and some best practices for writing it.
STEP 4 :
Defining a Simple Dockerfile
First, Let’s start by creating a basic Dockerfile.
In this example, we’ll create a Dockerfile that simply prints “Hello,World!” when run as a
container.
1. FROM alpine
2. CMD echo "Hello, World!"
STEP 5 :
Best Practices for Writing Dockerfiles
Dockerfiles should follow best practices to ensure consistency, maintainability, and reusability.
One of the best practices is to use the official base images from Docker Hub, as they are well-
maintained and regularly updated. It’s also important to use specific versions of the base images to
avoid unexpected changes.
[Link] node:14
[Link] . /app
[Link] /app
[Link] npm install
[Link] ["npm", "start"]
Best practices for writing Dockerfiles also include using a .docker ignore file to specify files and
directories to exclude from the context when building the image.
This helps to reduce the build context and improve build performance.
65
Some additional best practices for writing Dockerfiles include avoiding running commands as
root, using multi-stage builds for smaller images, and using environment variables for
configuration.
STEP 6:
Building and Running Your Container.
To build and run your Docker container, you will need to follow a few simple steps.
First, you will need to build the Docker image from your Dockerfile.
Once the image is built, you can run your container using the Docker run command. In this
section, we will walk through each step in detail.
To build the Docker image from your Dockerfile, you will need to navigate to the directory where
your Dockerfile is located and run the following command:
docker build -t your-image-name .
This command will build the Docker image using the instructions specified in your Dockerfile.
Once the build process is complete, you will have a new Docker image ready for use.
With Docker, you can easily monitor the performance of your containers using built-in commands.
By running docker stats , you can view real-time CPU, memory, and network usage for all running
containers.
This can help you identify any resource bottlenecks and optimize your container performance.
66
Stopping, Starting, and Removing Containers
The Docker CLI provides simple commands for stopping, starting, and removing containers.
The command
docker stop [container_name]
docker rm [container_name]
Additionally, you can use the docker ps command to list all running containers, and docker ps -a to see all
containers, including those that are stopped.
This gives you full visibility and control over your containers.
RESULT:
Thus a container is created and executed in a docker successfully.
67
[Link] Run a container from DockerHub.
DATE:
AIM:
To run and execute a container from Docker Hub using Docker.
PROCEDURE:
Step1: Get the sample application. If you have it, you can clone the repository for the sample
application. ...
Step2: Explore the Docker file....
Step 3: Build your first image. ...
Step 4: Run your container. ...
Step 5: Verify that your container is running.
A Docker ID grants you access to Docker Hub repositories and allows you to explore images that are
available from the community and verified publishers. You’ll also need a Docker ID to share images on
Docker Hub.
To create a repository:
68
You’ve created your first repository.
2. Sign in to Docker Desktop using the Docker ID you created in step one.
Step 4:
Go to Visual Studio code Application and create your Docker File.
[Link]
FROM python:3.8-slim
WORKDIR /app
COPY . /app
CMD ["python","[Link]"]
[Link]
print ("hello")
69
After creating build and run your Docker File.
70
Copy the link and paste it into the browser.
71
Go to your Docker Hub repository and verify that the container image has been successfully added.
72
To verify, Type ls command
Go to Docker Desktop on your local system. The pulled image will be available there.
73
Result:
Thus the Run a container from Docker Hub is run successfully and output is verified.
74