Computer Science & Engineering: Department of

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment - 1.2
Student Name:Baddam Deepthi priya UID:21BCS10172
Branch:BE-CSE Section/Group:628-A
Date of Performance:20/01/24 Semester:6th
Subject:CC&DS Lab Subject code:21CSP-378
1. Aim:
To install a C compiler within the virtual machine established using VirtualBox
and run basic programs.
2. Objective: Install a C compiler in OS of virtual machine of Host system and
then run a basic c program.

3. Steps to Install:
Step 1: Set Up a Virtual Machine:
• Download and install VirtualBox on your host machine.
• Create a new virtual machine within VirtualBox.
• Install an operating system on the virtual machine (e.g., Ubuntu, Fedora,
etc.). You can download the ISO image of the OS from their official
websites. For this experiment I installed linux lite.

Step 2: Start the Virtual Machine:


• Start the virtual machine and log in to the operating system.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Step 3: Update the Package Manager:


• Open a terminal on your virtual machine.
• Run the following commands to update the package manager:
sudo apt # For Debian/Ubuntu-based
update systems

Step 4: Install the C Compiler (GCC):

• Run the following command to install the GCC compiler:


sudo apt install build- # For Debian/Ubuntu-based This will
essential systems install the
necessary
tools and libraries for compiling C programs.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Step 5: Write and Compile a Basic C Program:
• Use a text editor to write a simple C program (e.g., use nano, vim, or gedit).
• Save the program with a .c extension, for example, file.c.
• Write a basic printf program:

Step 6: Open a terminal and navigate to the directory where you saved your C
program.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

• Compile the program using the following command: gcc file.c -o file
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Step 7 : Run the compiled program:


DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Learning Outcome:
 Understand how to create Virtual Machines with OS.
 Learned how to use linux terminal.
 Learned how to install various resources in linux.
 Wrote a basic C program on text editor and compiled it on gcc using linux
terminal.
 Executed a basic C program.

You might also like