Professional Documents
Culture Documents
PRACTICAL1: Date:
Installation of RHEL 6.X
1.Creating new virtual machine click on “Create a new virtual machine”.
3.After that check radio button “Select Installer disk image file” and browse the disk file and After
click on I will install the operating system later option.Click on Next.
4.After that select Guest operating system for that click on “Linux” option select the version of
Linux that is “Red Hat Enterprise Linux 6 64-bit”.Click on Next.
5.After that Give name to your virtual machine in “Virtual machine name” and set the Location or
you can use Default Location which is theirs. Click on Next.
6.After that Specify Disk Capacity in which choose the option as “Split virtual disk into multiple
files”. Click on Next.
2.Click on Network Adapter option select the option “Host-only option” after that click on close.
9.Click on Finish.
Click next.
13. Select the appropriate Keyboard option as U.S. English and click on Next.
14. Select what type of devices will your installation involve? In that you choose Basic Storage
Device option and click next.
16. Now here we assign our Hostname change the hostname as you desire or let it be as
localhost.localdomain and click on Next.
18.Enter the root Password. Click on Next. And click on Use Any way.
1 /(root)Ext4 10000 MB
2 - /swap 4000 MB
3 /boot Ext4 2000 MB
4.After that click on Next.And Format Button.
5.After that Click on “Write Changes to disk”.
21.Click on Next.
22.After click on Next Choose two option from one part choose “Desktop” and for another part
click on Customize Now option and click on Next.
2.Select Servers (E-mail server, FTP server, NFS File server, Print server)
Click on reboot
26. Select the option “Yes,I agree to the Licence Agreement”. Click on Forward button.
28.Click on Forward button. And fill the username and password.Click on Forward button.
PRACTICAL2: Date:
Graphical User Interface and Command Line Interface and Processes
a.The Command Line Interface :
1.Use man and man -k to find out how to change the current date on your computer. Set the date
to yesterday (and don’t forget to set it back when you’re done with the exercise).
For instance, use man -k time | grep 8. You’ll find the date command. Use date mmddhhmm to set
the date.
2. Create a directory with the name /tempdir. Copy all files from the /etc directory that start with
an a, b, or c to this directory. mkdir /tempdir, cp /etc/[abc]* /tempdir
3. Find out which command and which specific options you will need to show a timesortedlist of
the contents of the directory /etc.
Use man ls. You’ll find the -t option, which allows you to sort ls output on time.
4. Find all files on your server that have a size greater than 100 MB find / -size +100M
b.MANAGING PROCESSES
(i)Move a job that was started as a foreground job into the background.
(ii)Start a few processes to make the parent-child relationship between these processes visible.
Then kill the parent process.
(iii)Using nice to Change Process Priority
(iv)Create a user account to run a cron job that sends an email message to user root on your system.
(i)Move a job that was started as a foreground job into the background.
open a terminal, and from that terminal, start the system-config-users program.
You will see that the terminal is now occupied by the graphical program you’ve just started and
that you cannot start any other programs.
Click in the terminal where you started system-config-users, and use the Ctrl+Z key sequence. This
temporarily stops the graphical program and returns the prompt on your terminal.
Use the bg command to move the job you started by entering the system-config-users command to
the background. You can now continue using the graphical user inter face and, at the same time,
have access to the terminal where you can start other jobs by entering new commands
From the terminal window, type the jobs command. This shows a list of all jobs that are started
from this terminal. You should see just the system-config-users command. Every job has a unique
job number in the list displayed by the jobs command. If you have just one job, it will always be
job 1.
To put a background job back into the foreground, use the fg command. By default, this command
will put the last command you started in the background into the foreground. If you want to put
another background job into the foreground, use fg followed by the job number of the job you
want to manage; for instance,
use fg 1.
(ii)Start a few processes to make the parent-child relationship between these processes visible.
Then kill the parent process.
Use the bash command to start Bash as a subshell in the current terminal window.
Use ssh -X localhost to start ssh as a subshell in the Bash shell you just opened.When asked if you
want to permanently add localhost to the list of known hosts,enter yes. Next enter the password
of the user root.
Type ps afx to show a listing of all current processes, including the parent-child
relationship between the commands you just entered.
One of the output lines shows the ssh -X localhost command you just entered. Note the PID
that you see in that output line.
Use kill followed by the PID number you just found to close the ssh shell. Because the ssh
environment is the parent of the gedit command, killing ssh will also kill the gedit window.
Type the command dd if=/dev/zero of=/dev/null &, and repeat this four times.
Now star t top. You’ll see the four dd commands listed at the top. In the PR column, you can see
that the priority of all of these processes is set to 20. The NI column, which shows the actual
process niceness, indicates a value of 0 for all of the dd processes, and, in the TIME column, you
can see that all of the processes use about the same amount of processor time.
Now, from within the top inter face, press r. On the PID to renice prompt, type the PID of one of the
four dd processes, and press Enter. When asked Renice PID 2826 to value, type 5, and press Enter.
With the previous action, you lowered the priority of one of the dd commands. You
should immediately star t seeing the result in top, because one of the dd processes will
receive a significantly lower amount of CPU time.
Repeat the procedure to adjust the niceness of one of the other dd processes. Now use a
niceness value of -15. You will notice that this process now tends to consume all of the available
resources on your computer. Thus, you should avoid the extremes when working with nice.
Use the k command from the top interface to stop all processes where you adjusted the niceness.
(iv)Create a user account to run a cron job that sends an email message to user root on your
system.
PRACTICAL 3: Date:
Storage Devices and Links, Backup and Repository
Before creating the partition we need to check the current partitions and file systems.
To view all existing disk partitions we use ‘fdisk –l’ command.
fdisk command helps to create,view,resize,delete,change,copy and move partitions on a hard
drive. It allows creating four new primary partitions, and number of logical partitions(extended
partitions) based on the size of the hard disk by dividing from one of the primary partitions.
‘-l’ stands for listing all partitions.The above o/p shows there are currently 3 partitions
as /dev/sda1,/dev/sda2 and /dev/sda3.
First open the file /etc/fstab and then remove the last line which was added.
Create one physical volume /dev/sda5 and one volume group as tybscit-A then create one
logical volume user1 and finally mount this volume to directory /user1.
Extend partition
A] Press ‘n’ for new partition
B] Press ‘e’ to extended partition
C] Press ‘Enter’ on first and last sector
D] Press ‘p’ to print the partition
Once you have completed all the steps reboot the system by using init 6 command
To check your volume groups name,size and free space use vgs command
Create logical volume name of user1 with 2GB space from tybscit-A group by using lvcreate
command
(iii)create a hard link as well as a symbolic link to a file to demonstrate the differences
Create a hard link as well as a symbolic link to the file /etc/hosts, and you will see how both behave
differently
Open a terminal and make sure you have root permissions.
Using the command ln –s /etc/hosts ~/symhosts. This creates a symbolic link with the name
symhosts in your home directory.
Using the command ln /etc/hosts ~/hardhosts. This creates a hard link with the name hardhosts in
your home directory.
Using the command ls –il /etc/hosts ~/symhosts ~/hardhosts .The option –I shows the inode
number.You can see the inode number is same for /etc/hosts and ~/hardhosts like all other properties
of a file.
Use rm /etc/hosts.Try to read the contents of ~/symhosts and ~/hardhosts.You will see
the difference.
Restore the original situation by recreating the /etc/hosts file.You can do that easily by making a
new hardlink using ln ~/hardhosts /etc/hosts
b.Creating a Repository
Create a repository for Yum and install httpd package using yum
Step1: Check the DVD for Packages
cd:change directory and ls:list the files under the directory
Check the folder RHEL6 to see whether the packages have been copied properly by using
ls command
Go to /etc/yum/pluginconf.d directory
If this error comes install createrepo using rpm and install all the dependency packages until
no dependency is found
Now the command for creating repository will work by changing the directory to pluginconf.d
The directory /etc/yum.repos.d/ contains two .repo files which should be removed or moved to
other directory,so that YUM server will check default.repo file it self.If you don’t move or
remove the default .repo files from /etc/yum.repos.d/ folder then every time when you try to
install packages through YUM,your yum will check all these files for repositories for getting
packages which will or will not work and most probably delay is increased in getting those
packages from online servers.
As the httpd package is already install therefore the package is not been installed.You can try
with nmap package
Practical4: Date:
Working with RPMsm Storage and Networking
a.Using Query Options
(i) Various Query Option
Before that go into Packages.using command :
7. How to List all file before installing RPM package. Using -qpl option.
b.Connecting to Network
PRACTICAL5: Date:
Working with Users, Groups, and Permissions
A.Becoming super user
Step1: Creating a user account “smith” to grant him the privileges of super user.
Step2: Open the file /etc/sudoers and the following lines for smith:
Step4: Test the configuration by making smith to login and perform any administrative
activity as shown below:
I]Add user Jackson using sudo:
(1) When root changes identity temporarily, with the help of su command, the system never
asks for password:
(2) But when any local user tries to change the identity temporarily, redhat system asks for the
password as shown below:
(C)Administrative commands:
(5) groupadd command to create a new group and gpasswd command to add members and
administrator in the group:
PRACTICAL6: Date:
Firewall and Cryptographic services
a.Securing Server with iptables
Allowing outgoing ssh connection which is established for incoming ssh connection request,
once the incoming connection is allow we also need to allow response back for that incoming ssh
connection
1.Login as root permission and add two user first “linda” nd second “lisa”
PRACTICAL 7: Date:
Configuring Server for File Sharing
a.Configuring NFS Server and Client
1.Insatallation of nfs package.
3.Make a directory to be exported,create few files into it and give full permission.
12.As NFS Client make a directory /clientnfs and mount the server exported directory on it.
13.To unmount the file from the client machine, use the unmount command.
b. Configuring Samba
• Samba is basically used for establishing connection among linux to windows, with help of
samba file sharing can be done using Windows file-sharing protocol and connect your Red Hat
Enterprise network to a windows network to share files and printers.
• Windows use a protocol called Server Message Block (SMB) to communicate with each
other and to share services such as file and print sharing.
• With Samba, the Linux PC icon appears in the Windows Network Places window and the
files on the Linux PC can be browsed using Windows Explorer.
• The Windows File system can be mounted on your Linux System , and you can browse the
Windows files from your Linux PC. Before using Samba to connect to the Windows computers, it
must first be installed on the Linux PC.
• All current distributions of Linux include three Samba packages:
- Samba
- Samba-client
- Samba-common
2: Create a directory /data on the Linux file system on the Samba server.
4: Set directory with the samba_share_t type, if you want to treat the files as samba share data
And make the following changes by going to end of the file->Press Esc->:$
c.Configuring FTP
1: Verify the package vsftpd for FTP. If installed create few files in pub. it is shown below. #rpm –
qa | grep vsftpd
This command returns the version of vsftpd.If package vsftpd is not installed then install using
following command.
#rpm – ivh vsftpd*
#rpm –ivh ftp*
2:Check whether the package is install or not with #rpm –qa | grep ftp command
3:Now use following command to start vsftpd services at boot time using chkconfig command.
# chkconfig vsftpd on
11: By default /var/ftp is ftp user Home directory. Check the context of file /var/ftp/pub and
change to ftp
#ls –ldZ /var/ftp/pub
#chgrp ftp /var/ftp/pub
#chown ftp /var/ftp/pub
#ls –ldZ /var/ftp/pub
14:Now FTP is configure.Test as FTP client from other machine. Use the following
command. #ftp:192.168.21.129/pub/
PRACTICAL 8: Date:
DNS, DHCP and Mail Server
a.Configuring DNS
Name address resolution is simply the conversion of people friendly names into computer
friendly numbers.
It means that every interface on the network has a unique group of
numbers called as IP address.
These group of numbers present to the computers in the network but it is difficult for the users to
by heart, learn or remember them.
DNS makes possible for the users to enter the names and then thes4e names
company or institution or an organization. The next part after the period/dot is a called as top-level
domain (TLD).
There are many TLD listed below
.com - A TLD used to register a business
.edu – A TLD for educational institution
.name – A TLD used to register sites for individuals
.gov – A TLD given to government
.mil – A TLD used for military
.org – A TLD used by a non-commercial organization
DNS Configuration
Step3:#vim /etc/hosts
#cd
Step8:vim /etc/named.conf.
Step13:Open forward.zone
Step14:Open reverse.zone
OR
#dig –x 192.168.21.129
b.Configuring DHCP
1: First we have to check whether DHCP is available on our machine or not that we can check
with rpm command.
5.DHCP server havea static a IP address.First configure the IP address 192.168.43.243 with
netmask255.255.255.0 on server.
8.Select your LAN card(If you don’t see any LAN card here means you haven’t installed the driver)
3.Writing a mail.
Practical9: Date:
Web Server
a.Configuring Apache on Red Hat Enterprise Linux
• When you view a web page over the Internet, the code to create that page must be
retrieved from a server somewhere on the Internet.
• The server that sends your web browser the code to display a web page is called a web
server. There are countless web servers all over the Internet serving countless websites to people all over
the world.
• Whether you need a web server to host a website on the Internet a Red Hat Enterprise
Linux server can function as a web server using the Apache HTTP server.
• The Apache HTTP server is a popular, open source server application that runs on many
UNIX-based systems as well as Microsoft Windows.
• Since we had created DNS named as server.tyit.com but on Linux browser it is showing
unable to connect because we need to configure apache web server , so that we can display out html
page on web browser with the help of our own DNS server.tyit.com
#chkconfig httpd on
#service httpd start
#service httpd status
You have done necessary configuration now restart the httpd service and test this configuration run
links command.
#service httpd restart
#chmod –R 777 /var/www/virtual/www.tyit.com/html/
After stopping httpd service the script will start the httpd service automatically
c. Using the select Command Write a simple script that asks the user to enter the name of an RPM
or fi le that the user wants to query. Write the script to present a menu that provides different
options that allow the user to do queries on the RPM database The following options must be
presented:
a. Find the RPM from which this file originates.
b. Check that the RPM where the user has provided the name is installed.
c. General info of this RPM.
d. Remove this RPM.
Practical:10 Date:
Shell script
a.Writing Shell Scripts:
Write a shell script to accept two numbers and to print its
a. addition
b. product
c. a / b.
d. (a + b) – c
1.Login as root permission on file in vi editor.
5.Write a shell script to read a number between 1 to 7 and print day of the week using case in.
6. Modify the above script to accept Number as the first positional parameter. (console parameter)
7. Write a shell script to find the type of character typed (lower case, upper case, symbol)
3.Wrire a shell script to create a menu driven program to perform following tasks.
1. To see all files in /etc
2. To see list of users
3. To print current working directory
4. To call another script.
5. To exit.
Change From Red Hat Enterprise Linux to Red Hat Recovery in grub.conf file