Cloud Computing
Cloud Computing
Aim:
To install VirtualBox or VMware Workstation and set up different flavors of Linux/Windows
OS on top of Windows 7/8.
Software/Tools Required:
Oracle VirtualBox / VMware Workstation
ISO file of Ubuntu or other Linux/Windows OS
Windows Host Machine
Procedure:
1. Install VirtualBox:
o Download Oracle VirtualBox from the official website:
https://www.virtualbox.org/
o Run the installer and follow the installation steps.
Beginning with the Installation:
1
Getting Started:
2
Ready to Install:
3
Installing Certificates:
Finished Installation:
4
When you will open virtualbox it will look like as shown below:
5
o Allocate memory (e.g., 2048 MB RAM).
o Create a virtual hard disk (e.g., 20 GB, VDI format, dynamically allocated).
Create Virtual Machine with VirtualBox on Linux?
To Start Virtual Machine on Linux with VirtualBox, you should have the ISO
File of the required Operating System. Here, we are using a sample ISO File (Kali
Linux). However, the moreover steps will be the same for each other Virtual
Machines.
6
Step 3: Change the Base Memory Size by at least 3000 MB to adjust any Virtual
Machine on Linux.
Step 4: In the same way, increase the Disk Size by 30 GB for the same purpose.
7
Step 5: Click on Finish to continue in the process.
8
Step 2: Under the General Settings, change to the Version Debian.
Step 3: Change the Graphics Controller to VBoxVGA & click on the OK option.
9
Section 3: Executing Virtual Machine on VirtualBox in Linux
10
Step 3: After a long time & more configuration, it will ask to click on the Continue to
Reboot the Virtual Machine. And hence, we have completed our job.
11
Setup Wizard will appear and click at Next button.
12
Enter your Virtual Machine name, and choose your guest OS and architecture (32- vs.
64-bit) from the dropdown menu and click Next button.
A 64-bit guest needs the CPU virtualization technology (VT-x AMD/V) to be enabled
in BIOS.
Enter memory (RAM) to reserve for your virtual machine and click Next button.
Leave enough memory to the host OS.
13
Tick at Startup Disk and Create New Hard disk and click at Next button.
Choose the type of file that you want to use for virtual disk and click Next button.
14
Choose your storage detail and click Next button.
Enter the size of your virtual disk (in MB) and click Next button.
A dynamically growing virtual disk will only use the amount of physical hard drive
space it needs. It is better to be rather generous to avoid running out of guest hard
drive space.
15
You will see the detail of your input here. Click Create button to continue.
16
The "New Virtual Machine Wizard" will close and back to VirtualBox Manager.
Select your Virtual Machine and click Start button.
17
Click at 'folder' icon and choose your Ubuntu iso directory.
18
In 'Summary' box, click Start button.
19
This screen will appear when it start boot.
After a successful installation we have to remove our installation .iso image from the
virtual optical drive before we reboot. This can be done from the "Devices" menu or
by removing the .iso from the VM settings:
20
4. Install the OS:
o Follow the on-screen instructions to install Ubuntu/Linux or Windows inside
the VM.
Steps to Install Ubuntu on VirtualBox
Step 1: Before we begin with the installation process, we need to Download ISO
for Ubuntu. For that, all the versions of Ubuntu are available on the Official Site.
21
Step 3: Give a Name to your Virtual Machine and select the Location for it to install.
22
Step 5: Create a Virtual Hard Disk for the machine to store files.
Step 6: Select the type of Hard disk. Using VDI type is recommended.
23
Step 7: Either of the Physical Storage types can be selected. Using a Dynamically
Allocated Disk is by default recommended.
Step 8: Select Disk Size and provide the Destination Folder to install.
24
Step 9: After the Disk creation is done, boot the Virtual Machine and begin
installing Ubuntu.
Step 10: If the installation disk is not automatically detected. Browse the file location and
select the ISO file for Ubuntu.
25
Step 11: Proceed with the installation file and wait for further options.
Step 12: Click on the Install Ubuntu option, this might look different for other Ubuntu
versions.
26
Step 13: Select Keyboard Layout, if the defaults are compatible, just click on
the Continue button and proceed.
Step 14: Select Installation Type. By default, it is set to Normal Installation, which is
recommended, but it can also be changed to Minimal Installation if there is no need for all
Ubuntu features.
27
Step 15: Click on the Install Now button and carry on with the installation. Do not get
worried about the Erase disk option, it will only be effective inside the virtual machine,
and other system files outside the VirtualBox remain intact.
Step 16: Click on the Continue button, and proceed with writing changes on the disk.
28
Step 17: Select your Location to set the Time Zone.
Step 18: Choose a Name for your computer and set a Password to secure login info.
29
Step 19: Wait for the installation process to complete.
Step 20: Once the installation process is over, reboot your Virtual Machine.
30
Step 21: Voila!! You’re finished with the installation process. Now you can use Ubuntu
along with Windows, without creating a dual boot.
31
Step 1: To overcome this and make Ubuntu fullscreen in Virtual Box, click
on Devices then on Insert Guest Additions CD Image.
Step 2: Now you will be able to see a Disk icon on the Taskbar, click on that and it will
open the disk
32
Step 3: Write right-click inside the folder select Open in the Terminal, and run the
following commands. It will ask for the user’s password, enter the password, and wait till
completion.
sudo apt update
33
Step 5: Now it will ask for the password and after checking the password a new tab will
open inside the terminal. Enter Yes there.
Step 6: After installation restart Ubuntu and now you can use Ubuntu in Full-Screen Mode.
So, these are some long steps needed to Download & Install Ubuntu on VirtualBox. You
should go through the entire steps for successfully Launching Ubuntu on VirtualBox in
Full- Screen Mode. If you miss any step or perform any error, the VirtualBox Installation
of Ubuntu will not be successful.
34
Experiment 2: Install a C Compiler in the Virtual Machine and
Execute Simple Programs
Aim:
Install a C compiler in the virtual machine created using a virtual box and execute
Simple Programs.
Hands-on Procedure:
STEP 1: Install the VMware player and host the Virtual Machine(CorePlus)
STEP 2: Open the VMware workstation and power on the virtual machine
Step2: After loading the Guest Operating Open the terminal and type the command
tc@box:~$
tce-load -wi compiletc
35
Step3: After downloading and installing all the library and gcc it return to the prompt.
Step4: Open the Terminal and type the Command sudo editor then the text window will
appear
type your c program and save it with .c extension.
36
c@box:~$cc demo.c
Step7 : For output use the command ./a.out.
tc@box:~$./a.out
Enter year: 1991
1991 is not a Leap Year
tc@box:~$
37
Result:
Thus the Install a C compiler in the virtual machine created using a virtual box and
execute Simple Programs.
38
Experiment 3: Create an Amazon EC2 Instance and Set Up a Web Server
What Is EC2?
Think of EC2 (Elastic Compute Cloud) as a hotel room in the cloud. Instead of booking a
physical server to store your website, you’re renting one from Amazon’s magical cloud
infrastructure. This room (or instance) comes with all the amenities you need to host a
website. Today, we’ll install HTTPD (a web server software) in our “room” to make our
website live. 🏨✨
What is HTTPD?
At its core, HTTPD stands for Hypertext Transfer Protocol Daemon. Let’s break that
down:
Hypertext Transfer Protocol (HTTP): This is the standard protocol used on the web.
When you type a URL into your browser or click a link, you’re using HTTP to tell the
server, “Hey, send me this web page!”
Daemon (D): A daemon is just a fancy term for a background process that runs
continuously on a server. In this case, the daemon is responsible for responding to
requests from web browsers (like Chrome or Firefox) and sending back the
appropriate content.
So, HTTPD is a program that listens for incoming HTTP requests (like when you
visit a webpage) and serves back the data (HTML, CSS, images, and so on) needed to
display that page.
HTTPD vs. Apache2: Different Names, Same Game
Depending on your Linux distribution, you may encounter different names for the same basic
software:
On RPM-based distributions (like Red Hat, CentOS, or Fedora), it’s called httpd.
On Debian-based distributions (like Ubuntu or Debian itself), it’s referred to as
apache2.
Let’s look at the steps you can use to launch your EC2 instance, and how to set up a web
server using HTTPD.
Step 1: How to Launch Your EC2 Instance
First things first, let’s launch our EC2 instance. You’ll need an AWS account—signing up is
free, and AWS offers a free tier, so this won’t cost you a dime for small-scale experiments.
Head over to the AWS Management Console and log in. From the search bar, type “EC2” and
click on EC2 Dashboard.
39
Create a new instance by clicking on the orange Launch Instance button.
Next, choose the Amazon Machine Image (AMI) by selecting the Amazon Linux AMI, which
is free-tier eligible and super reliable. Don’t forget to give your instance a unique name!
40
Adding a "Name" tag with a value like "MyFirstInstance" or "ProductionServer" helps you
keep track of multiple instances while adding a personal touch to your cloud workspace.
Also, remember to check the default username for the AMI you select. Since you’ve chosen
Amazon Linux, the default username is ec2-user. Keep this in mind for connecting to your
instance later!
41
Select an Instance Type: The t2.micro is your best buddy here again, free-tier eligible and
perfect for our needs.
42
Key Pair for SSH Access: Here’s where it gets important to have a .pem file to securely
connect to your instance. This file, also known as a key pair, acts like the secret key to your
cloud “hotel room,” allowing you to log in via SSH.
If you already have a .pem file for a previously created key pair, go ahead and choose that
from the dropdown menu.
If you don’t have a .pem file, no worries! Create a new key pair by clicking Create New Key
Pair, and download the .pem file to your computer. Make sure to store this file safely—
you’ll need it to log in, and if you lose it, you won’t be able to access your EC2 instance!
Why is this file important? The .pem file is your private key, and AWS uses it to verify that
you are the rightful owner trying to connect to the instance. You won’t get access without it,
just like how you can’t get into a hotel room without the key.
Configure Security Group: AWS EC2 security groups are like virtual firewalls that control
traffic in and out of your instance, ensuring only specific types of access. To allow web
visitors, set up an HTTP rule on port 80, and for secure server logins, enable SSH on port 22
with restricted IPs.
You can reuse security groups across instances, making configuration easier and more
consistent. Regularly review these settings to keep your instance secure and organized.
43
Launch the instance: Boom! You’ve just launched your very own server in the cloud.
Wait a minute or two for your instance to come online. Now that we have our EC2 instance
running, let’s move to the next step of `setting up our web server.
Step 2: How to Connect to Your EC2 Instance
44
To connect, we’ll use the .pem file (key pair) we created earlier. If you’re on a Mac or Linux
machine, this is super simple with SSH. For Windows folks, I recommend using MobaXterm
—it’s a user-friendly terminal with SSH built-in.
If you’re new to connecting EC2 instances using MobaXterm, I’ve written a detailed guide in
my previous blog post. You can check it out here, where I show how to set up and connect to
an EC2 instance using MobaXterm.
For now, here’s a quick overview of the connection process using SSH:
ssh -i "your-key.pem" ec2-user@your-ec2-public-ip
Replace "your-key.pem" with the name of your key pair and "your-ec2-public-ip" with the
public IP of your instance (you can find this in the EC2 dashboard).
If you’ve connected successfully, congratulations! 🎉 You’re inside your cloud server.
Step 3: How to Install and Start HTTPD (Apache Web Server)
Alright, time to install our web server software (HTTPD)! We’ll be using Apache, one of the
most popular web servers around. Don’t worry, you don’t need a degree in IT to get this
working.
After you successfully connect to your EC2 instance from MobaXterm, you should be all set
to start the installation. You’re just a few commands away from having your web server up
and running!
It’s always good practice to make sure your server is up to date. To update your server, run:
sudo dnf update -y
Next, we’ll install HTTPD (Apache):
sudo dnf install httpd -y
Then start the HTTPD service. Run this command to get the server running.
sudo systemctl start httpd
Next, enable it to start on boot so that every time your EC2 instance reboots, your web server
comes back to life automatically.
sudo systemctl enable httpd
Time to test it out! Open your browser and type in your instance’s public IP. If you see the
Apache test page, give yourself a high-five. You’ve just launched a web server!
Step 4: How to Host Your Custom Web Page
Now, let’s get creative! Instead of the default web server message, let’s host your very own
custom web page in just one step. This will allow you to display a unique message on your
site in no time.
Run the following command in your EC2 instance to create and display a simple,
45
personalized web page:
echo "Welcome to the Cloud! You’re now hosting your own custom web server
using AWS EC2 and Apache!" > /var/www/html/index.html
What does this command do?
The echo command outputs the text: "Welcome to the Cloud! You’re now hosting
your own custom web server using AWS EC2 and Apache!".
The > symbol redirects this output to a file.
/var/www/html/index.html is the path to the file where the message is saved. This file
is the homepage of your web server.
By running this command, you're replacing the default Apache test page with your custom
message.
Now, select your EC2 instance, and you’ll find its public IP address. Open your browser,
enter that IP, refresh the page, and boom! Your custom message is live on the site. 🎉
46
4. Install Google App Engine. Create a hello world app and other simple web
applications using python/java.
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, Cloud from App Engine!'
Create an app.yaml file to configure App Engine:
runtime: python39
entrypoint: gunicorn -b :$PORT main:app
handlers:
- url: /.*
script: auto
47
5. Deploy Your Application:
Install the required dependencies:
pip install Flask gunicorn
Deploy your app to App Engine:
gcloud app deploy
After deployment, access your app using:
gcloud app browse
48