Professional Documents
Culture Documents
CS8711 CloudComputingLaboratory
CS8711 CloudComputingLaboratory
AIM:
PROCEDURE:
Open the Virtual Machine Software
RESULT:
Thus the virtual machine creation using vmware was installed and executed successfully.
Ex.No.2 INSTALLING AN OPERATING SYSTEM ON VIRTUAL MACHINE
AIM:
To Install an Operating System on Virtual Machine.
PROCEDURE:
RESULT:
Thus the Installation of Operating System on Virtual Machine was completed and verified successfully
Ex.No.3 INSTALLING A C COMPILER IN VIRTUAL BOX
AIM
To install GCC the C compiler on Ubuntu 18.04 Bionic Beaver and execute simple programs.
REQUIREMENTS
Privileged access to your Ubuntu System as root or via sudo command is required.
PROCEDURE:
Install GCC
The following linux command will install gcc compiler on on Ubuntu 18.04 Bionic Beaver. Open up terminal
and enter:
$ sudo apt install gcc
Install build-essential
Another way to install gcc compiler is to install it as part of build-essential package. build-essential package
will also install additional libraries as well as g++ compiler. In most cases or if unsure this is exactly what you
need:
$ sudo apt install build-essential
C Hello World
Open the terminal app and type the following apt command/apt-get command:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install build-essential
OR
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
Sample outputs:
Verify installation
AIM:
To launch a web application using GAE.
PROCEDURE:
This is often the most confusing part of the entire setup. Things you should know when you sign-up:
The next step is to create a new Python project that you can work on. Follow the screenshots below to create a
new project.
Hit the create button and Google should take a few minutes to set up all that is necessary for your newly created
app.
The next step in the process is to fork the app on your local machine. This will allow you to make changes to the app
locally and deploy it whenever you wish to.
store the app locally. Make sure you select the Python 2.7 as your runtime engine.
Hit the create button, and you should see your app listed on the window that follows. You should also check that
you now see some files in your local storage (the directory you chose in the screenshot above) after this step.
executed all the above steps correctly. This can be done by simply running the app locally.
Select the app and hit the run button on the window.
Wait for a few seconds until you can hit the Browse button. Once the Browse button becomes clickable,
click it. This should take you to the browser, and you should see the hello world text appear in your
browser window. Alternatively, you can manually go to the browser and use the port specified to access
the app.
As long as you see the above screen, you are all set.
It is finally time to look at the lines of code which are running this webapp. Open your app folder in the text
editor of your choice. I recommend Sublime text or VS Code. However, feel free to choose the one you prefer.
app.yaml
This file is a basic markup file that stores information (some metadata) about the app. It is important to note
1. application
This is the project ID which you should never change. This is the unique identifier for the app
2. urlscript
This is the homepage for the app. In other words, this file will be rendered in your browser when you
3. launch the app
4. libraries
This is where you can include external libraries to use within the webapp
main.py
This is the homepage of the app (as discussed above). Note that the hello world text in the browser window
No hello world app is ever complete without the developer changing the hello world text to something else
just to make sure that everything happening behind the scenes is working as it should.
Go ahead and change the text in the above screenshot to something else.
Save the changes, go to the browser and refresh the page. You should see the page with the text “MEOW”
displayed.
Finally, it is time to deploy your changes to the cloud to make them globally accessible via a URL. Go to the
App Engine launcher, select the app, and hit the Deploy button.
This will ensure your app gets deployed onto Google Cloud. To check whether or not everything worked just
https://<yourProjectID>.appspot.com/
You should see the exact same window as above, expect now, it is a URL that is globally accessible.
RESULT:
Thus a web application was launched successfully using GAE.
Ex.No.5 GOOGLE APP ENGINE PYTHON HELLO WORLD EXAMPLE USING
ECLIPSE
AIM:
To create a Google App Engine (GAE) Python web project (hello world)using Eclipse.
TOOLS USED :
1. Python 2.7
2. Eclipse 3.7 + PyDev plugin
3. Google App Engine SDK for Python 1.6.4
PROCEDURE:
http://pydev.org/updates
Figure 1 – In Eclipse , menu, “Help –> Install New Software..” and put above URL. Select “PyDev for
After Eclipse is restarted, make sure PyDev’s interpreter is pointed to your “python.exe“.
Figure 2 – Eclipse -> Windows –> Preferences, make sure “Interpreter – Python” is configured properly.
Step:3. Google App Engine SDK Python
Following steps to show you how to create a GAE project via Pydev plugin.
Figure 4.1 – Eclipse menu, File -> New -> Other… , PyDev folder, choose “PyDev Google App Engine
Project“.
Figure 4.2 – Type project name, if the interpreter is not configure yet (in step 2), you can do it now. And select
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Copy
File : app.yaml – GAE need this file to run and deploy your Python project, it’s quite self-explanatory, for
application: mkyong-python
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: helloworld.py
Copy
To run it locally, right click on the helloworld.py, choose “Run As” –> “Run Configuration”, create a new
Figure 5.1 – In Main tab -> Main module, manually type the directory path of “dev_appserver.py“.
application. Review “app.yaml” again, this web app will be deployed to GAE with application ID
“mkyong-python“.
File : app.yaml
application: mkyong-python
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: helloworld.py
Copy
To deploy to GAE, see following steps :
Figure 5.1 – Create another new “PyDev Google App Run”, In Main tab -> Main module, manually type
Figure 5.2 – In Arguments tab -> Program arguments, put “update ${project_loc}/src“.
Figure 5.3 – During deploying process, you need to type your GAE email and password for authentication.
RESULT:
Thus hello world web application was created using Google App Engine.
Ex.No.6
COPY FILES FROM ONE VIRTUAL MACHINE TO ANOTHER
AIM:
PROCEDURE:
VirtualBox
VirtualBox’s Shared Folders feature works with both Windows and Linux guest operating systems. To use
the feature, you first need to install VirtualBox’s Guest Additions in the guest virtual machine.
With the virtual machine running, click the “Devices” menu and choose the “Insert Guest Additions CD
image” option. This inserts a virtual CD that you can use within the guest operating system to install the
Guest Additions.
After the Guest Additions are installed, open the “Machine” menu and click the “Settings” option.
In the “Settings” window, switch to the “Shared Folders” tab. Here you can see any shared folders you’ve
set up. There are two types of shared folders. Machine Folders are permanent folders that are shared until
you remove them. Transient Folders are temporary and are automatically removed when you restart or shut down
Click the “Add” button (the folder with a plus on it) to create a new shared folder.
In the “Add Share” window, you can specify the following:
Folder Path: This is the location of the shared folder on your host operating system (your real PC).
Folder Name: This is how the shared folder will appear inside the guest operating system.
Read-only: By default, the virtual machine has full read-write access to the shared folder. Enable the
“Read-only” checkbox if you want the virtual machine only to be able to read files from the shared
folder, but not modify them.
Auto-mount: This option makes the guest operating system attempt to automatically mount the folder
when it boots.
Make Permanent: This option makes the shared folder a Machine Folder. If you don’t select this
option, it becomes a transient folder that is removed with the virtual machine restarts.
Make all your choices and then hit the “OK” button.
You should now see the shared folders appear as network file shares. If you’re using a Windows guest
operating system, open File Explorer, select “Network”, and then look under the “VBOXSRV” computer.
RESULT:
Thus a procedure to copy files from one virtual ,machine to another virtual machine was executed successfully.
Ex.No.7 CREATE, DEPLOY AND LAUNCH VIRTUAL MACHINES IN
OPENSTACK
AIM:
To Write a procedure to create ,deploy and launch a virtul machine s in open stack.
REQUIREMENTS
PROCEDURE:
1. Before you deploy an OpenStack image, first you need to assure that all pieces are in place and we’ll
2. start by allocating floating IP.
Floating IP allows external access from outside networks or internet to an Openstack virtual machine. In
order to create floating IPs for your project, login with your user credentials and go to Project ->
Compute -> Access & Security -> Floating IPs tab and click on Allocate IP to The Project.
Choose external Pool and hit on Allocate IP button and the IP address should appear in dashboard. It’s a good
3. OpenStack images are just virtual machines already created by third-parties. You can create your own
4. customized images on your machine by installing an Linux OS in a virtual machine using a
5. virtualization tool, such as KVM, VirtualBox, VMware or Hyper-V.
Once you have installed the OS, just convert the file to raw and upload it to your OpenStack cloud infrastructure.
To deploy official images provided by major Linux distributions use the following links to download the
1. CentOS 7 – http://cloud.centos.org/centos/7/images/
2. CentOS 6 – http://cloud.centos.org/centos/6/images/
3. Fedora 23 – https://download.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/
4. Ubuntu – http://cloud-images.ubuntu.com/
5. Debian – http://cdimage.debian.org/cdimage/openstack/current/
6. Windows Server 2012 R2 – https://cloudbase.it/windows-cloud-images/#download
Official images additionally contain the cloud-init package which is responsible with SSH key pair and user
data injection.
On this guide we’ll deploy a test image, for demonstration purposes, based on a lightweight Cirros cloud
To create an image, go OpenStack web panel and navigate to Project -> Compute -> Images and hit on
Create Image button. On the image prompt use the following settings and hit on Create Image when done.
Name: tecmint-test
Description: Cirros test image
Image Source: Image Location #Use Image File if you’ve downloaded the file locally on your hard disk
Image Location: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img
Format: QCOWW2 – QEMU Emulator
Architecture: leave blank
Minimum Disk: leave blank
Minimum RAM: leave blank
Image Location: checked
Public: unchecked
Protected: unchecked
OpenStack Images
3. Once you’ve created an image you’re good to go. Now you can run the virtual machine based on the
4. image created earlier in your cloud environment.
Move to Project -> Instances and hit on Launch Instance button and a new window will appear.
Launch Image Instance in Openstack
5. On the first screen add a name for your instance, leave the Availability Zone to nova, use one instance count
6. and hit on Next button to continue.
Choose a descriptive Instance Name for your instance because this name will be used to form the virtual
machine hostname.
6. Next, select Image as a Boot Source, add the Cirros test image created earlier by hitting the + button
7. and hit
8. Next to proceed further.
Select OpenStack Instance Boot Source
Add Cirros Text Image
7. Allocate the virtual machine resources by adding a flavor best suited for your needs and click on Next to
8. move on.
7. Finally, add one of the OpenStack available networks to your instance using the + button and hit on
8. Launch Instance to start the virtual machine.
Add Network to OpenStack Instance
9. Once the instance has been started, hit on the right arrow from Create Snapshot menu button and
10. choose Associate Floating IP.
Select one of the floating IP created earlier and hit on Associate button in order to make the instance reachable
9. To test the network connectivity for your active virtual machine issue a ping command against the
10. instance floating IP address from a remote computer in your LAN.
11. In case there’s no issue with your instance and the ping command succeeds you can remotely login via
12. SSH on your instance.
Use the instance View Log utility to obtain Cirros default credentials as illustrated on the below screenshots.
Instance View Log Utility
To solve this issue, first stop the instance and go to Project -> Network -> Networks and edit the proper
Add the required DNS name servers, save the configuration, start and connect to the instance console to test
if the new configuration has been applied by pinging a domain name. Use the following screenshots as a guide.
In case you have limited physical resources in your infrastructure and some of your instances refuse to start,
edit the following line from nova configuration file and restart the machine in order to apply changes.
# vi /etc/nova/nova.conf
ram_allocation_ratio=3.0
That’s all! Although this series of guides just scratched the surface of OpenStack mammoth, now you have
the basic knowledge to start create new tenants and use real Linux OS images in order to deploy virtual
Thus the procedure to deploy virtual machined in open stack was successfully executed.
Ex.No.8
CREATE, DEPLOY OPENSTACK CLOUD
AIM:
To write a procedure to create ,deploy open stack cloud.
PROCEDURE:
You can use Fuel to create as many OpenStack clouds, or “environments” as your hardware can handle,
but of course we’ll start with just one. Follow these steps:
1. Make sure that the Fuel Master node can access the internet. To check connectivity, log into the
2. terminal using the username and password you provided when installing Mirantis OpenStack and type:
ping 8.8.8.8
2.If you have problems connecting to the Internet, you’ll need to either correct them or set up a local
repository from which Fuel can pull packages.
3. Open the main Fuel page in your browser. By default, this page will be at http://10.20.0.2:8000;
4. if you’ve changed this when deploying Fuel, you’ll see the new address in the CLI of fuel-master. Log in
5. and go to the main dashboard, as in Figure 1.
8. Next choose any additional projects you want to install, such as Murano or Ironic.
9. Click the Create button to create the environment.
1. The first step is to add some actual nodes to the OpenStack cluster. Click the + Add Nodes button
2. on the Dashboard tab, as in Figure 5.
Figure 5: The Dashboard shows the status of your cluster.
The first step is to add one or more Controller nodes. Mirantis OpenStack automatically deploys
controllers in HA mode, so if you deploy three or more controllers, your OpenStack control plane will be
Highly Available. Click the Controller checkbox and choose one or more servers at the bottom of the page,
as in Figure X. (Keep in mind that your controllers won’t need as much RAM and disk space as your
compute nodes.) Click Apply Changes to save your choices, as in Figure 6:
1. At this point you’ll see your controller(s) in the Nodes tab, as in Figure 7. Click + Add Nodes again to
2. addcomputeresources.
Connectivity Check in the left-hand pane and click Verify Networks, as in Figure 10. If all is well,
you’ll see a message to that effect; if something’s wrong, Fuel will tell you that, as well. Click the
10. Save Changes button at the bottom right of the page to move on.
Figure 10: Make sure your network is configured correctly.
11. Mirantis OpenStack takes care of setting most defaults, so there’s nothing else you need to specify. Go
12. back to the Dashboard tab and click Deploy Changes as in Figure 11, then Deploy.
Now that the environment is deployed, you have an OpenStack cloud to work with. The next step is to
create a tenant/project in which to deploy your resources, and a user to assign to it.
Creating a VM as part of a project enables isolation, control of resources and user access control in a shared
cloud environment. Creating a user of this tenant without full administrative privileges, provides you the
ability to give users self-service capabilities without compromising the entire cluster.
Set up networking
Start by logging out of Horizon as the admin and logging back in as your tenant user.
5. Give the associated subnet a name (we used tenant-subnet), enter its network address in CIDR format (this
is usually 192.168.0.0/24), and enter its normal gateway IP (usually 192.168.0.1).
6. Click Next
Figure 17: Create the subnet
7. Enter the IP address of your local name servers, or use Google’s (8.8.8.8, 8.8.4.4). Ensure that
8. DHCP is checked.Leave other fields blank and clickcreate
Figure 18: define the DNS name servers
To create a router:
In order to log into the VM you’re going to create, you’re going to need an SSH keypair to secure access.
1. Via the left-hand menu, navigate to Project>Compute>Access & Security and click the Key Pairs tab.
2. Click +Create Key Pair, give your keypair a name, and download the private key (.pem) file.
3. Store it securely. Later, we’ll call this file <privatekey_PEM>.
Access to OpenStack VMs is controlled by Security Groups and the Security Group Rules that they contain.
When you create a VM, you specify the group or groups it belongs to, and that determines access.
It can be helpful, during deployment only, to unblock ICMP, TCP and UDP communications in both
directions. We felt secure in doing so, since our test cluster was protected by a strict ingress firewall, is
on our internal network, and is accessed via a VPN. Your mileage may vary.
1. Via the left-hand menu, navigate to Project>Compute>Access & Security, and click the Floating IPs tab
2. Click on (lock symbol) Allocate IP to Project
3. Click on Allocate IP. Note that the floating IP pool for your project is the name of the external
4. network admin_floating_net.
Build the OpenStack VM
Now that we’ve built the infrastructure, we can go ahead and create, populate, and configure the virtual
machine. This VM will be a Ubuntu server on which we’ll install the Apache web server.
In order to create a new VM, we’re going to need a Glance image. To obtain the latest Ubuntu Trusty image and
add it to Glance:
1. Via the left-hand menu, navigate to Project>Compute>Images, and click +Create Image in the upper right
2. Give the image a name (e.g., ubuntu-trusty)
3. Under Image Location, insert the following URL:
http://uec-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
Create the VM
Creating a new virtual machine is also known as “launching a VM”. Basically, we’re going to create a new
1. In Horizon’s left-hand menu, navigate to Project>Compute>Images, find your Ubunty Trusty image,
2. and click Launch Instance
3. Give your VM a name (e.g., gettingStartedBox) and select the m1.medium flavor (a reasonable size
4. for Ubuntu). Copy/retain the name of your VM — we’ll refer to it as <vm_hostname> in
5. following commands and scripts.
6. In the Access & Security tab, select the name of your keypair and ensure that the name of your security
group is checked
7. In the Networks tab, ensure your network is in the blue (selected) area, and drag it there if it is not
8. Click Launch
Earlier we allocated floating IPs to the project; now we need to associate one of them with the VM:
1. In Project>Compute>Instances, find the name of your VM, pull down the Actions menu on the right
2. and select Associate Floating IP
3. Select an allocated floating IP and click Associate
4. Copy/retain that IP address. We’ll be calling it <jumpbox_FIP> below
5. Once the server has started, we can log in and install Apache.
Configuring the VM
1. Make sure that your private key (the one you created as part of the SSH Keypair) has the
2. appropriate permissions by changing to the directory where you saved it and typing:
3. Next, go ahead and log in, referencing the private key, and the floating IP you associated with the VM.
4. You can do this with the command:
5. For example, if the private key was called hellokeypair.pem and the floating IP was 172.16.0.140,
6. the command would be:
7. Once you’re logged in, you can go ahead and install Apache. Start by updating apt-get:
8. At this point you should see a ton of packages downloading. If not, make sure the server has access to
9. the Internet.
10. Install Apache:
At this point you should have a complete working Apache server. To test, open your browser and go to
the IP address you’re using. You should see the Default page, as in Figure 23:
Figure 23: The Apache default page
RESULT:
AIM:
To write a procedure to install a single node Hadoop cluster
PROCEDURE:.
Java
Once installed confirm that you’re running the correct version from command line using ‘java -version’
command, output of which you can confirm in command line like this:
WinRAR
I’ve downloaded and installed WinRAR 64 bit release from http://www.rarlab.com/download.htm that will
Hadoop
The next step was to install a Hadoop distribution. To do so, I’ve decided to download the most recent
release Hadoop 3.0.0-alpha2 (25 Jan, 2017) in a binary form, from the Apache Download
Mirror at http://hadoop.apache.org/releases.html
Once the hadoop-3.0.0-alpha2.tar.gz (250 MB) downloaded, I’ve extracted it by using WinRAR (installed in
In Windows 10 I’ve opened System Properties windows and clicked on Environment Variables button:
hen created a new HADOOP_HOME variable and pointed the path to C:\hadoop-3.0.0-alpha2\bin folder on my
PC:
Next step was to add a Hadoop bin directory path to PATH variable. Clicked on PATH and pressed edit:
edited the mapred-site.xml file adding the following XML Yarn configuration for Mapreduce:
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
Once done, the next step was to add a data node and name node to Hadoop, by editing
c:\hadoop-3.0.0-alpha2\etc\hadoop\hdfs-site.xml file.
configuration>
In above step, I had to make sure that I am pointing to location of my newly created data folder and append the
datanode and namenode as shown in example.
<configuration> <property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value> </property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
folder: C:\PROGRA~1\Java\JDK18~1.0_1
Go to C:\Program Files\Java\jdk1.8.0_111 where my Java JDK is installed and converted a long path to
ran
Once all above steps were completed, I’ve opened browser and navigated to: http://localhost:8088/cluster
WORD COUNT PROGRAM:
Once I ran my code, it executed and started processing the words.txt file that was prior to execution copied to
input folder (which I created earlier together with the output folder for the outcome files).
OUTPUT:
1. abusive 1
2. achiever 1
3. action 1
4. admit 1
5. air 1
6. angry 1
7. approval 1
8. awesome 1
9. bashful 1
10. basket 1
11. black 1
12. bleach 1
13. blood 1
14. blot 1
15. border 1
16. bounce 1
17. broad 1
18. bubble 1
19. changeable 1
20. cloth 1
21. colour 1
22. command 1
23. confess 1
24. cough 1
25. cross 1
26. dark 1
27. decorate 1
28. defeated 1
29. descriptive 1
30. elite 1
31. expect 1
32. flap 1
33. flock 1
34. fold 1
35. friction 1
36. gabby 1
37. hollow 1
38. identify 1
39. inform 1
40. irritating 1
41. jarosciak 5
42. jobless 1
43. jumpy 1
44. kindly 1
45. lackadaisical 1
46. lake 1
47. license 1
48. male 1
49. marble 1
50. mark 1
51. measure 1
52. moor 2
53. mug 1
54. neat 1
55. noisy 1
56. object 1
57. orange 1
58. peck 1
59. pot 1
60. pour 1
61. preach 1
62. pull 1
63. quarrelsome 1
64. radiate 1
65. reach 1
66. rebel 1
67. release 1
68. reply 1
69. request 1
70. right 1
71. scold 1
72. seed 1
73. sheet 1
74. shoes 1
75. smash 1
76. sore 1
77. squash 1
78. stir 1
79. stop 1
80. strengthen 1
81. succinct 1
82. suggest 1
83. tart 1
84. taste 1
85. thumb 1
86. trip 1
87. trite 1
88. understood 1
89. unique 1
90. unkempt 1
91. untidy 1
92. van 1
93. wasteful 1
94. watch 1
95. well-to-do 1
96. wood 1
RESULT:
Thus a procedure to install single node Hadoop cluster was successfully executed.