Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Karthik K Na Lab 2

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

GOVERNMENT POLYTECHNIC

COLLEGE
ATTINGAL

…………………………………………

LABORATORY RECORD
Certified that this is the bonafide record of experiment done
by Miss/Mr...................................of...........................Year/Semester
(RollNo.........................of....................................................Branch)
in the.........................................during the year........................

Name of Subject......................................................

Reg No................................................................

Internal Examiner Lecturer in charge

External Examiner Head of Section


INDEX
SI.NO NAME OF PRACTICAL DATE PAGE INITIAL OF
NO. TEACHER

1 INSTALLATION AND CONFIGURATION OF LINUX


SERVER OPERATING SYSTEM

2 FAMILIARISATION OF FILE STRUCTURE IN LINUX


SERVER

3 AUTHENTICATION AND AUTHORISATION IN


LINUX SERVER

4 HARD DISK PARTIONING F DISK

5 HARD DISK PARTIONING G DISK

6 HARD DISK PARTIONING PART D

7 CREATE SWAP PARTIONING USING G DISK

8 NETWORK CONFIGURATION IN LINUX SERVER

9 INSTALLATION OF SSH IN LINUX SERVER

10 BACK UP AND RESTORE


EXPERIMENT NO: 1
DATE: 01\01\2024

INSTALLATION AND CONFIGURATION OF


LINUX
SERVER OPERATING SYSTEM.

Aim: To familiarize the installation and configuration of Linux server operating


system.
Theory: Install VirtualBox, create a Virtual Machine and install and configure of
LINUX server Operating system (UBUNTU).
PROCEDURE:
1)Download and install VirtualBox.
2)Start VirtualBox and select new to create a virtual machine.
3)The below screen will appear, enter name of the virtual machine, directory where
the os will be installed and select appropriate bootable ISO file
and click next to continue.

4) Allocate memory.
Depends on how much memory is in host computer. And do not allocate more
than half of the memory.
Here allocate 2GB memory and click next.

5)Setup the hard disk


allocate the requires disk size (20GB) and press next.

6) Check summary

Summary includes the important information that added to create a virtual machine.
Check the summary and press finish to create Virtual Machine.
7) Select the virtual machine an open the setting screen. Then complete the
following.
 Select system option ad allocate number of processors. Select storage option
and Ubuntu server version ISO file to empty SATA controller (if it was not
selected while creating virtual machine).
 Press OK.
8) Start the virtual machine using start option in virtual box.
If all data and the version link are correct the mission and installation will start.
9) Choose the language in first screen. Once the system starts. System will be
presented with this screen. Choose the preferred language and click Enter.

10) Next screen is for keyboard configuration. Select keyboard configuration as


English US and press Done.
11)Next screen allows to configure Network connection. In this screen we can select
the network adapter and enter a new IP address if your system is in a Network with a
DHCP server.
As weare not manually configuring the network parameters, so we keep the default and
click done.
12) Configure Proxy.
Next screen will present to enter a proxy address. It will keep default or
configure proxy and click Done.
13) Configure ubuntu archive Mirror.
Leave the default network mirror or choose a preferred mirror.
Press Done.
14) Storage configuration.
Select custom storage layout and click Done.
15) This screen will present Hard disk partition. Select Add GPT partition in
available.
a) First create root partition.

Select size(5G), format (ext4) and mount (\) and click create.

b) Second create swap partition.

Select size(4G), format(swap) and click create.

c)Next create home partition.


Select size(8g), format(ext4) and mount(\home). And click create.
d)This screen presents file system summery. Verify it and click

Done.
16) confirm distractive action.
The next screen will display the warning message and ask us to confirm
whether the disk can be formatted or not. Select continue, and next screen will
appear.
17) Profile setup.
Enter username, server’s name, username and password and click done.

18) Next installation of open SSH server, at this point we are not installing and
configuring SSH server, so keep the default value and select Done.
19) At this point installation will start and in few minutes time installation will be
completed. Once complete, reboot now option will appear. Select Reboot Now
option.

20) Once reboot completed, screen for entering login name and password will
appear. We can login in the server by giving valid user and password in this screen.
21) Execute few commands like is(list), cd (change directory) pwd (present working
directory) etc. and verify the output.

Result
Installation and configuration of Linux server has been successfully completed.
Experiment no :2
Date :
FAMILIARISATION OF FILE STRUCTURE IN LINUX SERVER
(Directory structure)
Aim: To familiarize about the file structure in Linux server.
Theory:

About the important subdirectories


[bin : Contain ready-to -run programs(also known as executable)including most
basic Unix Commands asls and cp.
[dev : Contains device files.
[etc : This core system configuration directory contain the user, password,
boot, device, Networking and other setup files. Many items in /etc are specific
to machines hardware.
[home : Holds personal directories for regular user.
[lib : An abbreviation for library, this directory holds library files containing code
that Executables can use. There are two types of libraries static and shared. The
/lib directory Should only contain shared libraries, but other lib directories such
as /usr/lib contain both Varieties as well as other auxiliary files.
/sbin : This directory is similar to the /bin directory. The only difference is that,
this Contains the binaries that can only be run by root or a sudo user.
/usr : User binary and program data contain all the executable files, libraries,
source of most Of the system program.
/usr/bin : Contains basic user commands
/usr/sbin: Contains additional commands for administrator.
/usr/lib: Contains the system libraries.
/usr/share: Contains documentation or common to all libraries.
/usr/local: contains locally installed software and other files.
/tmp: This directory holds temporary files typically cleared on reboot.
/var: This directory is where programs store runtime information like system
logging, user Tracking, caches, and other files that system programs create and
manage.
Exp no : 3
Date :

F A M I L IA R IS A T IO N O F F O R
P E R M IS S IO N F O R A U T H E N T IC A T IO N
A N D A U T H O R IS A T IO N

Aim: To familiarize commands which provide for authentication and


authorization.
Theory
1. list all the users in the system
# c a t /e tc /p a s s w d
2. list all the groups in the system

# c a t /e tc /g ro u p
3. find details of login users

#who
4. create 5 groups

# s u d o g ro u p a d d
g ro u p n a m e
5. create 6 users

# s u d o u s e ra d d
u s e rn a m e
6. change password of all users
#sudo passwd u s e rn a m e
7. assign each users to any two groups

#sudo usermod -a -G groupname username


8. change primary group of any 2 users

# s u d o u s e rm o d -g g ro u p n a m e
u s e rn a m e
9. create additional 2 users

#sudo useradd username


10. create #additional 2 groups
s u d o g ro upa dd
g ro u p n a m e
11. remove new users

#sudo userdel username


12. remove new groups

#sudo groupdel groupname


13. create 5 directories in users home directory

#sudo mkdir name


14. create 6 files in each directory

# s u d o to u c h
15. grant read/write/execute permssion to 2 users on all
directories and files

# c h m o d 7 7 7 [file n a m e ]
16. grant read/write persmision on all files of any two
directory to all users
# c h m o d 6 6 0 [file n a m e ]

Result : Commands are executed and output is verified.


Experiment no:04
Date:
HARDDISK PARTIONING USING FDISK
Aim: Familiarize partitioning of Hard Disk using fdisk command in Linux Server.

Procedure:

1 ) Add additional Hard disks in Linux sever virtual machine.


2 ) To list available hard disk and partitions

Open Linux sever and enter a command and enter lsblk command
#lsblk
3 ) To create partitions in a particular hard disk, start Fdisk command and
select hard disk
# sudo fdisk /dev/sdb
4 ) To see available option in fdisk, type m.
5 ) Then enter #p command to print partition information. In the beginning the
partition list will be empty
6 ) To create a new partition type n. Default partition table is MBR.
7 ) Add three primary partitions and one extended partition
and create 3 logical partitions.
* First create primary partition and give +2G.
* Second create primary partition of +1G size.
* Third partition also a primary with +500m size.
* Then create extended partition and three
logical partitions
8 ) For Creating primary partition type p in partition type.
9 ) For creating extended partition type e in partition type.
10 ) Use default value partition number
11 ) Use default value for First sector
12 ) Choose appropriate value for Last sector (Example +2G for
2GB partition)
13 ) Repeat steps 8-12 to create additional partitions
14 ) Type w to save the partition information.
15 ) The next step to create file system. mkfs command is used for this purpose
Use Mkfs.ext4 /dev/sdb1 command to create file system in
sdb1 partition.Using the same command create file systems in
other partitions also
16 ) The next step is mouting the partition againt a mount point. Follow the
below steps
Create a mount point for each partition using mkdir command
(eg: mkdir /mnt/documents)
mount the directories against each partition using mount command
(eg: mount /dev/sdb1 /mnt/documents)
17 ) To automatically mount all the partitions during booting, modify fstab file and
add allthe mount points and corresponding partition. Follow the below steps
a ) #nano /etc/fstab.
b ) Add each partitions into the file using the format
Partition namemount point file system defaults 0 0
(ex: /dev/sdb1/mnt/documentsext4defaults 0 0 )
18 ) Reboot the server and check whether the partitions are mounted
or not.This completes the partitioning of harddisk using
fdisk utility.

Result: Hard disk partioning Using fdisk has been successfully completed.
Experiment No – 05

Date :

HARDDISK PARTIONING USING GDISK

Aim: Familiarize partitioning of Hard Disk using gdisk command in Linux Server.

Procedure:

1) To list available hard disk and partitions


Open Linux sever and enter a command and enter lsblk command
#lsblk

2) To create partitions in a particular hard disk, start gdisk command and select hard
disk
# sudogdisk /dev/sdc
3) To see available option in gdisk, type ?.
4) Then enter #p command to print partition information. In the beginning the partition
list will be empty

5) To create a new partition type n. In gdiskgptc partition table is created.


6) Add three partitions ,one isswap
• First create partition of size +1G.hex code or GUID is default (8200).
• Second create partition of +1G size. Hex code or GUID is default (8200)
• Third swap with +2G size. hex code or GUID is (8300).
8. Use default value partition number
9. Use default value for First sector
10. Choose appropriate value for Last sector (Example +2G for 2GB partition)
11. Repeat steps 8-12 to create additional partitions

12. Type w to save the partition information.


And enter y to proceed.

13. The next step to create file system. mkfs command is used for this purpose
Use mkfs.ext4 /dev/sdc1 command to create file system in sdc1 partition.Using the
same command create file systems in other partitions also excluding swap.
14. The next step is mouting the partition againt a mount point. Follow the below steps
Create a mount point for each partition using mkdir command (ex: mkdir
/mnt/downloads)
mount the directories against each partition using mount command (ex: mount
/dev/sdc1 /mnt/downloads)

15. To automatically mount all the partitions during booting, modify fstab file and add
all the mount points and corresponding partition. Follow the below steps
a. #nano /etc/fstab.
b. Add each partitions into the file using the format
Partition name mount point file system defaults 0 0
(ex: /dev/sdc1 /mnt/downloads ext4 defaults 0 0 )
16. Reboot the server and check whether the partitions are mounted or not. This
completes the partitioning of hard disk using gdisk utility

Result: Hard disk partition Using gdisk has been successfully completed.
Experiment no.06

Date :

HARDDISK PARTITION USING PARTED

Aim: Hardisk partition using parted.

Procedure:

1) To create partitions in a particular hard disk, start parted command and select hard
disk
#sudo parted /dev/sdd.
• Mk label ms dos
• Mk part.
• Primary partition.
• lsblk to check the status
2) The next step to create file system. Mkfs command is used for this purpose

Use mkfs.ext4 /dev/sdd1 command to create file system in sdd1 partition.Using the same
command create file systems in other partitions also

#sudo mkfs. ext4 /dev/sdd1

3) The next step is mouting the partition againt a mount point. Follow the below steps
4) Create a mount point for each partition using mkdir command (ex: mkdir
/mtn/program)
5) Mount the directories against each partition using mount command (ex: mount
/dev/sdd1 /mnt/program)

To automatically mount all the partitions during booting, modify fstab file and add
all the mount points and corresponding partition. Follow the below steps
#nano /etc/fstab.
Add each partitions into the file using the format
Partition name mount point file system defaults 0 0
(ex: /dev/sdd1/mnt/programext4 defaults 0 0 )
Reboot the server and check whether the partitions are mounted or not. This
completes the partitioning of harddisk using parted utility

Result: Hard disk partition using parted is successfully completed.


Experiment no.07

Date :

CREATE SWAP PARTITIONING USING GDISK.

Aim:To create swap partitioning using gdisk.

Procedure:

1. To create partitions in a particular hard disk, start gdisk


command and select hard disk
#sudo gdisk /dev/sdc

2. To create partition we use n command


#n

• To create Partition.
• Give appropriate size for the Partition

• To Provide the type of file system we use ‘8200’ for swap

For seeing the mount.


5) Activatingswap
Using mkswap command
#sudo mkswap /dev/sdc3
Using swapon command to activate swap
#sudo swapon/dev/sdc3
#lsblk
7)Formounting Partition automatically.
#sudonano/etc/fstab
InsideFstab
/dev/sdc3 swapswap default 0 0

Result: create swap partition Using gdisk has been successfully completed.
Experiment no.08
Date :

NETWORK CONFIGURATION IN LINUX SERVER

Aim:To configure network in linux server to connect the guest to host


machine and internet.

Procedure:
1) Configure NAT and Host-only adapter in virtual machine.
Add additional host-only adapter from tools->network
manager option in Virtual Box management tool
Setup default gate for new host-only adapter
Host-only-adapter#2 ->configure
manually ->192.168.100.1/255.255.255.0 -> apply
2 ) From setting of virtual machine Select Network
* select Adapter 1tab
* Check Enable Network adapter option
* Select NAT in Attached to option
* Select Adapter 2 tab
* Check Enable Network adapter option
* Select Host-only Adapter Attached to option
* Select newly created host-only adapter in Name option
(VirtualBox Host-Only Ethernet Adapter 2).
3 ) Start Linux server and find yaml file(network configuration file)available in
/etc/netplan directory.
4 ) Open/Edit the yaml file using nano
#Cd /etc/netplan
#Sudo nanofilename.yaml(ex:00-installer-config.yaml)
Enter the following to that file and save and exit from nano
network:
ethernets:
enp0s3:
dhcp4:true
enp0s8:
dhcp: no
addresses: [192.168.100.10/24]
nameservers:
addresses: [8.8.8.8]
version:2
5 ) Apply configuration changes using command
#sudo netplan apply
6 ) Confirm ip address configuration using
ip a command.
7 ) Check network connection between host and
internet using ping command
8 ) Between server and internet using ping google.com
9 ) Between server and host machine using ping
host-ip-address.
10 ) Check connection between host and server
from host machine using ping server-address
6) To check the network configuration, ping the ip address which got from
commandprount.
#ping 192.168.56.1

Result : Network is configured and output is verified.


Experiment no. 09

Date :
INSTALLATION OF SSH IN LINUX SERVER
Aim: installation of SSH.
Procedure:
1 ) Configure network with NAT and Host-only-adapter
2 ) Check the presence of SSH.
#sudo systemctl status ssh
3 ) If SSH is not present install SSH.
#sudo apt update
#sudo apt install ssh
Then check status of ssh.
4 ) Check port used by SSH
#sudo ss -ltn
5 ) Check Ubuntu firewall status
#sudo ufw status
6 ) If Ubuntu firewall is inactive enable it.
#sudo ufw enable
7 ) Then enable rules for port 22/tcp
#ufw allow 22/tcp
8 ) Check Ubuntu firewall status again
#sudo ufw status
9 ) Make sure port 22/tcp is existing.
* Install OpenSSH client in windows
10 ) Go to apps & features -> optional features -> add a feature
* Choose OpenSSH Client and click install
* Windows will download and install openSSH Client
* Once insalled, it will appear in installed features lis
* Open command prompt (cmd) in windows
* Connect to Linux sever using ssh username@ipaddress
(of sever).
* Download and Enter ip address [192.168.100.10] in putty.
Then check the network configuration by list or make file
in one and check status in both.
Result : ssh is installedand output is verified.
Experiment no.10

Date:

Backup and restore

Aim: File compressing mechanisam using tar Gzip and gunzip.

Procedure:

File compression helps to reduce file size and share files efficiently. And compressed files
are also easier to copy to remote servers. Also compress older and rarely used files and save
them for future use which helps you conserve disk space.

tar

The tar command is used to create an archive, grouping multiple files in a single file.Its name
comes from the past and means tape archive.

Syntax

tar [flags] destinationFileName sourceFileNames

This command creates an archive named archive.tar with the content of file1 and file2:

tar -cvf archive.tar file1 file2

c stands for create. The f option is used to write to file the archive. The v is providing details
of the files that have been archived.

• To remove the original files after creating an archive, use the –remove-files flag.

tar -cvf archive.tar * --remove-files


• list the files contained in an archive:

tar -tf archive.tar

t flag stands for viewing the contents of the archive

• To find a particular file inside the archive

Tar -tvf archive.tar filename

• To extract files from an archive in the current folder, use:

Tar -xvf archive.tar

The x option stands for extract

• To extract them to a specific directory, use:

Tar -xf archive.tar -C directory

• Tar is often used to create a compressed archive, gzipping the archive. This is done
using the z option:

Tar -czf archive.tar.gz file1 file2


This is just like creating a tar archive, and then running gzip on it.

• To extract files from a compressed archive in the current folder, use:

Tar -xzvf archive.tar.gz

-z specifies that the archive is gzip.

• To unarchive a gzipped archive, use gunzip , or gzip -d , and then unarchive it, but tar
-xf will recognize it’s a gzipped archive

Tar -xf archive.tar.gz

• To Delete files from the archive, use the –delete option

Tar –delete -f archive.tar file_name


Gzip

Gzip (GNU zip) is a compressing tool, which is used to truncate the file size. By default
original file will be replaced by the compressed file ending with extension (.gz).

• compress a file using the gzip compression protocol using the gzip command.

Gzip filename

• This will compress the file, and append a .gz extension to it. The original file is
deleted.

To prevent deleting files, you can use the -c option and use output redirection to write
the output to the filename.gz file:

Gzip -c filename > filename.gz

or

Use -k (keep) option:

Gzip -k filename

There are various levels of compression. The more the compression, the longer it will take to
compress (and decompress). Levels range from 1 (fastest, worst compression) to 9 (slowest,
better compression), and the default is 6.

choose a specific level with the -<NUMBER> option:

Gzip -1 filename

• compress multiple files by listing them


Gzip filename1 filename2

• compress all the files in a directory, recursively, using the -r option:

Gzip -r a_folder

• The -v option prints the compression percentage information. Example to used along
with the -k option:

Gzip -kv wget-log

• Gzip can also be used to decompress a file, using the -d option:

Gzip -d filename.gz

• The compression ratio or how much the original file has compressed, use -l option
Gzip -l filename.gz
Gunzip

The gunzip command is basically equivalent to the gzip command, except the -d option is
always enabled by default.

• The command can be invoked in this way:

Gunzip filename.gz

This will gunzip and will remove the .gz extension, putting the result in the

filename file.

• If that file exists, it will overwrite that.

Extract to a different filename using output redirection using the -c option:

Gunzip -c filename.gz > anotherfilename

• To keep both the compressed and

decompressed file

Gunzip -k filename.gz
• To recursively decompresses all files in a given directory, use the -r option:

Gunzip -r directory

• List the Compressed File Contents, use the -l option

Gunzip -l filename.gz

Result: Successfully executed File compressing mechanisam using tar Gzip and gunzip.

You might also like