Karthik K Na Lab 2
Karthik K Na Lab 2
Karthik K Na Lab 2
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................................................................
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.
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.
Select size(5G), format (ext4) and mount (\) and click create.
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:
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
# 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
# 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
# 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 ]
Procedure:
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 :
Aim: Familiarize partitioning of Hard Disk using gdisk command in Linux Server.
Procedure:
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
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 :
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
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
Date :
Procedure:
• To create Partition.
• Give appropriate size for the Partition
Result: create swap partition Using gdisk has been successfully completed.
Experiment no.08
Date :
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
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:
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
This command creates an archive named archive.tar with the content of file1 and 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 is often used to create a compressed archive, gzipping the archive. This is done
using the z option:
• To unarchive a gzipped archive, use gunzip , or gzip -d , and then unarchive it, but tar
-xf will recognize it’s a gzipped archive
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:
or
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.
Gzip -1 filename
Gzip -r a_folder
• The -v option prints the compression percentage information. Example to used along
with the -k 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.
Gunzip filename.gz
This will gunzip and will remove the .gz extension, putting the result in the
filename file.
decompressed file
Gunzip -k filename.gz
• To recursively decompresses all files in a given directory, use the -r option:
Gunzip -r directory
Gunzip -l filename.gz
Result: Successfully executed File compressing mechanisam using tar Gzip and gunzip.