Module II

Unit 12: Linux Installation

  • Bootable CD installation
  • non-bootable CD using floppy disk or via hard disk
  • network based installation: NFS, DHCP, FTP & HTTP
  • kickstart installation either standalone or via network

 In case of non-bootable CD or via local hard disk drive or network installation, a bootable disk is to be made. There is an image file /mnt/cdrom/images/bootdisk.img which has to be copied to the floppy disk.

# cat bootdisk.img > /dev/fd0 or,
# dd if=bootdisk.img of=/dev/fd0
If you are using Windows operating system then,
c:> cd d:dosutils
d:dosutils;> rawrite.exe
input location: d:imagesbootdisk.img
output location: a:

 note: if you are planning for the network installation, make another driver disk for the network driver from the file named” drvnet.img” from the same image directory.

 Kickstart Installation:

  1. Create a kickstart file.
  2. Create a bootdisk with a kickstart file or make the kickstart file available on the network.
  3. Start the kickstart installation.

 The advantage of kickstart installation is that it automates all the steps that is asked during an installation. The Linux installation program anaconda reads all the necessary parameters from the kickstart file called “ks.cfg”. By default, whenever you install Linux operating system in your machine, the file named “anaconda-ks.cfg” is automatically created in root’s home directory. This file contains the detailed information regarding options used or the hardware configurations or various packages selected during installation. It can be directly copied in the boot disk or available on the network with a name “ks.cfg”. This file can be modified as per the requirement. Otherwise the kickstart file can be created using the command “redhat-config-kickstart” in the graphical environment. This command makes available for every option to be prompted during manual installation.

Whenever a bootdisk or the installation CD is used to boot a machine, it prompts for the installation.

  1. boot: <return> –> takes the installation to the graphical mode
  2. boot: linux text –> takes to the text mode installation
  3. boot: linux ks=floppy –> specifies that kickstart file is in the bootdisk itself
  4. boot: linux ks=nfs:<IP of NFS server>:/<path> –> specifies that kickstart file is in specified location of NFS server
  5. boot: linux ks=http://<IP of web server>:/<path> –> specifies that kickstart file is in specified location of web server
  6. boot: linux ks=ftp://<IP of FTP server>:/<path> –> specifies that kickstart file is in specified location of FTP server

If network installation is to be done, the very first thing is to configure the computer’s NIC card. For it, the drvnet.img file is to be used. Generally, IP for the host is automatically given by a DHCP server. It has to be defined during network configuration. Similarly, the location of installation packages are to be defined along with their installation type (NFS, FTP or HTTP) IP address of the computer having installation packages and the path. For providing a static IP, here is an example:

IP Address:
Network Address:
Broadcast Address:
Default Gateway:
Primary DNS:

Unit 13: Disk Partitioning

Disk Types:

  • Primary Master –> hda
  • Primary Slave –> hdb
  • Secondary Master –> hdc
  • Secondary Slave –> hdd

In case of SCSI disks, it is sda, sdb, sdc, etc.

 Disk Partitions:

In IDE disks, it is possible to create 16 partitions on each disk in such a way that there can be maximum 4 primary partitions including 1 extended partition. It should be noted that logical partitions are created inside extended partition and maximum 14 logical partitions are possible with 1 primary and 1 extended partition.

 Disk partition utilities:

There are two disk partition utilities in Linux. “Disk Druid”, a simple one available only at during pre-installation and “fdisk”, an advanced one available only at post-installation that is available in recent versions of Red hat Distributions.

 Things to remember during partitioning:

In UNIX/Linux environment, it is possible to create a separate partition for each directory. For instance, directories like /, /home, /usr, /tmp, /var, /boot, etc can be in separate partitions. But exceptionally, directories like /bin, /sbin, /lib, /root are to be under the same root directory i.e. “/”. For installing Red Hat Enterprise 3, recommendation of the partition size for the respective directories are as follows:

/boot –> 100Mb
/ –> 2048Mb
/usr –> depending upon the number of packages to be installed
/var –> depending upon the amount of work load
/home –> depending upon the number of users and the disk space to be provided
linux swap –> twice or thrice of the RAM.
/tmp –> optional

 Creating a new linux partition during post-installation:

  1. “fdisk -l” lists the existing partition table

  2. “fdisk /dev/hda” activates fdisk utility for modifying partitions on the primary master of IDE disk. Then it appears as follows:

Command (m for help):

Note: the problem may arise at a boot time if the older versions of boot loader like “LILO” is used, which has the limitation of normal operation only up to 1024 cylinders i.e. Approximately 8Gb. But there is nothing wrong with latest boot loader like “GRUB”.

  1. Command (m for help): n –> enables to create a new partition

p primary (1-4)
l logical (5 or over)
Note: primary partitions are numbered from 1-4, whereas logical partitions are numbered only after 5.
start cylinder: 1024
end cylinder: +1024M

(Here, the partition of size 1Gb is created. Generally, the new partition is created at the very last of the partition table, there is no overlapping.)

  1. Command (m for help): w –> enables to save the new partition

  2. “reboot” or “sync” is done to update the partition table.

  3. After restart, “fdisk -l” is used to check whether a new partition is created or not.

  4. “mke2fs -j /dev/hda9” is used to format the 5th logical partition using “ext3” file system. The “ext3” file system is the modification of “ext2” file system with journaling.

  5. After creating a partition a mount point should be given. A mount point is a directory under which a partition is accessed. Since the partition has to be automatically mounted to the specified directory during startup, the file “/etc/fstab” is used for it. The new line should be appended as follows:

/dev/hda9 /data ext3 defaults 0 0

 Here, “/data” is the mount point for the 5th partition of primary master.

“/etc/fstab” file is read during startup of the system. It contains the name or label of every partition and their respective mount point along with file system specification. “/etc/mtab” is the file that contains the list of currently mounted partitions along with their mount point. Simply the command “mount” can be issued to see the contents of “/etc/mtab”. “mount -a” is used to mount all the partitions into their respective directories as per the “/etc/fstab”.

 Mounting network file system (NFS):

mount -t nfs <IP address of NFS server>:<shared directory> <mount point>

Example: mount -t nfs /mnt/data

 Mounting floppy disk drive:

mount -t msdos /dev/fd0 /mnt/floppy

 Note: According to UNIX principle “Everything is a file”, the devices are also treated as file. Here, “/dev/fd0” is the mount point for floppy disk drive. Instead of “msdos”, “vfat” can be used that stands for FAT32 file system.

 Creating a new swap partition:

  1. Create a new partition using fdisk (/dev/hda10 say)
  2. restart the computer
  3. mkswap /dev/hda10
  4. swapon /dev/hda10 –> active only for the current session
  5. add an entry in /etc/fstab –> active for every startup

/dev/hda10 swap swap defaults 0 0

 Creating a swap file from free space of ext3 file system:

  1. dd -if=/dev/zero of=/misc/myswap bs=1024 count=20000

myswap” refers to the filename in /misc directory
bs” refers to block size i.e. 1024 byte
hence total file size = block size X count = 1024 X 2000 = 20Mb

  1. mkswap /misc/myswap

  2. swapon /misc/myswap –> active only for the current session

  3. add an entry in /etc/fstab –> active for every startup

/misc/myswap swap swap defaults 0 0

Maintenance for File System:

Files are identified by their inodes. Inodes are the identification numbers, uniquely assigned for each file in the partition. The Linux kernel manipulates files on the basis of their inodes. During abnormal shutdown or power failure, the inode numbers might get varied with their respective filenames. Hence for the solution, the maintenance for file system has to be done. It should be noted that the file systems are not supposed to undergo maintenance when their respective partitions are being mounted. The file systems are to be checked only when their partitions are unmounted. Generally it has to be done in a rescue mode or single user mode, unmounting the partition.

Syntax: e2fsck [partition]
Example: e2fsck /dev/hda3

 Unit 14: RAID

Redundant Array of Independent Disks (RAID)

RAID is a series of disks that can preserve data even if there is a failure on one of the disks. Some versions of RAID make complete copies of data, whereas other used the “parity-bit” to allow system to rebuild the data on lost disks. The RAID “md” device is a meta device, which is a composite of two or more other devices(disks) or partitions, that might be components of a RAID array. It should be noted that the disks used for RAID should have an identical size. By default, Red Hat Linux supports four levels of RAID: RAID 0, RAID 1 & RAID 5.

RAID 0: It makes faster access (read/write) to the hard drives. It requires at least two hard disks/partitions. Here, two or more disks/partitions are accessed simultaneously. RAID 0 is generally used to create larger storage size from the combination of smaller disks. RAID 0 is also known as “striping without parity”, since it doesn’t provide data redundancy, a failure of any one of the drives results in total data loss. It has 100% disk utilization. For example:

Disk A (10Gb) + Disk B (10Gb) = RAID 0 meta device (20Gb)

 RAID 1: It copies the same set of information in two different disks. If one disk is damaged, the data is preserved on the other disk. Hence, it is fault tolerance. Here, if a two disks are connected by a single disk controller, it is known as disk mirroring and if the disks are connected by a separate disk controllers, then it is known as disk duplexing. It has 50% disk utilization. For example:

Disk A (10Gb) + Disk B (10Gb) = RAID 1 meta device (10Gb)

 RAID 5: It requires at least 3 disks. RAID 5 distributes or stripes parity information evenly across all the disks. If one disk fails, the data can be reconstructed from the parity data on the remaining disks. RAID doesn’t stop; all data is still available even after the failure of a single disk. Moreover, a spare can be defined before hand so that in case of failure of a disk, data is automatically recovered to the spared disk. RAID 5 is the most preferred one, since the performance is good, data integrity is ensured, and 66.7% disk utilization. It is fault tolerance and is known as “ disk stripping with parity”. For example:

Disk A (10Gb) + Disk B (10Gb) + Disk C (10Gb) = RAID 5 meta device (20Gb)

RAID can be configured pre-installation and post-installation. In pre-installation, RAID option is available during disk partitioning using disk druid. The partitions or the disks of identical sizes are to be selected for RAID along with the mount point. By default, the first RAID device created is “/dev/md0”.

During post-installation, the following steps are to be followed for RAID 5:

  1. Create 4 equal partitions (say /dev/hda6, /dev/hdb1, /dev/hdc1, /dev/hdd1) in a free space such that their partition type is Linux RAID auto “fd”.
  2. Create a configuration file “/etc/raidtab” as follows:

raiddev /dev/md0
raid-level 5
nr-raid-disks 3
nr-spare-disks 1
persistent-superblock 1
chunk-size 4
device /dev/hda6
raid-disk 0
device /dev/hdb1
raid-disk 1
device /dev/hdc1
raid-disk 2
device /dev/hdd1
spare-disk 1

  1. mkraid /dev/md0

  2. reboot

  3. raidstart /dev/md0

  4. mke2fs /dev/md0

  5. Edit the file “/etc/fstab” and add an entry for mounting /dev/md0

 /dev/md0 /data ext3 defaults 0 0

Unit 14: LVM

Logical Volume Management (LVM)

LVM is introduced only after Red Hat 8. LVM enables to manage (either expand or contract) active partitions. For instance, the space for /home directory for more users or /var directory for log files can be reallocated/increased using LVM. With LVM either new physical disk or the partition can be added. The order of creating LVM are as follows:

Linux Partition –> Physical Volume –> Volume Group –> Logical Volume

Physical Volume (PV): is the either individual or collection of standard partitions (either primary or logical) which can be defined to a Linux partition by changing partition type to “8e” from “83”. It can also be a RAID array. For example, partitions like /dev/hda11, /dev/hdb1, etc can be simply defined as physical volume.

 Volume Group (VG): is a collection of a single or multiple physical volume. A collection of physical volume can be configured as a volume group. For example, a volume group “/dev/lvm0” can be created from a physical volume /dev/hda11, /dev/hda12.

 Logical Volume (LV): is created from volume group. There can be multiple logical volumes out of volume group. For example, a logical volume /dev/lvm0/data0 can be created from a physical volume /dev/lvm0.

 Steps for creating and expanding LVM:

  1. Create a partition (/dev/hda11 say) of type lvm “8e”
  2. For the distributions Red Hat 8 and Red Hat 9, edit the file “/etc/modules.conf” and add the following lines so that lvm modules are loaded at the boot time.
  • alias block-major-58 lvm-mod
  • alias char-major-109 lvm-mod
  1. Rebuild the initial RAM-disk image

mkinitrd -f -v /boot/initrd-<kernel-version>.img <kernel-version>

  1. reboot

  2. Convert the lvm partitions into physical volumes

pvcreate /dev/hda11

  1. Create a volume group “lvm0” from the physical volume

vgcreate lvm0 /dev/hda11

  1. Create a logical volume “data0” of 100Mb size from the volume group

lvcreate -L 100M -n data0 lvm0

  1. Create ext3 file system on a newly created logical volume

mke2fs -j /dev/lvm0/data0

  1. Mount the logical volume “data0” on directory /data

mount /dev/lvm0/data0 /data0

  1. Increase the size of the logical volume “data0” by 50Mb

  • umount /data
  • e2fsadm -L+50M /dev/lvm0/data0
  • mount /dev/lvm0/data0 /data­

For expanding the physical volume:

1. Create a new partition (/dev/hda12 say) of type “8e” using fdisk utility

2. Convert the partition /dev/hda12 to the physical volume

pvcreate /dev/hda12

3. Increase the size of the volume group “lvm0” by adding a new physical volume

vgextend lvm0 /dev/hda12

 Unit 15: System Initialization and Services

 Linux System Startup Sequence:

  1. Power on the machine and system startup
  2. BIOS Checks hardware configuration and boot sequence
  3. Bootloader (GRUB) reads the MBR or first active partition where the location of the kernel is defined. MBR i.e. Master Boot Record is the first sector the disk that contains the information regarding the location of the operating system in the disk
  4. Kernel is loaded from /boot directory
  5. Kernel calls the “init” process from a file “/etc/rc.d/rc.sysinit”. It is the first parent process that has the “pid” number 1
  6. The “init” process determines the runlevel from a file “/etc/inittab”
  7. Loads modules
  8. Checks if file system check (fsck) is required.

a) if required, fsck is run, otherwise read “/etc/fstab”
b) if fsck is not terminated properly, prompt root password for maintenance, otherwise read “/etc/fstab”

9. Mount the disk partitions to their respective mount points (directories) as per the file “/etc/fstab”

10. Run “init” scripts from a directory “/etc/rc.d/init.d” according to the file “/etc/inittab”

11. Spawn terminals or X-Window system as per the file “/etc/inittab”

 The /etc/inittab file:

/etc/inittab is a colon separated file having 4 columns. The first column of each line is unique throughout the whole file. The line starting with first column “id” i.e. “id:5:initdefault” initializes the default runlevel.

The columns with l0, l1, l2, l3 ….l6 defines the runlevels and the location their respective process. Here, all the process of runlevel 5, which are in the directory /etc/rc5.d is initialized. Actually, all the processes of the Linux Operating System are inside the directory /etc/rc.d/init.d. The /etc/rc5.d is only the soft link for the directory /etc/rc.d/rc5.d, which contains soft link only of those process in etc/rc.d/init.d, required to initialize in the runlevel 5.

 wait: refers nothing after termination, whereas, respawn refers to re-execution of the process after its proper termination.

  •  /etc/sysinit: contains the kernel parameter setting
  •  /etc/sysctl.conf: extracts data from /proc directory
  •  /etc/issue: contains the banner for local login screen
  • /etc/ contains the banner for network login screen

In order to start or stop certain processes in the specific runlevel, commands “ntsysv” or “chkconfig” are used. The command “ntsysv” lists all the peocesses in /etc/rc.d/init.d directory, where it is possible to select the desired processes on the current runlevel. On the other hand, the command “chkconfig” has the syntax: chkconfig [level] [service] on|off. For example: the command:

chkconfig –level 5 httpd on enables to start the process httpd on the runlevel 5.

 Daemon Process:

  • Runs in background, waiting for events to happen (i.e. Some request)
  • As it receives a request, it creates its own copy and that duplicate copy responses for the request, but the parent copy waits for other events to happen

To start or stop the daemon, the syntax is: service [daemon] start|stop|restart|reload|status

 Unit -16 User Administration

 Adding user:

useradd [username]
It creates a user for the current host and creates the directory under the name
given in /home, whose architecture is defined as from /etc/skel directory. The default permission
of the local user’s home directory is 700 (rwx——).
passwd [username]
It assigns/changes the login password of the user, which is updated in /etc/shadow
file. Generally, the 5th column in the /etc/password file is set empty while using passwd
command. In order to enter the comment for the particular user, the following command is used:
chfn [username]
Office Phone:
Home Phone:
finger [username] is used to display the information about the specific user.
Modifiying User Accounts:
usermod [options] [username]
-c [comment] –> comment is changed
-d [directory] –> change home directory
-g [group] –> change the primary group
-G [group] –> change the secondary group
-l [login name] –> change the login name
-s [shell] –> change the login shell
-u [UID] –> change the user identification number
-p [password]–> change the password
-L –> lock the password
-U –> unlock the password
Password Aging Policy:
chage [options] [username]
-m <n> –> minimum number of days between password changing
-M <n> –> maximum number of days between password changing
-E <date> –> expire the password of this <date> (mm/dd/yy)
-W <n> –> issuing warnings before <n> days for changing password

Group Administration:
groupadd [groupname] –> for adding group (updates in /etc/group)
groupdel [groupname] –> for removing group
groupmod -n [newname] [oldname] –> for renaming group
groupmod -g [gid] [groupname] –> for changing GID
Switching Login Account:
su [username] –> the shell of the former user is retained
su – [username] –> the shell of the new user is activated
Changing File Ownership:
chown [username] [filename]
chown [group] [filename]
chown [username].[groupname] [filename]
Special File Permissions:
Permission Type Symbolic Notation Octal Notation
suid s or S [rwsrwxrwx] 4 [4777]
sgid s or S [rwxrwsrwx] 2 [2777]
sticky t or T [rwxrwxrwt] 1 [1777]
Suid: If “suid” bit is set in the executable file, whoever runs that executable file, the file is
executed under the owner’s security context. For instance, the command “/usr/bin/passwd” can
be executed by any local user but the command is executed under the ownership of the
Sgid: If “sgid” bit is set in the executable file, it will be executed under the group owner’s
security context.
Sticky: If “sticky” bit is set in the directory, only the owner of the file can delete the file inside
it; independent of the permission given.

Unit – 17: Network Configuration
Network interface modules are located at boot time if networking has been enabled. File “/etc/modules.conf” sets the alias for device modules other than the kernel module.
alias eth0 8139too
Network Interfaces:
• Ethernet –> eth0, eth1
• token ring–> tr0, tr1
• FDDI –> fddi0, fddi1
• PPP –> ppp0, ppp1
ifconfig –> refers to the interface configuration, which displays active network
interface. By default, it generally shows two active interfaces, one of ethernet address (eth0) and
another of loop back address (lo) and if the machine is connected to the Internet via a modem, then it also shows a third interface of ppp i.e. (ppp0).
ifdown eth0 –> eth0 is stopped (deactivating Ethernet interface)
ifup eth0 –> eth0 is activated (activating Ethernet interface)
There are 2 addresses associated with every network interface; one is physical and
the other is logical. Physical addresses are also known as MAC or hardware address that works on the data link layer. It is unchangeable and written by the manufacturer. It is of total 48-bit in length, out of which 24-bit is used as organizational identification and rest 24-bit is the serial number. But on the other hand, logical address works on the network layer and is assignable, commonly known as IP address.
Active Resolution Protocol:
“arp” maps Ethernet MAC address to IP address
arp -a ( at 00:B1:CC:45:50:FD [ether] on eth1
Interface Configuration File: /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
BOOTPROTO = static or dhcp
ONBOOT = yes
IP Routing:
A host on one networks cannot communicate with other host on another network if
they have different IP addresses. In order to communicate between two hosts at two different networks, IP routing has to be done. IP forwarding is the process of transferring a data from one network to another.
Router is a machine that has IP forwarding service. Generally, PCs are not used as
ROUTER in large networks. Instead, CISCO routers are used, which are connected via serial port or parallel port with PC.
A table is to be created for IP forwarding that describes which device is to
be connected for the specific network for transferring a specific data. Such table is known as a routing table.

In the kernel versions higher than 2.2.X, a feature is defined such that the kernel
automatically creates a network route for a connected on the basis of the assigned IP address.
Here, only IP forwarding service has to be enabled. If the Linux machine is running, IP
forwarding service can be enabled by issuing the command: echo “1” > /
But if the service has to be enabled during startup, then the configuration should
be as follows:
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
#replace the value “0” with “1”
Gateway is the device through which all the machines on a network communicates
with other machines on other network. Gateway is defined in the file “/etc/sysconfig/network”.
The command “hostname” returns the host name assigned to the computer. But if “hostname
[new host name]”, is given then the host name is changed. It is valid only for the current session.
For making the host name permanent, it is to be defined in the file “/etc/sysconfig/network”, so
that the kernel looks up in this file to determine the host name.
Binding Multiple IPs:
Assigning multiple IPs to a single device is known as IP aliasing. In order to do IP
aliasing, a file /etc/sysconfig/network-scripts/ifcfg-eth0:0” is to be created if the network card
is at “eth0” .
After making the changes in the file, issue the command:
service network restart or ifdown eth0; ifup eth0
Then on issuing ifconfig command, minimum 3 active interfaces are shown i.e. lo,
eth0 and eth0:0. In order to define the range of IPs for a single network device,
# vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
#ifdown eth0
#ifup eth0
Name Resolution:
It is the process of resolving IP address of a host on given host or domain name.
For the basic name resolution, a database of all the host in the network is to be maintained, which contains the respective IP address, full host name and host name in the file “/etc/hosts” as: localhost.localdomain localhost srv1 wks1 wks2

After the successful creation of the database, it is possible to communicate hosts
in the network via their host names and full host names apart from their respective IP
DNS Client Side Configuration:
Client machines should maintain a file “/etc/resolv.conf” which look up the
particular DNS server.
# vi /etc/resolv.conf
# service named restart
# nslookup –> returns the IP of the given domain name
# nslookup IP –> returns the domain name of the given IP address
The command “dig” can also be used to retrieve the detail information of the given
domain name or IP address.
Network Diagnosis Tools:
• ping <IP address> is used for checking network connectivity
• traceroute <IP address> is used for showing possible path to reach from current host to the specified host/ network via subnet (collection of routers)
• netstat provides network connectivity information of current

Unit – 18: System Administration Tools
Printer Administration:
CUPS (Common UNIX Printer System) is the default printing tool in Red Hat. The command “redhat-config-printer” is used for printer configuration.
lpd –> line printer daemon
lpq –> displays the printer queue status
lpr <filename> –> sends jobs at queue for printing
lprm –> used for removing printing jobs from the queue
lpc <options> –> printer daemon control utility
Task Automation:
The “at” command is used to execute a task at a specific time. In other words, it is useful for schedule a single future event.
Syntax: at <date|time>
at> command1
at> command2
ctrl + d
a) Weekday: Full or abbreviation (3 characters)
b) Month: Full or abbreviation (3 characters)
c) Day: 1-31
d) Year: 4 digits

a) today|tomorrow
b) HH:MM <am|pm>
c) HHMM <am|pm>
d) now, noon midnight
at 10:00am March 15
at now + 15 minutes

  • The “atq” command is used to view the status of commands at queue i.e. lists pending jobs.
  • The “atrm <job id>” is used to remove the jobs from the queue.
  • The superuser can control the usage of “at” command to other users using “/etc/at.allow” and “/etc/at.deny” by entering user names in those files.
  • The “cron” executes tasks at scheduled intervals. Its master configuration file is
  • “/etc/crontab”, where only the superuser can modify it.

Crontab File Format:
Minutes Hour Day of Month Month Day of Week Command|Shell scripts
(0 – 59) (0 – 23) (1 – 31) (1 – 12) (0 – 6)
* refers to any possible value
For running periodic system tasks, following files are used:
• /etc/cron.hourly
• /etc/cron.daily
• /etc/cron.weekly
• /etc/cron.monthly
The superuser can control the usage of “cron” to other users using “/etc/cron.allow” and
“/etc/cron.deny” by entering user names in those files.
$ vi test
* * * * * echo “hello” >> log
$ crontab test
$ tail – f log
Here, file “test” is scheduled for the cron process such that, hello is echoed to “log”
file at every minute and on issuing the very last command displays the continuous update in “log” file. But if the system is off during the scheduling time, the tasks will not be executed
on that time interval. In order to make it execute after the startup of the system, “anacron”
process is used. In other words, “anacron” run tasks after prescribed interval have passed. Its configuration file is “/etc/anacrontab”, which has the format as follows:
Interval (days) Delay (minutes) Label Command
7 10 weekly.tasks /usr/local/
here, the command “/usr/local/” is run after 10 minute delay, if it has been
7 days (or more) since its last execution.

The command “tmpwatch” cleans old files out of the specified directories.
Syntax: tmpwatch -[options] <hours> <directory>
tmpwatch 240 /tmp
cleans unused files since the last 10 days (24 X 10) from the /tmp directory

System Log Configuration:
Red Hat provides a central logging facility that allows all applications to store debugging information, errors and messages in a central, manageable place. System logging is maintained by two daemon processes: syslogd (for application-level messages) and klogd (for kernel-level messages). Their configuration file is “/etc/syslog.conf”, in which the first column defines the log type and second defines the location of the file. All the log files are stored in “/var/log” directory.

  • /var/log/messages –> standard system error messages
  • /var/log/messages –> kernel boot messages
  • /var/log/maillog –> mail system messages
  • /var/log/xferlog –> FTP transfers
  • /var/log/secure –> Security informations, system login and

network connections
The command “logrotate” controls the size of log file. After reaching certain log file “maillog” to its maximum size, a file is renamed as “maillog.1” and a new file named “maillog” is created. It is defined in “/etc/cron.daily/logrotate”.
System Monitoring:
top –> lists the process which are using resources in the interval of 5 seconds
vmstat –> displays status of virtual memory (swap)
free –> displays summary of system memory usage (RAM + swap)
ps –> diplays process and their status
Data Backup :
There are three types of data backup:

  • Full: Here, all the contents are backed up and keep records about the date and backup contents.
  • Incremental: After full backup, whatever new files are created or modified, all files are backed
  • up and their status are recorded.
  • Differential: After full backup, whatever new files are created or modified, all fiels are backed up but their status are not recorded.

Backup/ Archive Utilities:
tar –> flattens data for backup storage
dump –> copies file system data to backup device
options: “-u” updates the dump dates after backup
“-f <device>” refers to the backup device
“n” ranges from 0 to 9, where 0 refers to full backup while 1-9 refers to incremental backup.
# dump -0 u -f /misc/homeback /home
# dump -0u -f root@ /home

restore –> copies dumped backed up data into the file system
# cd /misc/restore
# restore -rf /misc/homeback
restore> add file1 file2
restore> extract file3
restore> quit
cpio –> copies files to/from archives
# find / -name *.conf | cpio -ocv /dev/nst0
# cpio -icv < /dev/nst0
Red Hat Package Manager (rpm)
rpm format: package-name.package-version.architecture.rpm
-i –> installs the package
-v –> verbose
-h –> displays hash symbol for the progress bar while installing or
-U –> upgrading the existing package
-e –> uninstalling the existing package
-q –> query
-f –> file
rpm -ivh package.rpm –> clean installation
rpm -Uvh package.rpm –> upgrade
rpm -q package –> query if the package is installed or not
rpm -e package –> uninstall the package
rpm -qa –> query all the existing packages
rpm -qf <filename> –> shows the respective package for the specified filename
rpm -ql package –> shows all the files associated with the specific package

Unit – 19: Kernel

Kernel Module Management:

  • The command “lsmod” lists the currently loading modules
  • The command “rmmod” unloads loadable module
  • The command “insmod” installs the loadable kernel module
  • The command “modprobe” installs the loadable kernel module with its dependencies

All the kernel modules reside in “/lib/modules/<kernel-version>” .  The directory name must match the kernel version as returned by “uname -r” command. The module
parameters are defined in “/etc/modules.conf”.
# uname -a
<major-version>.<minor-version>.<patch-level> – <extra-version>
If the minor version is even, it is a stable version whereas if it is odd, it is development version. Patch level changes frequently during the release of patches for a bug.
Kernel Compilation:
Kernel is compiled because
1) features those are not available in the current kernel
2) if new kernel release is available
3) to optimize a system performance
4) to disable non essential components for security reasons
In order to compile a new kernel, the source code of a new kernel is to be stored in
“/usr/src/linux-new-kernel-version.” The steps to be followed are as follows:
Download the latest version of kernel either from the Internet or other devices in”/usr/src/”
# cd /usr/src
# tar zxvf l inux- 2 .4.20-8.tar.gz
# cd /usr/src/linux-2.4
• Edit the file “Makefile” and change the extra version value
# vi Makefile
• Check an environment for compilation
# make mrproper
• Use any one of the following for the compilation options
# make config [for interactive view]
# make menuconfig [for console based]
# make xconfig [for GUI]
• Create dependencies list
# make dep
• Remove temporary files created during compilation
# make clean

Compile the kernel. After the compilation, the compressed kernel image can be found at
# make bzImage
• Install the kernel
# cp /usr/src/linux-2.4/arc/i386/boot/bzImage /boot/vmlinuz-2.4.20-8custom
• Compile the Kernel Modules, which generate modules used by kernel
# make modules
• Install the kernel modules. The new installed modules are now stored in
# make modules_install
• Create an initial ramdisks. It is necessary in case of SCSI or RAID system. The kernel needs to load the modules before a file system is present. They are stored in a ram disk image, called an initrd. The kernel can then load the modules from the ramdisk at a boot time.
# mkinitrd /boot/initrd-2.4.20-8custom.img 2.4.20-8custom
• When a kernel is compiled, a symbol table for the various kernel procedures is created and stored in a file “/usr/src/linux-2.4/”. Its copy is needed to interpret debugging information dropped by a kernel during a kernel panic, and should be stored along with the kernel.
# cp /usr/src/linux-2.4/ /boot/
• Copy the configuration file so that it can be useful in keeping track of which capabilities were enabled for which kernels.
# cp /usr/src/linux-2.4/.config /boot/config-2.4.20-8custom
• Update the file “/etc/grub.conf” , a boot loader configuration file as follows:
title Red Hat Linux (2.4.20-8)
root (hd0,2)
kernel /boot/vmlinuz-2.4.20-8 ro root=LABEL=/ hdd=ide-scsi
initrd /boot/initrd-2.4.20-8.img
title Microsoft Windows
rootnoverify (hd0,1)
chainloader +1
title Red Hat Linux Customized (2.4.20-8custom)
root (hd0,0)
kernel /boot/vmlinuz-2.4.20-8custom ro root=LABEL=/ hdd=ide-scsi
initrd /boot/initrd-2.4.20-8custom.img

Unit – 20: The Linux Quota System
Disk Quota is a space limitation for user or group in Hard Drive. The Linux Quota System is generally implemented in “/home”, where “/home” is mounted in a separate disk partition. The quota system can be implemented either in two ways: the disk space utilization and the number of inodes.
Edit “/etc/fstab” by adding usrquota or groupquota in /home partition as
/dev/hda3 /home ext3 defaults, usrquota 0 0
# mount -o remount /home
# cd /home
# touch quota.user
# chmod 600 quota.user
# quotacheck /home
# convertquota -u /home
# quotaon /home
# edquota -u user1 [assigns quota to user1]
# edquota -u user1 user2 [inheriting a quota property from user1 to user2]
# repquota -a [generates quota report]
There are two types of limits: soft and hard. If the number of size or file exceeds
soft limits, a user starts getting a warning. But on exceeding a hard limit, a user will not be able to add either the file size or number. For disabling a quota to a user, soft and hard  limit can be set to “0”.

Unit – 21: The X Window System
The Graphical User Interface (GUI) Environment or the X Window System is based on the client-server architecture. Xfree86 Project creates GUI environment for Linux. X protocol (port number 0)is used that enables to run a client side X Window System on a remote machine.
# redhat-config-xfree86 [used for detecting display devices and changes display settings]
# xhost [either grants or revoke permissions to the specific machine]
# xhost + [in]
# DISPLAY= [in]
# export DISPLAY [in]
Only GUI application can be used but not X Window Manager (KDE, GNOME, etc).
For the remote login in GUI, the following are the steps:
In machine (Server):
• Switch to run-level 3
# init 3
• edit the file /etc/X11/xdm/Xaccess and remove “#” before the line ….. and replace “*” by an IP
of specific machine so that only it can get the login window …….
• edit the file /etc/X11/xdm/xdm-config and put a comment “!” before the line as
In Machine (Client):
# X -query [displays X Window login of]
• # startx [is the command used to go in graphical mode in run-level 3]
• “ctrl+alt+back space” is to reset the display manager
• xfs i.e. X Font Server must be started to go in graphical mode

Unit – 22: Rescue Environment
There are several causes for not booting the Linux system.
• The MBR (master boot record) might be deleted or updated by other operating system
or disk partition utility.

• The Linux system may not be able to find a kernel image as per specified in the boot
• The Linux system may not be able to run the very first process “init” of pid “0” or read
file “/etc/rc.sysinit”.
• The Linux system may not be able to locate or read “/etc/inittab” file.The Linux system
may not be able to run the daemons of “/etc/rc.d/init.d” as per the specific run-level.
In either of the cases, user has to either define the location of the partition containing
kernel image (/boot) or go into rescue environment by using rescue disk or 1st
installation CD of Linux.

• The partitions may not exist as mentioned in the “/etc/fstab” file. In such case, the user will be prompted for superuser password and enables logging into the bash prompt, where the user can check the file system or edit “/etc/fstab” file.

• The Linux system may boot normally but will not be able to switch in graphical mode.
In such case, boot into the single user mode by appending “1” or “s” while passing
parameter for booting the system in boot loader.

Recovery Run-levels:
1: single run-level, single user mode where it processes files “/etc/rc.sysinit” and those in
“/etc/rc1.d” directory.
S, S, single: processes only “/etc/rc.sysinit” file.
emergency: it only prompts “su-” login and none of the script files.

Steps for going into rescue environment:
• Boot the machine using 1st installation CD and at the boot prompt,
boot: linux rescue [enables to determine the temporary environment for root partition]
• If the rescue environment finds Linux installation and determine root partition, it mounts
the system under the mount point “/mnt/sysimage”. This means all directories of root
partition will mount under “/mnt/sysimage”.
• The command “mknod” is available in rescue environment that creates device files (fd0, hd0 of /dev)
# mknod /dev/hda [for the disk in primary master]
• # fdisk -l [check the disk partition status; if altered use “fdisk /dev/hda” for making changes in the partition]
• #chroot /mnt/sysimage [change root partition to “/”]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.