CC Lab Final
CC Lab Final
NAME :
REGISTER NO :
ROLL NO :
YEAR : IV
SEMESTER : VII
Mission
M1 - To provide good teaching and learning environment with conducive research atmosphere in the field of Computer Science and
Engineering.
M2 - To propagate lifelong learning.
M3 - To impart the right proportion of knowledge, attitudes and ethics in students to enable them take up positions of responsibility
in the society and make significant contributions
Approved by AICTE, Affiliated to Anna University, Chennai.
ISO 9001:2015 Certified Institution, Accredited by NBA (BME, CSE, ECE, EEE, IT & MECH),
Accredited by NAAC
#42, Avadi-Vel Tech Road, Avadi, Chennai- 600062, Tamil Nadu, India.
CERTIFICATE
Certified that this is the bonafide record of work done by the above student in the
191CS72A – CLOUD COMPUTING LABORATORY during the academic year 2022-2023.
Submitted for the University Practical Examination held on ........................... at VEL TECH MULTI TECH
Dr.RANGARAJAN Dr.SAKUNTHALA ENGINEERING COLLEGE, No.42, AVADI – VEL TECHROAD, AVADI,
CHENNAI- 600062.
Signature of Examiners
Date:………………
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
An ability to identify, formulate and solve hardware and software problems using
PSO3
sound computer engineering principles.
\
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Ability to identify, formulate and analyze complex Computer Science and Engineering problems in the
PO2 areas of hardware, software, theoretical Computer Science and applications to reach significant
conclusions by applying Mathematics, Natural sciences, Computer Science and Engineering principles.
Design solutions for complex computer science and engineering problems and design systems,
PO3 components or processes that meet specified needs with appropriate consideration for public health and
safety, cultural, societal, and environmental considerations.
Ability to use research based knowledge and research methods to perform literature survey, design
experiments for complex problems in designing, developing and maintaining a computing system,
PO4
collect data from the experimental outcome, analyze and interpret valid/interesting patterns and
conclusions from the data points.
Ability to create, select and apply state of the art tools and techniques in designing, developing and
PO5
testing a computing system or its component.
Apply reasoning informed by contextual knowledge to assess societal, health, safety, legal and cultural
issues and the consequent responsibilities relevant to professional engineering practice in system
PO6
development and solutions to complex engineering problems related to system fundamentals, software
development, networking & communication, and information assurance & security.
Understand and evaluate the sustainability and impact of professional engineering work in the solution
PO7 of complex engineering problems related to system fundamentals, software development, networking &
communication, and information assurance & security in societal and environmental contexts.
Apply ethical principles and commit to professional ethics and responsibilities and norms of computer
PO8
science and engineering practice.
Ability to function as an individual and as a team player or leader in multidisciplinary teams and strive
PO9
towards achieving a common goal.
Communicate effectively on complex engineering activities with the engineering community and with
PO10 society at large, such as being able to comprehend and write effective reports and design documentation,
make effective presentations, and give and receive clear instructions.
Recognize the need for, and have the preparation and ability to engage in independent and lifelong
PO12
learning in the broadest context of technological change.
COURSE OBJECTIVES
COURSE OBJECTIVES
COURSE OUTCOMES
COURSE OUTCOMES
On completion of the course, students will be able to
CO1 Install various virtualization tools such as Virtual Box, VMware workstation.
CO4 Develop a generic cloud environment which can be used as a private cloud
PO
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
8
CO
2 1 1 1 1 - - - - - - - 2 2 2
1
CO
2 1 1 1 1 - - - - - - 1 - 2 -
2
CO
2 1 1 1 1 1 - - 1 - - 1 2 - 2
3
CO
3 2 2 1 1 1 -- - - - - - 2 2 2
4
CO
2 1 1 1 1 1 1 - - - - - 2 2 1
5
CO 3 1 1 1 1 1 1 - 1 - - 1 2 2 2
FACULTY
S.NO DATE LIST OF EXPERIMENTS PAGE SIGN
NO
AIM:
To find procedure to run the virtual machine of different configuration and check
how many virtual machines can be utilized at particular time.
PROCEDURE:
Installing Ubuntu using Oracle Virtual Box
Step1:
Open Oracle virtual box manager and click create new -> virtual machine.
Step 2:
Provide a name for the virtual machine and select the hard disk size for the virtual machine.
Select the storage size as dynamically allocated memory size and click OK.
Step 3:
Select the iso file of the virtual OS Ubuntu and click Start.
Step 4:
The virtual OS Ubuntu is opened successfully.
Step 5:
After installation the system will be restarted to complete the installation.
Step 6:
Provide a user name and password(optional) to gain access over the OS.
Step 7:
Set the time and date for the new Operating System.
Step 8:
Thus the new Operating System Ubuntu will be opened as the virtual machine.
Step1:
Open Oracle virtual box manager and click create new -> virtual machine. Provide and name for
the operating system and select the memory size to be occupied in memory.
Step 2:
Select the iso file of the virtual OS Windows7 and click Start.
Step 3:
Select the language to use in the Operating System and click Install Now.
Step 4:
Select the type of installation as Custom for new installation and allocate Disk
Step 5:
After installation the system will be restarted to complete the installation.
Step 6:
Provide a user name and password(optional) to gain access over the OS.
Step 7:
Set the time and date for the new Operating System.
Step 8:
Thus the new Operating System Windows7 will be opened as the virtual machine.
RESULT:
Thus the procedure to run different virtual machines on a single system using
Oracle Virtual Box is studied and implemented successfully.
Ex.No.2 INSTALL A C COMPILER IN THE VIRTUAL MACHINE AND EXECUTE SIMPLE PROGRAMS
Date:
AIM:
To install a C compiler in the virtual machine and execute a sample program.
PROCEDURE:
1. Before install a C compiler in a virtual machine, we have Create a virtual machine by
opening the Kernal Virtual Machine (KVM). Open the installed virtual manager by using the
command “sudo virt-manager”. As well as install different Ubuntu and Windows OS in that
virtual machine with different names.
3. Open TextEditor in Ubuntu OS and type a C program and save it in desktop to execute.
4. To install the C compiler in Ubuntu OS, open the terminal and type the command.
$sudo apt-get install gcc
7. Download the Turbo C++ software from a Web site As well as install the application in our
system.
8. Open installed Turbo C++ and write a simple C program to run it.
9. Open installed Turbo C++ and write a simple C program to run it.
RESULT:
Thus, C compiler is installed in the virtual machine and executed the program
Ex.No.3 INSTALL GOOGLE APP ENGINE. CREATE HELLO WORLD APP.
Date:
AIM:
To Install Google App Engine. Create hello world app and other simple web applications
using python/java.
PROCEDURE:
https://console.cloud.google.com/appengine/start?walkthrough_tutorial_id=java_gae_quickstart
This tutorial shows you how to deploy a sample Java application to App Engine using the App
Engine Maven plugin.
Here are the steps you will be taking.
Create a project
Projects bundle code, VMs, and other resources together for easier development and
monitoring.
Build and run your "Hello, world!" app
You will learn how to run your app using Cloud Shell, right in your browser. At the
end, you'll deploy your app to the web using the App Engine Maven plugin.
GCP (Google Cloud Platform) organizes resources into projects, which collect all of the related
resources for a single application in one place.
Begin by creating a new project or selecting an existing project for this tutorial.
STEP 1:
Select a project, or create a new one
RESULT:
Thus, the Installation of Google App Engine. Create hello world app and other simple
web applications using python/java is installed and created successfully
Ex.No.4 USE GAE LAUNCHER TO LAUNCH THE WEB APPLICATIONS
Date:
AIM:
To Use GAE launcher to launch the web applications
Procedure:
https://cloud.google.com/appengine/docs/standard/python/getting-started/hosting-a-
static-website
You can use Google App Engine to host a static website. Static web pages can contain
client-side technologies such as HTML, CSS, and JavaScript. Hosting your static site on
App Engine can cost less than using a traditional hosting provider, as App Engine provides a
free tier. Sites hosted on App Engine are hosted on the REGION_ID (#appengine-
urls).r.appspot.com subdomain, such as [my-project-id].uc.r.appspot.com. After you deploy your
site, you can map your own domain name to your App Engine-hosted website.
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: www/index.html
upload: www/index.html
- url: /(.*)
static_files: www/\1
upload: www/(.*)
Optional flags:
Include the --project flag to specify an alternate Cloud Console project ID to what
you initialized as the default in the gcloud tool. Example: --project
[YOUR_PROJECT_ID]
Include the -v flag to specify a version ID, otherwise one is generated for you.
Example: -v [YOUR_VERSION_ID]
l>
<head> <title>Hello, world!</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body> <h1>Hello, world!</h1>
<p> This is a simple static HTML file that will be served from Google App Engine. </p>
</body> </html>
Optional flags:
Include the --project flag to specify an alternate Cloud Console project ID to what
you initialized as the default in the gcloud tool. Example: --project
[YOUR_PROJECT_ID]
Include the -v flag to specify a version ID, otherwise one is generated for you.
Example: -v [YOUR_VERSION_ID
RESULT:
Thus, the GAE launcher to launch the web applications is launched successfully.
Ex.No.5 SIMULATE A CLOUD SCENARIO USING CLOUDSIM AND
RUN A SCHEDULING ALGORITHM THAT IS NOT PRESENT IN CLOUDSIM
Date:
AIM:
Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is not
present in CloudSim.
PROCEDURE:
What is Cloudsim?
CloudSim is a simulation toolkit that supports the modelling and simulation of the core
functionality of cloud, like job/task queue, processing of events, creation of cloud entities
(datacentre, datacentre 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
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
public class FCFS {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
private static int reqTasks = 5;
private static int reqVms = 2;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting FCFS...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("FCFS finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
return broker;
RESULT:
Thus, the Simulate a cloud scenario using CloudSim and run a scheduling algorithm that
is not present in CloudSim run successfully.
Ex.No.6 CREATION OF VIRTUAL MACHINES
Date:
AIM:
To transfer the files from one virtual machine to another virtual machine.
PROCEDURE:
1. Select the VM and click File->Export Appliance
4. Click “Export”
5. The Virtual machine is being exported.
7. Go to File->Computer:/home/sam/Documents/
8. Type the neighbour's URL: sftp://[email protected]._/
16. VM is imported.
RESULT:
Thus, Virtual machine migration has been implemented.
Ex.No.7 FIND A PROCEDURE TO LAUNCH VIRTUAL MACHINE USING TRYSTACK
Date:
AIM:
To launch virtual machine using trystack.
PROCEDURE:
https://cyberpersons.com/2017/06/22/how-to-install-openstack-and-create-your-first-virtual-
machineinstance/
OpenStack is basically a cloud operating system. That let you deploy public and private clouds
and take care of all the things for you. In this article, we will see that how to install OpenStack
and create your first virtual machine or in other words launch your first instance.
We will perform our installation on Ubuntu 16.04 Server flavor because as mentioned on
OpenStack site, they have done extensive testing with this flavor and this operating system is
best suited for OpenStack
4 GB Of Ram.
4 CPU Units.
30 GB Disk Space.
Once you have a virtual machine installed with mentioned version of Ubuntu, you are ready to
install OpenStack and take it for a spin.
These commands will just bring all your packages to the latest version and install git so that we
can clone OpenStack to our Linux machine.
This will give the stack user sudo privileges. We now have to log in as user “stack” to
proceed with our installation, that can be done using the command:
sudo su – stack
Now you are logged in as user “stack”, let’s start with the installation of OpenStack by
downloading the required material.
local.conf
[[local|localrc]] ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
Save and exit the file, this will automate the installation process. We are now ready to runthe
installation script. Installation script can be launched using the command:
./stack.sh
Depending on your hardware and internet connection installation can take from 10-20 minutes,
once installation is complete you will have something like this on your console (atthe end of the
installation):
After you are logged into the OpenStack Dashboard it will look something like this:
Before we launch our first virtual machine, we need to create a network that virtual machinecan
use. For now, it will just be a dummy network, because our main purpose in this article is to
launch our first virtual machine or instance. Let see how we can create a network inside
OpenStack.
Now everything is optional in this window if you are interested in filling something up, you
can. Otherwise, leave everything as it is and click “Create”. You now have a network that
you can use to launch a virtual machine.
Step 4: Create Virtual Machine/Instance
After the network is created, we are now ready to create our very first virtual machine.
1. Click on “Project” drop down.
2. Inside project click “Compute” drop down.
3. Under compute you have four options, since we are interested in creating an
instance, you have to click on “Instance”.
Finally, click “Launch Instance”
Now, there are 11 tabs to create an instance, we will go through each tab one by one.
Details Tab
This is a general information tab for creating an instance, you will have to assign a name to
your virtual machine on this tab. Select zone to launch a virtual machine, and tell how many
copies of virtual machine you want. Just make sure your settings look like this:
Source Tab
Normally when we create a virtual machine on Proxmox or VMWare we need to insert CD-
ROM (virtual CD room), that VPS uses to install the operating system.
In OpenStack this is done by Source Tab, you can use various ways to launch a new virtual
machine, OpenStack allows you to choose following as a source to create your instance.
Image
Snapshot of already created instance
Volume or a volume Snapshot
1. Click on the icon where the first arrow is pointing, so that we can use “Cirros” to
launch our virtual machine.
2. After the image is selected, just click “Next” so that we can move to “Flavor” tab.
Flavor Tab
Flavor tab will allow you to allocate resource to your instance. Like:
Ram.
CPU.
Disk Space.
It is similar to giving virtual resources to the virtual machine, but OpenStack gives fancynames
to everything. 🙂
You can see that there are 11 available pre-configured templates to choose from. The one I
choose gave following resources to the instance:
1 virtual CPU
512 MB Ram
1 GB Disk.
You can choose any template from the available 11, depending upon the resources
available on your host machine (On which OpenStack is installed).
Key-Pair Tab
Leave defaults and click Next.
Configuration Tab
Leave defaults and click Next.
Server Groups Tab
Leave defaults and click Next.
Launch Instance
After going through all the tabs, you are now ready to press that magic “Launch Instance”
button, you must be wondering that for some tabs we’ve left them with default settings. Its
fine for now, because we are just launching our test machine at this time. Later we will go
into depth of each tab and see why it is important and why it is not.
Once you click “Launch Instance” button, OpenStack will start creating our virtual machine,
and it is going to look something like this:
Click on “Console” and OpenStack will take you to the console of the virtual machine. The
console will look something like this
This is simple command line, you can use following details to log in:Username:
cirros
Password: cubswin:)
RESULT:
Thus, successfully created your first virtual machine/instance on OpenStack.
Ex.No.8 INSTALL HADOOP SINGLE NODE CLUSTER AND RUN
SIMPLE APPLICATIONS LIKE WORDCOUNT.
Date:
AIM:
To Install Hadoop single node cluster and run simple applications like word count.
PROCEDURE:
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
hduser@sysc40:~$ cd hadoop-2.6.5
hduser@sysc40:~/hadoop-2.6.5$ su sam
Password: sam123
hduser@sysc40:~$ cp /usr/local/hadoop/etc/hadoop/mapred-site.xml.template
/usr/local/hadoop/etc/hadoop/mapred-site.xml
hduser@sysc40:~$ nano /usr/local/hadoop/etc/hadoop/mapred-site.xml
Add the below line inside the <configuration></configuration> tag.
<configuration> <property>
<name>mapred.job.tracker</name>
<value>localhost:54311</value>
<description>The host and port that the MapReduce job tracker runs
at. If "local", then jobs are run in-process as a single map
and reduce task.
</description>
</property>
</configuration>
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>Default block replication.
The actual number of replications can be specified when the file is created.
The default is used if replication is not specified in create time.
</description>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop_store/hdfs/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop_store/hdfs/datanode</value>
</property>
</configuration>
hduser@sysc40:~$ hadoop namenode -format
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
16/11/10 13:07:15 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = laptop/127.0.1.1
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.6.5
...
...
...
16/11/10 13:07:23 INFO util.ExitUtil: Exiting with status 0
16/11/10 13:07:23 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at laptop/127.0.1.1
************************************************************/
Starting Hadoop
Now it's time to start the newly installed single node cluster.
We can use start-all.sh or (start-dfs.sh and start-yarn.sh)
hduser@sysc40:~$ su sam
Password: sam123
sam@sysc40:/home/hduser$ cd
sam@sysc40:~$ cd /usr/local/hadoop/sbin
sam@sysc40:/usr/local/hadoop/sbin$ ls
distribute-exclude.sh start-all.cmd stop-balancer.sh
hadoop-daemon.sh start-all.sh stop-dfs.cmd
hadoop-daemons.sh start-balancer.sh stop-dfs.sh
hdfs-config.cmd start-dfs.cmd stop-secure-dns.sh
hdfs-config.sh start-dfs.sh stop-yarn.cmd
httpfs.sh start-secure-dns.sh stop-yarn.sh
kms.sh start-yarn.cmd yarn-daemon.sh
mr-jobhistory-daemon.sh start-yarn.sh yarn-daemons.sh
refresh-namenodes.sh stop-all.cmd
slaves.sh stop-all.sh
hduser@sysc40:/usr/local/hadoop/sbin$ start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn-hduser-resourcemanager-
laptop.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-hduser-nodemanager-
laptop.out
hduser@sysc70:/usr/local/hadoop/sbin$ jps
14306 DataNode14660 ResourceManager
14505 SecondaryNameNode
14205 NameNode
14765 NodeManager
15166 Jps
hduser@laptop:/usr/local/hadoop/sbin$ stop-dfs.sh
Stopping namenodes on [localhost]
localhost: stopping namenode
localhost: stopping datanode
Stopping secondary namenodes [0.0.0.0]
0.0.0.0: stopping secondarynamenode
stop-yarn.sh
The default port number to access all the applications of cluster is 8088. Use the following url to
visit Resource Manager: http://localhost:8088/
We need to click the Nodes option in the left Cluster panel, then it will sho the node that we
have created.
Step 0:
We need to check whether the hadoop dashboard has been created with all the six nodes.
sam@sysc65:~$ su hduser
Password:
hduser@sysc65:/home/sam$ cd /usr/local/hadoop/sbin
hduser@sysc65:/usr/local/hadoop/sbin$ start-all.sh
hduser@sysc65:/usr/local/hadoop/sbin$ jps
3797 NameNode
4279 ResourceManager
4120 SecondaryNameNode
3916 DataNode
4396 NodeManager
5486 Jps
hduser@sysc65:/usr/local/hadoop/sbin$
Type this command in Browser “localhost:50070”
We should get the dashboard for hadoop environment.
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
public class WordCount {
public static void main(String [] args) throws Exception
{
Configuration c=new Configuration();
String[] files=new GenericOptionsParser(c,args).getRemainingArgs();
Path input=new Path(files[0]);
Path output=new Path(files[1]);
Job j=new Job(c,"wordcount");
j.setJarByClass(WordCount.class);
j.setMapperClass(MapForWordCount.class);
j.setReducerClass(ReduceForWordCount.class);
j.setOutputKeyClass(Text.class);
j.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(j, input);
FileOutputFormat.setOutputPath(j, output);
System.exit(j.waitForCompletion(true)?0:1);
}
Step 6: Copy and paste the above classpath to compile the java program and make it as jar file.
hduser@sysc65:~$ javac -cp
"/usr/local/hadoop/etc/hadoop:/usr/local/hadoop/share/hadoop/common/lib/*:/usr/local/h
adoop/share/hadoop/common/*:/usr/local/hadoop/share/hadoop/hdfs:/usr/local/hadoop/s
hare/hadoop/hdfs/lib/*:/usr/local/hadoop/share/hadoop/hdfs/*:/usr/local/hadoop/share/ha
doop/yarn/lib/*:/usr/local/hadoop/share/hadoop/yarn/*:/usr/local/hadoop/share/hadoop/m
apreduce/lib/*:/usr/local/hadoop/share/hadoop/mapreduce/*:/contrib/capacity-
scheduler/*.jar" WordCount.java
Note: WordCount.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Step 11:
hduser@sysc65:~$ /usr/local/hadoop/bin/hadoop fs -put /home/hduser/wc.txt
/home/hduser/wc.txt
17/08/23 13:11:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicable
Step 12:
hduser@sysc65:~$ /usr/local/hadoop/bin/hadoop jar /home/hduser/MyJar.jar WordCount
/home/hduser/wc.txt /home/hduser/MRDir1
17/08/23 13:15:16 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicable
17/08/23 13:15:17 INFO Configuration.deprecation: session.id is deprecated. Instead, use
dfs.metrics.session-id
Map-Reduce Framework
Map input records=1
Map output records=69
Map output bytes=598
Map output materialized bytes=742
Merged Map outputs=1
GC time elapsed (ms)=77
CPU time spent (ms)=0
Physical memory (bytes) snapshot=0
Virtual memory (bytes) snapshot=0
Total committed heap usage (bytes)=446169088
Shuffle Errors
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
File Input Format Counters
Bytes Read=322
File Output Format Counters
Bytes Written=23
Step 14:
hduser@sysc65:~$ /usr/local/hadoop/bin/hadoop fs -cat /home/hduser/MRDir1/part-r-
00000
17/08/23 13:15:59 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicable
BUS 24
CAR 22
TRAIN 23
RESULT:
Thus, Hadoop single node cluster has been installed and word count application is
executed and verified successfully.
.
Ex.No.9 INSTALLING C/GCC COMPILER FOR WINDOWS
Date:
AIM:
To install C/GCC compiler in windows.
PROCEDURE:
Following are the steps to download and install the MinGW GCC Compiler for windows.
After double-clicking on the setup file, MinGW Installation Manager Setup Tool will now open. It
will show the information like version, name, etc. Click on the Install button and proceed to start
the installation.
Step 4: Specify Installation Preferences.
Now the installation manager will ask you to specify the installation preferences. For that, you
will be asked to choose the installation directory. If you wish to change it, you can browse the
explorer and specify the location as per your requirement. After that, click on continue to
proceed further.
1. MinGW32-base Package.
First, you have to install the MinGW32-base package. This package is used to compile the C
program, including linker and other binary tools. Right-click on the MinGW32-base option and
select Mark for Installation.
2. MinGW32-gcc-g++ Package.
Now you have to install the MinGW32-gcc-g++ package. This package is used to compile C++
source code. This is an optional component of the MinGW Compiler. It is only required if you
are going to program in C++ language only. To select the MinGW32-gcc-g++ right-click on it
and select Mark for Installation.
3. MinGW32-gcc-objc package.
At last, you have to install the MinGW32-gcc-objc package. This package is used to
compile objective C language. It is an optional component. It is only required if you
are going to program in objective C. To select the MinGW32- gcc-objc package, right-
click on it and select Mark for Installation.
Step 7: Apply the Changes
After selecting all the required packages, go to Installation>>Apply Changes and click on Apply
Changes
To set up the path for the C compiler for windows, follows the below steps :
Step 1: Copy the path of the MinGW bin.
When you install the MinGW, it creates a folder named MinGW in C: Drive. To set the compiler's
path, we need the path to the bin directory of MinGW. So, first,
Go to C:>MinGW>bin.
Now, inside the bin folder, click on the address bar and copy the address.
We require this address to be set as the path in the environment variable.
If your install location was somewhere else, you may go to that location where you have
installed MinGW.
A Simple Example
Start off with the following three files, hellomake.c, hellofunc.c, and hellomake.h, which would
represent a typical main program, some functional code in a separate file, and an include file,
respectively.
Normally, you would compile this collection of code by executing the following command: gcc -o
hellomake hellomake.c hellofunc.c -I.
This compiles the two .c files and names the executable hellomake. The -I. is included so that
gcc will look in the current directory (.) for the include file hellomake.h. Without a makefile, the
typical approach to the test/modify/debug cycle is to use the up arrow in a terminal to go back to
your last compile command so you don't have to type it each time, especially once you've added
a few more .c files to the mix
The simplest makefile you could create would look something like:
Makefile 1
hellomake: hellomake.c hellofunc.c
gcc -o hellomake hellomake.c hellofunc.c -I.
If you put this rule into a file called Makefile or makefile and then type make on the command
line it will execute the compile command as you have written it in the makefile. Note that make
with no arguments executes the first rule in the file. Furthermore, by putting the list of files on
which the command depends on the first line after the :, make knows that the rule hellomake
needs to be executed if any of those files change. Immediately, you have solved One very
important thing to note is that there is a tab before the gcc command in the makefile. There
must be a tab at the beginning of any command, and make will not be happy if it's not there.
So now we've defined some constants CC and CFLAGS. It turns out these are special
constants that communicate to make how we want to compile the files hellomake.c and
hellofunc.c. In particular, the macro CC is the C compiler to use, and CFLAGS is the list of flags
to pass to the compilation command. By putting the object files--
hellomake.o and hellofunc.o--in the dependency list and in the rule, make knows it must first
compile the .c versions individually, and then build the executable hellomake.
Using this form of makefile is sufficient for most small scale projects. However, there is one
thing missing: dependency on the include files. If you were to make a change to hellomake.h,
for example, make would not recompile the .c files, even though they needed to be. In order to
fix this, we need to tell make that all .c files depend on certain .h files. We can do this by writing
a simple rule and adding it to the makefile.
As a final simplification, let's use the special macros $@ and $^, which are the left and right
sides of the :, respectively, to make the overall compilation rule more general. In the example
below, all of the include files should be listed as part of the macro DEPS, and all of the object
files should be listed as part of the macro OBJ.
RESULT:
Thus, The installation of C/GCC compiler in Windows has been done and verified
successfully.
Ex.No.10 VERSION CONTROL SYSTEMS COMMANDS
Date:
AIM:
To use version control systems command to clone, commit, push, fetch,pull, checkout,
reset, and delete repositories.
PROCEDURE:
Clone Command
The git clone is a command-line utility which is used to make a local copy of a remote
repository. It accesses the repository through a remote URL.
Usually, the original repository is located on a remote server, often from a Git service like
GitHub, Bitbucket, or GitLab. The remote repository URL is referred to the origin.
Suppose, you want to clone a repository from GitHub, or have an existing repository owned by
any other user you would like to contribute. Steps to clone a repository are as follows:
Step 1:
Step 2:
Under the repository name, click on Clone or download.
Step 3:
Select the Clone with HTTPs section and copy the clone URL for the repository. For the
empty repository, you can copy the repository page URL from your browser and skip to next
step.
Step 4:
Open Git Bash and change the current working directory to your desired location where you
want to create the local copy of the repository.
Step 5:
Use the git clone command with repository URL to make a copy of the remote repository. See
the below command:
$ git clone https://github.com/ImDwivedi1/Git-Example.git
Commit
The above command will prompt a default editor and ask for a commit message. We have
made a change to newfile1.txt and want it to commit it. It can be done as follows:
As we run the command, it will prompt a default text editor and ask for a commit message. The
text editor will look like as follows:
Press the Esc key and after that 'I' for insert mode. Type a commit message whatever you want.
Press Esc after that ':wq' to save and exit from the editor. Hence, we have successfully made a
commit.
git push
The command git push is used to transfer the commits or pushing the content from the local
repository to the remote repository.
The command is used after a local repository has been modified, and the modifications are to
be shared with the remote team members.
Pull
The git pull command is used to fetch and merge changes from the remote repository to the
local repository.
The command "git pull origin master" copies all the files from the master branch of the
remote repository to the local repository.
Checkout
The git checkout command is used to switch branches, whenever the work is to be started on
a different branch.
The command works on three separate entities: files, commits, and branches.
# Checkout an existing branch
Reset –hard
We use this command to return the entire working tree to the last committed state.
Delete command
git branch -d local_branch_name
RESULT:
Thus, The version control systems command to clone, commit, push, fetch, pull,
checkout, reset, and delete repositories have been executed and verified successfully.