0% found this document useful (0 votes)
219 views

CS 505 - Linux Laboratory Manual - Final - 1659164997

This document describes experiments conducted in a Linux laboratory. It includes instructions on using basic Linux commands like pwd, ls, mkdir, cp and rm. It also covers using commands to perform arithmetic operations in Linux, creating and editing text files, appending lines to files, and using the split command to divide files into parts. The document contains a certificate, index of experiments conducted, and details of 4 experiments - studying basic commands, arithmetic operations, file handling and editing/splitting text files.

Uploaded by

abhishek Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
219 views

CS 505 - Linux Laboratory Manual - Final - 1659164997

This document describes experiments conducted in a Linux laboratory. It includes instructions on using basic Linux commands like pwd, ls, mkdir, cp and rm. It also covers using commands to perform arithmetic operations in Linux, creating and editing text files, appending lines to files, and using the split command to divide files into parts. The document contains a certificate, index of experiments conducted, and details of 4 experiments - studying basic commands, arithmetic operations, file handling and editing/splitting text files.

Uploaded by

abhishek Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE

LABORATORY MANUAL

LINUX LABORATORY
CS 505

V SEM (CSE)

DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE

DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE
This is to certify that Mr./Ms…………………………………………………………………………..………… with RGTU Enrollment

No. 0832 ..…………………………..has satisfactorily completed the course of experiments in Linux laboratory, as

prescribed by Rajiv Gandhi Proudhyogiki Vishwavidhyalaya, Bhopal for V Semester of the Computer Science &

Engineering Department during the year 2022-23.

Signature of
Faculty In-Charge

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

INDEX
Date of Signature of
Expt. No. List of Experiments Conduction Faculty in-
Charge
1 To study the basic as well as user status UNIX/Linux commands
Study and use of commands for performing arithmetic operations
2
with Unix/Linux
Create a file called wlcc.txt with some lines and display how many
3
lines, words and characters are present in that file
Append ten more simple lines to the wlcc.txt file, split the
4 appended file into 3 parts and display the contents of each of
these files
Write a program to display only those names that are found in the
5
given two files, each of which contains name of students

6 Write a command to find the "inode" number of any desired file

7 To study and use the command for changing file permissions


To write a pipeline of commands, which displays on the monitor as
8 well as saves the information about the number of users using the
system at present on a file called user.ux
9 To execute shell commands through Vi editor
Write a shell script that accepts any number of arguments and
10
prints them in the reverse order
Write a shell script to find the smallest of three numbers that are
11
read from the keyboard
Write a shell script that reports the logging in of a specified user
12
within one minute after login
To study install, configure and customize Unix/Linux operating
13
system
14 To study the installation of SAMBA, APACHE TOMCAT server

15 To study the implementation of DNS, LDAP services

16 To study the installation of firewall and proxy server

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 1 To study the basic as well as user status UNIX/Linux commands

Aim: To understand the basic UNIX/Linux commands


Theory:
File Commands:
 pwd command: This command is used to find out the path of the current working directory (folder).
The command will return the full path of all the directories that start with a forward slash (/).
 ls command: This command is used to view the contents of a directory. This command will display the
contents of the current working directory.
The variations of ls command are -
o ls -R will list all the files in the sub-directories
o ls -a will show the hidden files
o ls -al will show the list of files and directories with detailed information like the permissions,
size and owner
 mkdir- This command is used to create a new directory
 cp- This command is used to copy a file [cp source file, destination file]
 mv- This command is used to move a file/directory
 rm- This command is used to remove files from the system without confirmation
 cat- This command is used to concatenate files and show contents to the standard output

Viva Questions:
1. Describe functions of the Linux Operating System.
2. What is the use of the “pwd” command?
3. Describe file and directory in Linux.
4. Explain different variations of "ls" command.
5. Explain the use of the "cat" command.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 2 Study and use of commands for performing arithmetic operations with Unix/Linux

Aim: To understand the commands to perform arithmetic operations


Theory:
The following arithmetic operators are used in UNIX/Linux:
Assume variable a holds value 10 and variable b holds value 20 then –

Operator Description Syntax

+ (Addition) Adds values on either side of the operator `expr $a + $b`

- (Subtraction) Subtracts right-hand operand from left-hand `expr $a - $b`


operand

* (Multiplication) Multiplies values on either side of the operator `expr $a \* $b`

/ (Division) Divides left hand operand by right hand operand `expr $b / $a`

% (Modulus) Divides left-hand operand by right-hand operand `expr $b % $a`


and returns remainder

= (Assignment) Assigns right operand in left operand a = $b

== (Equality) Compares two numbers, if both are the same then [ $a == $b ]


returns true

!= (Not Equality) Compares two numbers, if both are different then [ $a != $b ]


returns true

It is very important to understand that all the conditional expressions should be inside square braces with
spaces around them, for example [ $a == $b ] is correct syntax whereas, [$a==$b] is incorrect syntax.
All the arithmetical calculations are performed using long integers.

Example:
Here is an example that uses all the arithmetic operators –
Procedure:
Step 1: Start with the header file.
Step 2: Initializes the two variables.
Step 3: Perform arithmetic operations and store the resultant value in the third variable.
Step 4: Print the value of third variable.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Viva Questions:
1. Describe the BASH.
2. Explain the functions of Linux Kernel.
3. Explain assignment and equality operator.
4. Explain modulus and division operator.
5. Describe the basic working of an assignment operator.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 3 Create a file called wlcc.txt with some lines and display how many lines, words and characters
are present in that file

Aim: To understand the concept of file handling


Theory:
A file can be created through-
cat > ab.txt <<EOL
Hi
abcd
EOL
Here, ab is the name of the file, user can choose any name. Hi and abcd is the text that presents two lines in
the file.
EOL represents the ending of the document. “wc” command is used to count the number of lines, words and
characters in the text file. The command “wc” basically means “word count” and it is available with different
options to count the number of lines, words and characters in a text file.
 To count the number of lines, use “wc” with “l” option as-
wc -l yourTextFile
 To count the number of words, use “wc” with “w” option as-
wc -w yourTextFile
 To count the total number of characters, use “wc” with “c” option as-
wc -m yourTextFile

Viva Questions:
1. Explain the procedure to display the number of characters of the text file.
2. Explain the working of “wc” command.
3. Describe the various options available with “wc” command.
4. Describe the process to read a text file.
5. Explain the importance of “Vi” Editor.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 4 Append ten more simple lines to the wlcc.txt file, split the appended file into 3 parts and
display the contents of each of these files

Aim: To understand the concept of editing in a text file


Theory:
Append lines to a file:
There are two standard ways of appending lines to the end of a file - by using the “>>” redirection operator or
by using the tee command.
To append multiple lines, echo command can be used. Once it is done, just use the redirection append
operator “>>”:
$ echo "I am cool
> I am super cool
> I am very excited" >> destination.txt
Another way to accomplish this is to use the cat command and include a string that represents the End-of-File
(EOF):
$ cat << EOF >> destination.txt
> I just added some more good stuff
> Hello World
> EOF
Working with Split Command:
 split wlcc.txt
wlcc.txt file is split into two pieces with names ‘xaa’ and ‘xab’. It will have 1000 lines in each of the file
by default. The name of split commands will be ‘xaa’ and ‘xab’.
 Split file size using ‘-b’ option: split -b 16 wlcc.txt index
It will split the file wlcc.txt into separate files called xaa, xab. Each file contains 16 bytes of data in it.
Change in suffix length. By default, the suffix length is 2. It can be changed by using ‘-a’ option.
 split -n 3 wlcc.txt
Create n chunks output files. If a user wants to split a file into three chunk output files, then use the ‘-n’
option with the split command which limits the number of split output files.

Viva Questions:
1. Describe the “split” command.
2. Explain the concept of “chunk”.
3. Explain the procedure to append text in a file.
4. Describe “prefix” and “suffix”.
5. Describe “cat” command.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 5 Write a program to display only those names that are found in the given two files, each of
which contains name of students

Aim: To understand the searching operation in a text file

Theory: In this experiment user will create two files i.e., file1 and file2 which contains the name of the
students. Both the files have to be compared by using Linux command in order to find out the name of the
students which are common in both the files.

Syntax:
$comm [OPTION]... FILE1 FILE2
 Using comm: used for comparing the two files, therefore the syntax of “comm” command needs two
filenames as arguments.

Procedure
 Column one contains lines unique to FILE1
 Column two contains lines unique to FILE2,
 Column three contains lines common to both files.
1. suppress column 1 (lines unique to FILE1)
2. suppress column 2 (lines unique to FILE2)
3. suppress column 3 (lines that appear in both files)
 check-order: check that the input is correctly sorted, even if all the input lines are pairable
 nocheck-order: do not check that the input is correctly sorted
 output-delimiter=STR: separate columns with STR

Example: Let us suppose there are two sorted files file1.txt and file2.txt and now user will use the “comm”
command to compare these two files.

// displaying contents of file1 //


$cat file1.txt
Apaar
Ayush Rajput
Deepak
Hemant

// displaying contents of file2 //


$cat file2.txt
Apaar
Hemant
Lucky
Pranjal Thakral

Now, run comm command as:


// using comm command for
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

comparing two files //


$comm file1.txtfile2.txt

Output:

FILE 1 FILE 2 MATCHED NAME


Ayush Rajput Lucky Apaar

Deepak Pranjal Thakral Hemant

It contains three columns where the first column is separated by zero tab and contains names only present
in file1.txt, the second column contains names only present in file2.txt and separated by one tab and
the third column contains names common to both the files and is separated by two tabs from the beginning
of the line.

Viva Questions:
1. Explain the process to setup directory permissions in Linux.
2. What are the different types of file access permission?
3. Describe the procedure to create user/group in Linux.
4. Describe the various options available with “comm” command.
5. Describe the “grep” command.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 6 Write a command to find the "inode" number of any desired file

Aim: To understand the concept of inode number


Theory: “inode” number is also known as index number and it is a unique number for all the files in Linux.
When a file is created on the system, a file name and "inode" number are assigned to it.
It consists of the following attributes of any file:
 File types (executable, block special)

 Permissions (read, write)


 UID (Owner)
 GID (Group)
 FileSize
 Time stamps including last access, last modification and last inode number change.
 File deletion time
 Number of links (soft/hard)
 Location of the file on the hard disk
 Some other metadata about the file
Commands used to find out file "inode" number are as follows:
1. Stat {file-name}
Example:
arunlal@localhost:~$ stat inode.check

Output:
File: 'inode.check'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 806h/2054d Inode: 1179765 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ arunlal) Gid: ( 1000/ arunlal)
Access: 2016-11-15 20:00:07.548968280 +0530
Modify: 2016-11-15 20:00:07.548968280 +0530
Change: 2016-11-15 20:00:07.548968280 +0530
Birth: -

2. ls -il {file-name}
Example:
arunlal@localhost:~$ touch inode.check
arunlal@localhost:~$ ls -i inode.check

output:
1179765 inode.check
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

3. Commands to check the details of directories


arunlal@localhost:~$ mkdir inode.check.dir
arunlal@localhost:~$ stat inode.check.dir

Output:
File: 'inode.check.dir'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 806h/2054d Inode: 1314947 Links: 2
Access: (0775/drwxrwxr-x) Uid: ( 1000/ arunlal) Gid: ( 1000/ arunlal)
Access: 2016-11-15 20:09:21.734325138 +0530
Modify: 2016-11-15 20:09:21.734325138 +0530
Change: 2016-11-15 20:09:21.734325138 +0530
Birth: -

Viva Questions:
1. Describe the "inode" number.
2. Explain the steps to kill the process.
3. What are the various ways to delete a file from the Linux Operating System?
4. What is the role of IO Block?
5. Describe the “stat” command.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 7 To study and use the command for changing file permissions

Aim: To understand the concept of changing the file permissions with the help of command
Theory:
To change directory permissions in Linux the following commands are used -
 chmod +rwx : add permissions in the file name
 chmod -rwx : remove permission from the directory name
 chmod +x : used for the filename to allow executable permissions
 chmod -wx : used for the filename to take out write and executable permissions.

Note that “r” denotes read, “w” denotes write, and “x” denotes execute.

To change directory permissions for group owners, use the following commands:
 chmod g+w filename
 chmod g-wx filename
 chmod o+w filename
 chmod o-rwx foldername

To change directory permissions for everyone, use “u” for users, “g” for group, “o” for others, and “ugo” or
“a” (for all).
 chmod ugo+rwx foldername :To give access of read, write, and execute permission to everyone
 chmod a=r foldername :To give only read permission for everyone

To change permissions in numeric code in Linux, use numbers instead of “r”, “w”, or “x”:
 0 = No Permission
 1 = Execute
 2 = Write
 4 = Read
For example:
 chmod 777 foldername will give read, write, and execute permissions for everyone.
 chmod 700 foldername will give read, write, and execute permissions for the user only.

Viva Questions:
1. Describe the “chmod” command.
2. Explain the various permission numbers of ‘chmod’ command.
3. Describe the procedure to find memory usage.
4. Describe file permissions.
5. Explain the process to find Linux mount points.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 8 To write a pipeline of commands, which displays on the monitor as well as saves the
information about the number of users using the system at present on a file called user.ux

Aim: To understand the concept of pipelining of commands


Theory: Commands are used to display the information about the user accessing the system along with the
processes, here w is the command used for displaying the logged in and out timing information of the user.
1. “w” Command used to display the information with different options are as follows -

Options Description

w -h This option doesn’t print the header.


This option will ignore the username while figuring out the current process and CPU
w -u
time.
w -s This option uses the short format. It will not print the login time, JCPU or PCPU time.
This option will toggle printing the from (remote hostname) field. The default as
w -f
released is from the field which will not be printed.
w -help This option will display a help message and exit.
w -i This option will display IP address instead of hostname for from field.

w -V This option will display version information.

w -o This option will print blank space for idle times less than one minute.

w user This option will show information about the specified user only.

2. “who” command is used to find out the following information -

a. Time of last system boot


b. Current run level of the system
c. List of logged in users and more
Syntax: who [options] [filename]

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Options Description
The who command displays the following information for each user currently logged in
to the system if no option is provided -
Login name of the users
who
Terminal line numbers
Login time of the users into the system
Remote host name of the user
who -m -H To display host name and user associated with standard input such as keyboard

who -p -H To show all active processes which are spawned by INIT process

who -T -H To show status of the user’s message

who -u To show list of users logged into the system


who -b -H To show time of the system when it was booted last time

who -d -H To show details of all dead processes

Viva Questions:

1. What is the use of command “who”?


2. Explain the significance of using -i attribute with the “w” command.
3. Explain the significance of using -s attribute with the “w” command.
4. Describe “ls” command.
5. Explain the process to show the list of user logins.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 9 To execute shell commands through Vi editor

Aim: To understand the concept of shell commands


Theory: The Vi editor is the most popular and classic text editor in the Linux family. Below, are some reasons
which make it a widely used editor -
 It is available in almost all Linux distributions.
 It works in the same way across different platforms and distributions.
 It is user-friendly.
Vi is the case-sensitive text editor. It supports two types of Mode -
1. Control Mode
2. Insert Mode
1. Control Mode:
 The Vi editor opens in this mode, and it only understands commands.
 In this mode, user can move the cursor and cut, copy and paste the text.
 This mode also saves the changes user has made to the file.
 Commands are case-sensitive.
2. Insert Mode:
 This mode is for inserting text in the file.
 User can switch to the Insert mode from the command mode by pressing ‘i’.
 Once user is in Insert mode, any key would be taken as an input for the file on which user is
currently working.
 To return to the command mode and save the changes and press the Esc key.

Steps to Execute Shell commands through Vi editors:


Step 1: To open the Vi editor and write the file name: vi <filename_NEW>
Syntax: Cdgi@VirtualBox:~$ vi sample
Step 2: Vi editors open in the command mode.

Figure 9.1: Open vi editor in command mode


Step 3: For writing the program, press I to enter the insert mode.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Figure 9.2: Change the mode


Step 4: Add content in the vi file.

Figure 9.3: Add Content in the file


Step 5: Press ESC to enter command mode, then press :wq to save and quit the program.

Figure 9.4: Save and quit Program

Step 6: Check the content of the file.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Syntax: Cdgi@VirtualBox:~$ cat sample


Hello World!
Cdgi@VirtualBox:~$

Vi Editing Commands
Table 9.1: Commands of Vi Editor
Command Description
i Insert text at cursor
ESC Terminate insert mode
o Open a new line
r Replace Character
~ Change case of individual character
cw Change word
dd Delete line
Shift+ZZ Save the file and quit
:w Save the file but keep it open
:q Quit without saving
:wq Save the file and quit

Viva Questions:
1. Explain the process to quit from “Vi” editor without saving a file.
2. Describe the procedure to delete the current line from the “Vi” editor file.
3. Explain the features of “Vi” editor.
4. Describe various modes of “Vi” editor.
5. Explain the significance of shell in Linux.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 10 Write a shell script that accepts any number of arguments and prints them in the reverse
order

Aim: To acquire the knowledge of shell scripting


Theory: An argument, also called command-line argument, can be defined as the input given to a command
line to process it with the help of given command. Arguments can be in the form of a file or directory.
Arguments are entered in the terminal or console after entering a command.

Commands used for argument


Table 10.1 Commands for arguments
Command Description
$* Stores all the arguments that were entered on the #command
line ($1 $2 ...).
$# Stores the number of command-line arguments that were
passed to the shell program.
$@ Stores all the arguments that were entered on the #command
line, individually quoted ("$1""$2" ...).

Procedure:
Step 1: Open the Vi editor and provide a name to the file.
Step 2: Press I to work in insert mode.
Step 3: Initializes the two variables: $d and $rev.
Step 4: Perform the logic to reverse the number (using loop).
Step 5: Store the value in the third variable.
Step 6: Print the value of the third variable.

Viva Questions:
1. Describe shell scripting.
2. What are the different types of shell?
3. Describe the “echo” command.
4. Explain the use of $# command.
5. What is the process to add arguments into the shell script?

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 11 Write a shell script to find the smallest of three numbers that are read from the keyboard

Aim: To acquire the knowledge of taking inputs from the keyboard into the shell script
Theory: Users can store the data with the help of variables. It stores data in the form of characters and
numbers. Similarly, Shell variables are used to store information and it can be used by the shell only.
Example to create a shell variable:
variable ="Hello" // Assign the value Hello to the variable
echo $variable // Print the value of the variable

Procedure:
Step 1: Start with the header file.
Step 2: Initializes the three variables: $a, $b &$c.
Step 3: Perform the logic to evaluate the smallest number among numbers entered by the user.
Step 4: Store the value in the third variable.
Step 5: Print the value of the third variable.

Viva Questions:
1. Explain the procedure to print a greater number among three numbers.
2. Describe the process to print the specific period using shell script.
3. Describe variables in shell scripting.
4. Explain the process to take input from the keyboard.
5. What is the procedure to print the variable value?

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. -12 Write a shell script that reports the logging in of a specified user within one minute after
login

Aim: To acquire the knowledge of a shell script that reports the logging information of a specified user
Theory: In the shell script, various commands are used to provide information about the user.

Table 12.1 Commands for information about the user


Command Description
Id id is a simple command-line utility for displaying real and effective user
and group IDs
Groups groups command is used to show all the groups a user belongs to
Finger finger command is used to search for information about a user on Linux.
Grep grep is a powerful pattern searching tool. It can be used to find the
information about a specific user from the system accounts
file: /etc/passwd.
lslogins lslogins command shows information about known users in the system,
the -u flag only displays user accounts.
Users users command shows the usernames of all users currently logged on the
system
Who who command is used to display users who are logged on the system,
including the connecting terminals

Procedure:
Step 1: Start with the Vi editor.
Step 2: Retrieve the user name using the who command and login time using the date command.
Step 3: Give the command to print the name and logging details.
Step 4: Print the specific period.

Viva Questions:
1. What is the procedure to get the logging details of a user?
2. Describe the various attributes of “grep” command.
3. What is the use of “users” command?
4. Explain the process to retrieve the login time of the user.
5. Explain the use of “lslogins” command.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 13 To study install, configure and customize Unix/Linux operating system

Aim: To understand the process of installation of Unix/Linux operating system


Theory: Installation of Linux Operating System using a USB
Step 1) Download the .ISO or the OS files on computer from https://ubuntu.com/download/desktop link.
Step 2) Download a Universal USB installer to make a bootable USB.
Step 3) Select an Ubuntu Distribution from the dropdown to put on USB.
Select Ubuntu ISO file downloaded in Step 1.
Select the drive letter of USB to install Ubuntu and Press create button.

Figure 13.1: Ubuntu Installation


Step 4) Click YES to Install Ubuntu on USB.

Figure 13.2: Ubuntu Installation in USB

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Viva Questions:
1. What are the basic elements of Linux?
2. Explain the concept of BASH.
3. Explain the use of ISO file.
4. Explain the functions of the Kernel.
5. What is the use of swap space?

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 14 To study the installation of SAMBA, APACHE TOMCAT server

Aim: To acquire knowledge about Samba and Apache Tomcat server


Theory:
A Samba file server enables file sharing across different operating systems over a network. It lets user access
desktop files from a laptop and share files with Windows and Mac OS users.
Samba server can perform the following tasks -
● Serve directory trees and printers to Linux, UNIX and Windows clients.
● Assist in network browsing.
● Authenticate Windows domain login.
● Provide Windows Internet Name Service (WINS) name server resolution.
● Act as a Windows NT-style Primary Domain Controller (PDC)
● Act as a Backup Domain Controller (BDC) for a Samba-based PDC
Installing Samba
To install Samba, user has to run the following commands -
sudo apt update
sudo apt install samba

Connecting to a Samba Server Using Nautilus


1. To view a list of Samba workgroups and domains on network, select Places Network from the GNOME
panel, and then select the desired network. Alternatively, type smb: in the File Open Location bar
of Nautilus.
2. An icon appears for each available SMB workgroup or domain on the network. Double-click one of the
workgroup or domain icons to view a list of computers within that workgroup or domain.
3. An icon exists for each machine within the workgroup. Double-click on an icon to view the Samba
shares on the machine. If a user name and password combination is required, user will be prompted
for the same.
An Apache Tomcat is an open-source web application server that supports J2EE Servlet, Java Server Pages
(JSP) and API.
An Apache Tomcat can be configured by editing the server.xml file.
Servlet is defined as a way that adds dynamic content to a Web server using the Java platform. A servlet
container is a compiled executable program. The servlet container name of Tomcat is known as Catalina.
Steps for installing Apache Tomcat:
Step1: Install Java and JDK
Step2: Download the tomcat source package and uncompress it.
Step3: Setup the paths for Catalina and others.
Step4: Now start the Apache Tomcat server
Step5: By default, Apache Tomcat Server will be hosted on localhost: 8080 port by default.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Viva Questions:
1. Describe the steps to configure the Samba server.
2. What are the advantages of the Samba server?
3. Describe the functions of the Apache Tomcat Server.
4. Explain the use of the port address.
5. Describe the significance of NetBIOS.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 15 To study the implementation of DNS, LDAP services

Aim: To acquire knowledge about the implementation of DNS and LDAP services
Theory:
 DNS stands for Domain Name System.
 DNS is a directory service that provides a mapping between the name of a host on the network and its
numerical address.
 DNS is required for the functioning of the internet.
 Each node in a tree has a domain name, and a full domain name is a sequence of symbols specified by
dots.
 DNS is a service that translates the domain name into IP addresses. This allows the users of networks
to utilize user-friendly names when looking for other hosts instead of remembering the IP addresses.
 For example, suppose the FTP site at EduSoft had an IP address of 132.147.165.50, most people would
reach this site by specifying ftp.EduSoft.com. Therefore, the domain name is more reliable than the IP
address.
DNS is a TCP/IP protocol used on different platforms. The domain name space is divided into three different
sections.
1) Generic Domains
 It defines the registered hosts according to their generic behavior.
 Each node in a tree defines the domain name, which is an index to the DNS database.
 It uses three-character labels and these labels describe the organization type.
2) Country Domain
 The format of the country domain is the same as a generic domain, but it uses two-character country
abbreviations (e.g., us for the United States) in place of three-character organizational abbreviations.
3) Inverse Domain
 The inverse domain is used for mapping an address to a name.
 When the server has received a request from the client and the server contains the files of only
authorized clients.
 To determine whether the client is on the authorized list or not, it sends a query to the DNS server and
asks for mapping an address to the name.
Lightweight Directory Access Protocol (LDAP):
Companies store usernames, passwords, email addresses, printer connections and other static data within
directories.
LDAP is an open, vendor-neutral application protocol for accessing and maintaining that data. LDAP can also
tackle authentication, so users can sign on just once and access many different files on the server.
LDAP is a protocol, so it doesn't specify how directory programs work. Instead, it's a form of language that
allows the users to find the information they need very quickly.
LDAP is vendor-neutral, so it can be used with a variety of different directory programs.
Typically, a directory contains data that is -
 Descriptive: Multiple points, such as name and location, come together to define an asset.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

 Static: The information doesn’t change much, and when it does, the shifts are subtle.
 Valuable: Data stored within the directory is critical to core business functions, and it is touched over
and over again.
An LDAP query typically involves -
 Session connection - The user connects to the server via. an LDAP port.
 Request - The user submits a query, such as an email lookup, to the server.
 Response - The LDAP protocol queries the directory, finds the information and delivers it to the user.
 Completion - The user disconnects from the LDAP port.

Viva Questions:
1. What is the use of DNS?
2. Explain the concept of Resource Records in DNS.
3. Explain conditional forwarding in DNS.
4. Explain the various troubleshooting tools.
5. Describe the significance of the IP address.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

EXPT. No. - 16 To study the installation of firewall and proxy server

Aim: To understand the process of installation of Firewall and Proxy server


Theory:
A firewall is a network security device that monitors incoming and outgoing network traffic and decides
whether to allow or block specific traffic based on a defined set of security rules.
Firewalls have been the first line of defense in network security for over 25 years. They establish a barrier
between secured and controlled internal networks that can be trusted and untrusted outside networks, such
as the Internet.
A firewall can be a hardware, software, or both.
Types of firewalls
1) Proxy firewall
A Proxy firewall serves as the gateway from one network to another for a specific application. Proxy servers
can provide additional functionality such as content caching and security by preventing direct connections
from outside the network.
2) Stateful inspection firewall
A Stateful inspection firewall allows or blocks traffic based on state, port and protocol. It monitors all activities
from the opening of a connection until it is closed. Filtering decisions are made based on both administrator-
defined rules as well as context, which refers to using information from previous connections and packets
belonging to the same connection.
3) Unified threat management (UTM) firewall
A UTM device typically combines, in a loosely coupled way, the functions of a Stateful inspection firewall with
intrusion prevention and antivirus. It may also include additional services and often cloud management. UTMs
focus on simplicity and ease of use.

A proxy server is a computer that acts as an intermediary between a desktop computer and the internet and
allows a client machine to make an indirect connection to network servers and services. There are many
reasons to deploy the proxy server on network -
● To share internet connection on a LAN
● To speed up internet surfing
● To hide the IP address of the client computer for anonymous surfing
● To implement internet access control
● To scan outbound content
● To circumvent regional restrictions
Procedure
Step #1 Install Squid
Step #2: Verify the Squid Installation
Step #3: Start Squid and Configure it to Start on Boot

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
LINUX LABORATORY

Viva Questions:
1. Explain the functions of a Firewall.
2. Explain the use of a VPN.
3. What is the use of port number?
4. Describe the significance of the proxy server.
5. Explain the advantages of installing Squid.

CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

You might also like