rootsan technologies pvt ltd rhel linux 133
DESCRIPTION
Linux Training MaterialTRANSCRIPT
Installing Linux
© 2006 IIHT Limited
Module 1 – Installing Linux
Overview This module introduces you to the hardware and software terminology necessary to install a Linux operating system. The procedure for installing Linux and the necessary configuration settings are described.
Lessons Covered in this module 1. Performing Preinstall Evaluation 2. Performing Installation
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Performing Pre-install evaluation
Introduction Linux occupies less amount of space in a system. However, running a complete Linux system has certain hardware requirements that are discussed below.
Topics covered in this lesson 1. Hardware Compatibility2. Disk Partition Scheme3. Considerations of Dual Boot
Installing Linux
© 2006 IIHT Limited
Topic 1 – Hardware Compatibility
The installation of an operating system will have its own hardware requirements. The necessary hardware has to be checked for its compatibility with the operating system before installing it.
The hardware units required for installing Linux includes: 1. Central Processing Unit2. Memory (RAM)3. Drives4. Video or Graphics Card
Installing Linux
© 2006 IIHT Limited
Topic 2 – Disk Partition Scheme
Partitioning is one of the methods employed in securing a system.
Partitioning is dividing a single hard drive into many logical drives.
In case of partitioning a disk, if a file system gets corrupted then only the disk having the damaged file system gets corrupted.
Other partitions will not be affected by the damage caused by a file system.
Installing Linux
© 2006 IIHT Limited
Every distribution of Linux can be installed on only particular partitions of a hard disk and other partitions can remain untouched.
This ideally implies that Linux permits Microsoft Windows to coexist with it.
To consider a dual boot system for Linux, a computer should have one operating system already installed in it.
This means Linux should be installed last in a dual-boot system.
Topic 3 – Considerations of Dual Booting
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Performing Installation
Introduction Linux can be installed in a system through various methods. On a standalone system, the most convenient method is to install through a CD-ROM drive. Before installing Linux, it has to be ensured that the system meets all the requirements for installation.
Topics covered in this lesson1. Types of Installation Methods2. Starting Installation
Installing Linux
© 2006 IIHT Limited
Topic 1 – Types of Installation Methods
There are four methods available to install Linux on a system. They are:
CD-ROM Hard Drive Ask Method Kickstart
The installer called anaconda, is written in the scripting language Python
Installing Linux
© 2006 IIHT Limited
Topic 2 - Starting Installation
The first thing in installing Linux is booting off from the CD-ROM.
At the bottom part of the screen there will be a prompt, which will read as: boot:
If no key is pressed then the prompt will time out by itself and start the graphical installation process.
There are settings that have to be configured such as keyboard, mouse, disk partition etc
Installing Linux
© 2006 IIHT Limited
Conclusion SummaryLinux can be installed in a system that has other operating systems
like Windows
Minimum hardware requirement has to be met for installing Linux that includes CPU, Motherboard, Drives and Video cards
Linux can be installed by using several methods such as, CD-ROM, Hard drive, HTTP, NFS and Kickstart
Question and Answer session
Installing Linux
© 2006 IIHT Limited
Module 2 – Creating and Managing Users
Overview One should log into a Linux system with a valid user name and password granted to perform any task. In this module we learn about the users and their roles in the Linux system environment and utilities that can be used to create, modify, and delete user and group accounts on a Linux system.
Lessons covered in this module 1. The Root User 2. Creating and Managing User and Groups3. Configuring Sudo
Installing Linux
© 2006 IIHT Limited
Installing Linux
© 2006 IIHT Limited
Lesson 1 – The Root User
Introduction Root user also called super user, who has access to all resources to
which the other user will not have. Root user can modify the ownership and permissions of the files it does not own.
Topics covered in this lesson1. Who is a Root User?2. Role of Root user in System administration
Installing Linux
© 2006 IIHT Limited
Topic 1 - Who is a root User?
Root user is a user who has access to all the commands and files in Linux operating system
The root user is sometimes referred as super user or system administrator or administrative user.
The root user has full access to all software and hardware on the system.
The root user’s account is stored in the directory ‘/root’.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Role of the root User in System Administration
System administration designates a job position responsible for running a computer system.
Linux is a multi-user operating system identified by a user ID and password can make use of the computer system.
In Linux, the role of the root user in system administration includes: · User Management· System Maintenance· Managing Services· Performing Backups
continued…
Installing Linux
© 2006 IIHT Limited
Role of root in User Management
The root user has the rights to add or create a new user account into the system.
The root user has the rights to edit or modify and delete user accounts.
The root user sets the password aging policy to protect a user account.
The root user maintains the user accounts in the /home directory
The root users can modify, delete group accounts.
continued…
Installing Linux
© 2006 IIHT Limited
Role of root User in System Maintenance
Linux is a complex operating system when it comes to maintenance.
The root user should develop a test plan for each change in the system like mounting a directory, creating a new group.
The system administrator should communicate with the users about the changes after doing it or in advance.
continued…
Installing Linux
© 2006 IIHT Limited
Role of root User in Managing Services
Services can be controlled by GUI (graphical user interface) and CLI (command line interface) in Linux.
It is preferred to manage services in CLI in Linux.
The system administrator manages the software installation, upgrade of the software using Redhat Package Manger (RPM).
The root user configures Network File System, the standard UNIX file sharing protocol.
continued…
Installing Linux
© 2006 IIHT Limited
Role of root in Performing Backups
Data stored in a system is important because of the time it takes to create it.
So the system administrators will plan convenient methods to secure the data by taking backups.
The root user has to identify the important data and allocate space accordingly for storing the data.
Installing Linux
© 2006 IIHT Limited
Lesson -2 Creating and Managing Users and Groups Introduction User account is a resource with which a person can have access
to the system or in other words, accesses a system. A group of users who have the same action to perform are put into one group and a group account is maintained.
Topics covered in this lesson1. Creating or Adding Users2. User Private Groups3. Modifying Users4. Deleting Users5. Group Administration6. Switching Accounts7. Password Aging Policies
Installing Linux
© 2006 IIHT Limited
Topic 1 – Creating and Adding Users
New Users can be created or added by using the root privileges. There are three basic methods of adding users in Linux:
· The /etc/passwd file that contains information about every user in the system can be hand-edited to add a user.
· Use certain commands like useradd.
· Use the graphical front-end, the Red Hat User Manager
Continued..
Installing Linux
© 2006 IIHT Limited
Using Commands A new user is created or added by using the command-line utility
useradd.
The useradd command is located in the /usr/sbin directory.
A new user is added into the system by typing:
Syntax: # useradd usernameExample: # useradd jack
Installing Linux
© 2006 IIHT Limited
Using Graphical Front-end
Continued..
Installing Linux
© 2006 IIHT Limited
Using Graphical Front-end
Go to the Main Menu Button => System Settings => Users & Groups
Click on Add User and the do the following instructions.
Add the user name, full name of the user, password.
Click on OK and the user gets added to the system.
Installing Linux
© 2006 IIHT Limited
User Account Database
The account database consists of account information
Linux database has a standard file /etc/passwd for user accounts.
The /etc/passwd file has one-line information about every user on the system.
The /etc/passwd file consists of information on user and system accounts.
The rights to access /etc/passwd, has to be 644.
An entry into the file is in a defined syntax
Installing Linux
© 2006 IIHT Limited
Topic 2 - User Private Groups Red Hat Linux has a unique method called user private groups to ease
the management of user and groups.
Whenever a user is added to a Linux system, a user private group will be created.
The name of the user private group is same as the username and has the user as its only member.
This will permit the user’s umask to be set to 002 in /etc/profile.
The umask command is used in setting and finding out the default file creation rights on the system.
Installing Linux
© 2006 IIHT Limited
Topic 3 - Modifying User Accounts
User accounts can be modified manually and by using a command.
Manually, the user details can be edited in /etc/passwd file or the command, usermod is used to modify user account details.
· The syntax is: usermod [options] username
The following options can be used: -c <comment>
Installing Linux
© 2006 IIHT Limited
Modifying User Accounts using GUIGo to the Main Menu Button => System Settings => Users & GroupsRight-Click on Users and select the user who has to be modified Make the changes and click on OkUser Properties
Installing Linux
© 2006 IIHT Limited
Topic 4 – Deleting UsersGo to the Main Menu Button => System Settings => Users & GroupsClick on Users and select the user who has to be deleted. Click on delete.
Installing Linux
© 2006 IIHT Limited
Topic 4 – Deleting Users
The syntax for deleting is userdel username
For example: userdel sam deletes the user with the username, sam.
If it is required to remove the user account along with its home directory, then the option ‘-r’ is used.
The syntax is userdel –r username
For example: userdel –r sam will delete the user account sam along with its home directory.
Installing Linux
© 2006 IIHT Limited
Lab Exercises
In this lab you have to use useradd, usermod, and userdel commands to add, modify and delete user account by performing the following steps.
1. Create a user with following attributes User login name: John Name: John Mathew UID: 5000GID: IIHT Shell: /bin/bash 2. Change password for John to 123abcABC 3. Try to login with John 4. Delete the John account so that its home directory also removed.
Installing Linux
© 2006 IIHT Limited
Topic 5 - Group Administration
Group Administration means managing groups
New groups are added, existing groups are modified, group rights are set, and groups are deleted.
Groups as in the Red Hat User Manager
Continued..
Installing Linux
© 2006 IIHT Limited
Topic 5 - Group Administration
The file /etc/group provides group account information.
New groups may be generated by manually editing the file /etc/group or by using groupadd.
The syntax is: # groupadd groupname
To delete or remove groups, groupdel is used.The syntax is: # groupdel groupname
To change the name of the group, groupmod can be used. The syntax is: # groupmod –n newname oldname
Installing Linux
© 2006 IIHT Limited
Topic 6 - Switching Accounts In Linux, to change user without logging out, the command su (derived
from super user) is used.
The syntax for switching accounts using su command is:su [options] username
System administrators use this command frequently to become the root user without the user logging out.
When the account is switched, the password of the account has to be given unless you are logged in as root.
Installing Linux
© 2006 IIHT Limited
Topic 7 - Password Aging Policies Password aging means that after certain time, generally 90 days, the
user will be asked to replace his password with a new one.
As a method to secure passwords, password aging technique is used by system administrators .
Password aging prevents an intruder using the cracked password only for a certain amount of time.
There are two methods to set password aging.
One way is to use the command chage and the other using the graphical application User Manager.
Installing Linux
© 2006 IIHT Limited
Using command chage
First method is the use of chage command
The maximum period of time-of-validity of a password can be set before the system prompts the user to change his password.
The time given for password changes is usually guided by the security policy of an organization.
The minimum period of time also has to be set for a password to be in use.
The syntax is # chage [options] username
Installing Linux
© 2006 IIHT Limited
Using Graphical User Manager
Password Aging Policy
Continued…
Installing Linux
© 2006 IIHT Limited
Using Graphical User Manager
Use the graphical User Manager application to create password aging policies for a user.
· Go to the Main Menu Button => System Settings => Users & Groups
· Click on the Users tab, select the user from the user list, and click Properties from the button menu
· Then click the Password Info tab and enter Days before change required
Installing Linux
© 2006 IIHT Limited
Lesson 3 - Configuring sudo Introduction
sudo (superuser do) permits a system administrator to grant certain users (or groups of users) the permission to run some (or all) commands as root while logging all commands and arguments..
Topics Covered in this Lesson 1. Sudo configuration
2. Using sudo
Installing Linux
© 2006 IIHT Limited
Topic 1 - sudo Configuration
The command, sudo permits a user with proper permissions to execute a command as the superuser or other user.
The file /etc/sudoers controls the sudo access.
An editor and syntax checker, visudo edits the file /etc/sudoers.
sudo is easy to configure and is used in a straightforward syntax.
sudo commands use a basic syntax.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Using sudo
The sudo utility helps in overcoming this difficulty faced while managing a server or system by several people
The sudo utility permit users defined in the /etc/sudoers configuration file to have temporary access
The commands can be run as user "root" or as any other user as in the /etc/sudoers configuration file.
The privileged command to be run should first start with the word sudo followed by the command's regular syntax.
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 2 - Using sudo
For example
Installing Linux
© 2006 IIHT Limited
Conclusion Summary
A root user is a user who has access to all the resources that are restricted to other users.
A new user account is managed in the Linux database system by using command utilities or graphical front-end.
sudo (superuser do) is a program which can be used by normal users to execute programs as root user
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Installing Linux
© 2006 IIHT Limited
Module 3 – Understanding File Listing, Ownership and Permission
Overview In any operating system, there are files, whose access has to be limited only to certain users like owner of the file or users of a specific group etc. In order to make files secure and organized, file permissions have to be set.
Lessons Covered in this lesson1. Understanding File Listing, Ownership and Permission
Installing Linux
© 2006 IIHT Limited
Lesson 1 - Understanding File Listing, Ownership and Permission
IntroductionLinux is a multi-user system where users can assign different access permission to their files. Access permissions can be set per file for owner, group and others on the basis of read (r), write (w) and execute permissions (x).
Topics Covered in this Lesson 1. File Permissions and Access2. Types of Access3. Who has to Access to a File?4. Access Control Lists
Installing Linux
© 2006 IIHT Limited
Topic 1 – File Permissions and AccessFile permissions specifies about the details like who have the access
to file and what type of access the user has.
Each file is owned by a particular user. However, files are also owned by a particular group, which is a defined group of users of the system.
Types of permissions· r – read · w –write · x –execute
Installing Linux
© 2006 IIHT Limited
Topic 2 - Types of AccessIn Linux, every file or folder has access permissions.There are three types of permissions.
· read access · write access · execute access
Limitations of access permissions If the file is read only it cannot be writable and the directory should have
execution permission to open the directory.Example: -rw-r--r--
Installing Linux
© 2006 IIHT Limited
Default file permissions By default the linux system assigns certain permissions to a newly
created file.
Displaying the umask
Displaying the default umask value
Installing Linux
© 2006 IIHT Limited
Default file permissionsChanging the umask
To change the default umask use the commandSyntax
# umask <umask value> Example: umask 004
Installing Linux
© 2006 IIHT Limited
Textual representation of "-rwxr--r--" It consists of 10 characters. The first character shows the file type.
Next 9 characters are permissions, consisting of three groups: owner, group and others.
Each group consists of three symbols: rwx, if some permission is denied, then a dash "-" is used instead.
Example:-rwxr--r--
Installing Linux
© 2006 IIHT Limited
Numeric (octal) representation
If a numeric representation is used, then it is in the octal format with the base of 8, and digits involved are 0 to 7.
Octal format is used for the simplicity of understanding, every octal digit combines read, write and execute permissions together.
Respective access rights for owner, group and others are the last three digits of the numeric file permissions representation.
Here,‘1’ stands for execute only, ‘2’ stands for write only, ‘4’ stands for read only.
Installing Linux
© 2006 IIHT Limited
Difference in access permissions for files and folders
Difference in access permissions for files and folders
Installing Linux
© 2006 IIHT Limited
Topic 3 – Who has Access to a File?
The owner and the root have the main access rights over a file.
In the above example, the first column gives the access permissions to the user, group and others.
The second column shows the user or owner of the file. The third column shows the group to which the file belongs.
Installing Linux
© 2006 IIHT Limited
Topic 4 - Access Control Lists
An access control list (ACL) is an object that contains entries specifying the access that individual users or groups of users have to the file.
Using the chmod command the user can set permissions to owner, group or others.
Setting ACL using Setfacl: setfacl - set file access control lists
Installing Linux
© 2006 IIHT Limited
Topic 4 - Access Control Lists
Getting ACL using getfaclThe getfacl displays the file name, owner, the group, and the Access Control List (ACL). Syntax# getfacl <filename>
Snapshot showing getfacl
Installing Linux
© 2006 IIHT Limited
Topic 4 - Access Control Lists
Copying ACLThe acl’s can be copied to any files, for which the files get the same acl permissions from its source file. Syntaxgetfacl <acl filename> | setfacl --set-file= - <filename>
Installing Linux
© 2006 IIHT Limited
Lab ExerciseExercise : In this lab you have to use useradd, usermod,
chmod and chgrp commands to restrict the user to their department directory.
Perform the following steps.1. Create users, john, sam, tom, peter, joe, Mathew, and steve
2. Create the following groups with the group IDs as give below and use -g option Group GID ----- ----- sales 10000 hr 10001 web 10002Continued……
Installing Linux
© 2006 IIHT Limited
Lab Exercise
3. Add users to the following group by using usermod command with –G option a. add john, sam to sales group b. add tom and peter to hr group c. add joe and mathew to web group d. add steve to all group
4. Login as each user and use the id command to verify that they are in the appropriate groups
5. Create a directory called /depts with a sales, hr, and web directory with in the /depts directory.
Installing Linux
© 2006 IIHT Limited
Lab Exercise
6. Change group ownership of each directory to the group that matches with it.
7. Set the permission on the /depts directory to 755 and each subdirectory to 770.
8. Set the sgid bit on each departmental directory so that files created within those directory owned by the appropriate group.
9. Check by logging in as each user and creating or altering files in each of the directories. Only Steve should be able to enter all directories
Installing Linux
© 2006 IIHT Limited
Conclusion
SummaryFile permissions protect user files from accessing by other users
The file system can be accessed by the owner and has the control over the attributes and access to a file
A file attribute contains the basic and extended permissions that control access to the file
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 4 – Configuring Disk Devices Overview
This module deals with making partitions using fdisk, implementing RAID and Logical Volume Management. RAID is implemented in Linux systems to provide data redundancy. Logical Volume Management for making the file system management easy
Lessons in this module 1. Partitioning Using fdisk 2. Implementing RAID 3. LVM for Linux
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Partitioning using fdisk
IntroductionPartitioning is done using several utilities. One such utility is fdisk used for performing disk partitions. It is a tool that permits modifying the partitions already made on a hard drive. fdisk is the conventional tool for managing partitions.
Topics Covered in this Lesson1. Partition a disk by using fdisk
Installing Linux
© 2006 IIHT Limited
Topic 1 – Partition a disk using fdisk
fdisk is the utility used to partition a hard disk. While partitioning a disk, if fdisk is chosen; the next screen will
prompt you to select a drive to partition using fdisk
Installing Linux
© 2006 IIHT Limited
List of fdisk commands list of the fdisk commands
Installing Linux
© 2006 IIHT Limited
Creating Partition Creating partition can be started by running the command n.
Installing Linux
© 2006 IIHT Limited
Creating Partition
After running partprobe, run fdisk -1 to check the partitions.
Installing Linux
© 2006 IIHT Limited
Hex code (type L to list codes)
Running t command will give the range of partition numbers and type whichever partition has to be changed.
Installing Linux
© 2006 IIHT Limited
Hardware BrowserThe details of the partitions are done using the hardware browser.
Hardware browser can be seen by typing hwbrowser at a shell prompt.
Otherwise click on Main Menu =>System Tools => Hardware Browser
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Implementing RAID Introduction
RAID, an acronym for Redundant Array of Independent Disks or Redundant Array of Inexpensive Disks is a method of combining several physical disks to make a virtual disk. It is implemented in the system to increase performance, speed and increase the size and to provide data redundancy.
Topics Covered in this Lesson1. What is RAID?2. Various RAID levels3. Implementation of RAID
Installing Linux
© 2006 IIHT Limited
Topic 1 - What is RAID?
RAID is an acronym for Redundant Array of Inexpensive Disks or Redundant Array of Independent Disks.
It is called an array of independent disks because even if one disk gets damaged the data can be retrieved from other
The function of the other disks does not get affected.
It is a method of creating one virtual disk by putting together several physical disks.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Various Levels of RAID
There are various levels of RAID as listed below∙ RAID Level 0 ∙ RAID Level 1∙ RAID Level 2∙ RAID Level 3∙ RAID Level 4∙ RAID Level 5∙ RAID Level 6∙ RAID Level 7∙ RAID Level 0+1∙ RAID Level 1+0
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
The RAID virtual device should be created using the command mkraid in Enterprise Linux 3 and mdadm in Enterprise Linux
For example, consider Implementing RAID level 5
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 3 – Implementing RAID
Continued…
Installing Linux
© 2006 IIHT Limited
Corrupting one of the partitions in the RAID device
Installing Linux
© 2006 IIHT Limited
Adding the partition to the RAID array
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise Software RAID
Configure the lab by performing the following instructions: 1. Create three partitions 100M each and partition type (0*fd) 2. Create a software raid with the help of these partitions 3. Create one directory test0 and mount your raid partition under this
directory 4. Give entry in fstab file so that your RAID partition gets mounted at the
boot time 5. Try to remove one of the three partitions and then add new partition to
it
Installing Linux
© 2006 IIHT Limited
Lesson 3 – LVM for Linux
IntroductionLinux has support for Logical Volumes that makes the file system management easy. The Linux Logical Volume Management will introduce an abstraction layer between the physical disk and the file system.
Topics covered in this lesson1. Logical Volume Management or LVM2. Implementing LVM3. Advanced Concepts of LVM
Installing Linux
© 2006 IIHT Limited
Topic 1 - Logic Volume Management or LVM LVM stands for logical volume management and is a hard disk drive
partitioning scheme
There are two version of LVM for Linux and they are, LVM1 and LVM2
The following terms are associated with LVM∙ Physical Volume (PV ∙ Physical Extent (PE)∙ Logical Extent (LE)∙ Logical Volume (LV)∙ Volume Group (VG)
Installing Linux
© 2006 IIHT Limited
Topic 2 – Implementing LVM The steps that have to be performed for implementing LVM are as
given below:
1. Initializing disks or disk partitions
2. Creating a volume group
3. Creating a logical volume
4. Extending a logical volume
Installing Linux
© 2006 IIHT Limited
Topic 3 – Advanced concepts of LVM
LVM has built-in support for striping and mirroring and can be used with hardware or software RAID to offer configurable, fast and reliable disk storage
LVM Snapshots∙ The built-in support for mirroring also offers the concept of snapshots.
∙ Snapshots of immediate mirrors of logical volume are taken onto free space within the volume group.
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise Creating Logical Volume ManagerCreate LVM by performing the following instructions:
1. Create three partitions, each with 100M size and partition type (0*8e) 2. Create a volume group name IIHT 3. Create logical volume space 40M name data 4. Extend your logical volume up to 60M 5. Extend your volume group up to next partition 6. Remove your LVM configuration
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
fdisk is a utility to create partitions. Using fdisk, it is possible to create a partition and also delete a partition
RAID is implemented to copy data and spread blocks of a file across several disk drives.
LVM provides support to manage file system easily.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 5 – Creating and Managing File Systems Overview
This module deals with the structure of the file system, the standard types of file system in Linux. This module also deals with the file system structure, mounting file system and unmounting file systems and disk quotas.
Lessons covered in this module 1. File System Structure2. ext2 and ext3 File System3. Creating File Systems4. Checking File Systems 5. Mounting and Unmounting File Systems6. Disk Quotas
Installing Linux
© 2006 IIHT Limited
Lesson 1 – File System Structure
IntroductionA file system is a data structure which interprets the physical sector of a disc into logical directory structure. The logical structure will help computers and users to trace files. The file system registers the location of the files and directories on the disc
Topics Covered in this Lesson1. What is File System Structure2. File System Hierarchy Standard3. Special File Locations under Red Hat Linux Standard
Installing Linux
© 2006 IIHT Limited
Topic 1 – What is File System Structure
The file system structure is the most basic level of organization in an operating system.
A file system is an organization of storage space intended to contain files in directories. Providing a common file system structure ensures users and programs are able to access and write files.
File Systems are divided into two categories:Static and dynamic files.
Continued…
Installing Linux
© 2006 IIHT Limited
The Virtual File System (VFS)
Continued…
Installing Linux
© 2006 IIHT Limited
Topic 2 – File System Hierarchy Standard
Linux Directory Structure
• Red Hat Enterprise Linux uses the File System Hierarchy Standard (FHS) file system structure
Installing Linux
© 2006 IIHT Limited
Topic 3 – Special File Locations under Red Hat Linux Standard
Red Hat Enterprise Linux has made an extension of FHS structure slightly to contain special files.
Files related to RPM (Red Hat Package Manager) are placed in the /var/lib/rpm directory.
The /var/spool/up2date/ directory holds files used by Red Hat Update Agent..
The /etc/sysconfig directory is also specific to Red Hat Enterprise Linux.
Installing Linux
© 2006 IIHT Limited
Lesson 2 – ext2 and ext3 File system
IntroductionLinux supports several file systems but the most commonly used was the Second Extended or ext2 file system. Now the ext2 file system has been replaced by Third Extended or ext3 file system, which is a journaling version of ext2 file system.
Topics covered in this lesson1. Second extended or ext2 File System2. The ext3 File System3. ext2 and ext3 File System Attributes
Installing Linux
© 2006 IIHT Limited
Topic 1 – Second extended or ext2 File System
In Linux, the ext2 file system or second extended file system was the file system by default.
It supports partitions that are up to 4 terabytes or 4096 Gigabytes in size and a file of up to 2 Gigabytes in size. Physical layout of the ext2 File System
Installing Linux
© 2006 IIHT Limited
The ext2 Inode• In the ext2 file system, the inode is the basic building block; every file and directory in the file system is described by one and only one inode
Installing Linux
© 2006 IIHT Limited
ext2 Directories
In the ext2 file system, directories are special files that are used to create and hold access paths to the files in the file system
Installing Linux
© 2006 IIHT Limited
Topic 2 – The ext3 File System
This is the third extended file system, ext3 is used by Linux currently and it is a journaling file system.
Journaling file system keeps temporary data in a new location, unrelated to the permanent data and metadata on disk.
ext3 file system is an enhanced version of the ext2 file system
There are several advantages of ext3 File system over ext2 file system
Installing Linux
© 2006 IIHT Limited
Topic 3 - ext2 and ext3 File System Attributes Besides to the UNIX-derived modes of permission, the ext2 file system
structure gives a few data controls or attributes. To enable file attributes, the following command is used:Chattr +|-| = [attribute…] file [file….]
Some of the attributes given below may be enabled:A when a file is modified, its atime record is not modified.D the file is skipped for backup by dump.
Installing Linux
© 2006 IIHT Limited
Lesson 3 – Creating File Systems
IntroductionFile systems are created on the partitions. The partitions have to be created before creating a file system. By default ext2 file system is generated when the ‘make file system’ command is used. But now ext3 is the file system by default
Topics Covered in this Lesson1. Creation of an ext2 File System2. Creation of an ext3 File System3. Conversion of ext2 to ext3 File System
Installing Linux
© 2006 IIHT Limited
Topic 1 - Creation of an ext2 File System
mkfs is a standard utility used in creating file systems. By default mkfs creates ext2 file system. The command given below will create an ext2 file system.
[root@localhost ~]# mkfs /dev/hda1
The above command when executed will create an ext2 file system on the first primary partition and on the first IDE hard drive
Installing Linux
© 2006 IIHT Limited
Topic 2 - Creation of an ext3 File System
Installation of Red Hat Linux will use ext3 for all file systems by default. After partitioning a hard disk, an ext3 file system can be created by using the command [root@localhost ~]# mkfs –j ext3 /dev/hda1
This command will generate an ext3 file system on the first partition and on the first IDE hard drive
Installing Linux
© 2006 IIHT Limited
Topic 3 - Conversion of ext2 to ext3 File System
Converting an ext2 file system into an ext3 file system can be done using root privileges and the below commandtune2fs –j <file system>
For example, tune2fs –j /dev/hda7
The command df is run that will display mounted file systems. After running the above commands, the partition type has to be changed from ext2 to ext3 in the /etc/fstab file.
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise 1 Creating PartitionIn this lab you have to create a 100M partition with ext2 file system by using fdisk and then convert ext2 file system to ext3 file system.
Installing Linux
© 2006 IIHT Limited
Lesson 4 – Checking File Systems
IntroductionFile systems needs to be maintained and periodic checks have to be performed on the file systems. This is one of the tasks of the system administrator. Linux has a utility that checks and repairs the file system at every reboot and performs the process quickly
Topics covered in this Lesson1. Maintaining File Systems
Installing Linux
© 2006 IIHT Limited
Topic 1 - Maintaining File Systems
System administrators’ tasks include maintaining file systems periodically.
Checking File Systems· The utility fsck which means ‘file system check’ is used generally to
check and repair file system
Installing Linux
© 2006 IIHT Limited
File System LabelsThe e2label command is used to view what the ext2 label is by indicating
the raw device for the file system.
[root@localhost ~]# e2label /dev/hda2/usr
A new label can be set using the command given below[root@localhost ~]# e2label /dev/hda5 /iiht
After setting labels, the mount command can be used with labels and it will mechanically trace the proper underlying device.
For example: # mount LABEL=/iiht /iiht
Installing Linux
© 2006 IIHT Limited
Lesson 5 – Mounting and Unmounting File Systems
IntroductionMounting a file system is instructing the operating system to make a file system available for use at a particular location. That particular location is called mount point. When the user no longer uses this file, then that file system should be unmounted
Topics Covered in this lesson1. Mounting File Systems2. Unmounting File Systems
Installing Linux
© 2006 IIHT Limited
Topic 1 – Mounting File Systems
A file system is mounted on a directory so that it is accessible to the users
A file system is mounted on a directory so that it is accessible to the users
Using the mount commandThe basic command used [root@localhost ~]# mount device directoryIf options are used then: [root@localhost ~]# mount <options> device directory
Installing Linux
© 2006 IIHT Limited
Topic 2 – Unmounting File Systems
Linux will allow only the file systems that are not in use to be unmounted.
The command used to unmount a file system is:[root@localhost ~]# umount device directory where directory is the directory to be unmounted.
Note: the command used is spelt as umount and not unmount
Installing Linux
© 2006 IIHT Limited
Lesson 6 – Disk Quotas
IntroductionIn a multi-user system environment, it is very common to have problems like some users utilizing disk space more than they require. This problem can be completely rectified by using Disk Quotas feature of Linux.
Topics Covered in this lesson 1. What are Disk Quotas?2. Implementing Disk Quota3. Disk Quota Settings Configuration4. Managing Disk Quotas
Installing Linux
© 2006 IIHT Limited
Topic 1- What are Disk Quotas?
In a multi-user environment, problems such as some users utilizing more than required space persists and this can be rectified by many methods.
These methods include requesting the users to utilize some amount of space as required by them and disk quotas.
The disk quota is a successful method of Linux that permits the system administrator to distribute amount of disk space.
Assigning disk quotas is flexible and is implemented per file system.
Installing Linux
© 2006 IIHT Limited
Topic 2 – Implementing Disk Quotas
Disk quotas can be established by inodes or by blocks on user or group levels.
The procedure involved in the configuration of disk quotas is as given below:
· The file system should be mounted with the usrquota and (or) or grpquota option.
· Quota configuration files, aquota.user and aquota.group· Kernel support for disk quotas should be made active · Allocate user and (or) or group quotas as proper through the edquota
command
Installing Linux
© 2006 IIHT Limited
Topic 3 – Disk Quota Setting Configuration
Disk quotas can be created, modified and eliminated by using edquota command.
For example: [root@localhost ~]# edquota user1
The above command will start vi editor on a transient text file.
The values are to be modified in the proper column and the user can exit the file after saving it
Installing Linux
© 2006 IIHT Limited
Topic 4 – Managing Disk Quotas
Managing and checking disk usage of a file system can be done using commands:· quotacheck· repquota · quota
The reliability of the quota database is verified by using the quotacheck command
The repquota command will make a summarized report of disk quota usage on the system
The quota command is used to check quota usage on a system-wide
Installing Linux
© 2006 IIHT Limited
Topic 4 – Managing Disk Quotasquota report of partition /dev/hda10
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise - Implementing Disk QuotaIn this lab you have to create a partition and implement a disk quota on
that partition. You have to perform the following steps: Create a partition and mount that partition with usrquota option Enable the quota on that partition Create a user test1 password test1 Set the (number of file ) soft and hard limit for user test1 to 3 and 5
Installing Linux
© 2006 IIHT Limited
Conclusion Summary
File System Structure is the fundamental level of organization in an operating system
File system is created using mkfs i.e. ‘make file system’ command.
Mount and umount commands are used to mount and unmount file systems respectively
The disk quota is a successful method of Linux for allotting disk space
Question and Answer session
Installing Linux
© 2006 IIHT Limited
Module 6 – File System Backup Overview
This module deals with the causes for data loss and data corruption, performing backups using backup tools and restoring them. The setting up of automation processes are discussed in this module, by using automation tools such as at and cron.
Topics covered in this Lesson1. Causes for Loss or Corruption of Data2. Using Backup Tools3. Task Automation
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Causes for Loss or Corruption of Data Introduction
In a computer, data can be lost due to several factors and it cannot be ensured that the data would be safe without taking proper measures. Data could be lost due to failure in hardware, software. environmental issues and human errors
Topics covered in this Lesson1. Loss and Corruption of Data Caused by Hardware2. Loss and Corruption of Data Caused by Software3. Environmental causes for Data Loss and Corruption4. Human Errors
File system Backup
© 2006 IIHT Limited
Installing Linux
© 2006 IIHT Limited
Topic 1 - Loss and Corruption of Data Caused by Hardware
Loss and corruption of data due to hardware is very easy to figure out But it is more complex to figure out the nature of hardware failure. It is always advisable to have spare hardware to replace the defective
hardware. It is also good to have service contracts so that whenever hardware
problems occur.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Loss and Corruption of Data Caused by Software
Loss of Data can happen due to two reasons: · Operating system · Applications
Data loss due to Operating System Failure · Operating systems failure can destroy the data that the computer
was running at the time of failure. · Operating systems failure can happen from crashes and hangs
Installing Linux
© 2006 IIHT Limited
Topic 2 - Loss and Corruption of Data Caused by SoftwareData loss due to Application Software Failure
· Application software failures do not have devastating effect on the productivity of the computer and the damage is relatively less
·
· Based on application, a single application failure can have an impact on a single user.
· But if it happens to be a server application providing service to several client applications, then the effect of failure would be too much.
Installing Linux
© 2006 IIHT Limited
Topic 3 - Environmental Causes for Data Loss and Corruption
The data will be lost sometimes despite the hardware and software running in good condition.
This may be due to physical environment in which the system is placed.
The environmental causes can be classified into four kinds: · Building · Electricity· Air Conditioning and Ventilation· Weather and the outside world
Installing Linux
© 2006 IIHT Limited
Topic 4 – Human Errors
Human errors also cause computer errors that may result in data loss.
The common kinds of human errors are: · End-user Errors· Operations Personnel Errors· System Administration Errors· Service Technician Errors
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Using Backup Tools Introduction
In Linux, backups are about packaging and unpackaging files as configuration files and kernels are mostly system independent. File systems are taken as backups as unforeseen disasters can happen and the data can be lost.
Topics covered in this Lesson 1. Tar2. Cpio3. Dump and restore4. Compression Tools
Installing Linux
© 2006 IIHT Limited
Topic 1 - Tar
The tar utility is popular among Unix system administrators.
To perform the backup of files use the following command Syntax tar –cvf <destination> < source>Example: tar –cvf /backup/home.back /home
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise - Performing backup with tarIn this lab you have to take a backup with tar. Create a directory name IIHT and some files named p1, p2, p3 and p4. Take the backup of the IIHT in newly created sam folder with name as backup. Create one folder name John and restore your backup in that folder.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Cpio
Cpio, a conventional Unix program can be used to back up the file systems.
The syntax is, cpio flags [options]
Syntax for creating the cpio filefind (source file name) | cpio –(options) > (target file name)
Example: find file1 | cpio -o > file1_back.cpio
Syntax for extracting the cpio filecat <source file name> | cpio –(options)
Example: cat file1_back.cpio | cpio –idvm
Installing Linux
© 2006 IIHT Limited
Topic 3 – Dump and restore
dump and restore commands are the two different programs that are included in the dump package
To backup the directory into a file use the dump commandSyntaxdump - <dump levels> - <options> <destination name> <source name>Example:dump -0 –f /home_dumps/mydumps /home
Continued..
Installing Linux
© 2006 IIHT Limited
Usage of dump command
Installing Linux
© 2006 IIHT Limited
restore
The restore command is used to view and restore the dump file. Syntax
# restore - <options> <file name>Example:restore –if mydumps restoration of the dump file
Installing Linux
© 2006 IIHT Limited
Topic 4 - Compression Tools
Compression tools are used for performing backups.
There are several compression tools available in Linux and they are: · zip· unzip· gzip· gunzip· bzip2· bunzip2
Installing Linux
© 2006 IIHT Limited
Lesson 3 – Task Automation
IntroductionTask automation commands are required to run during non working hours as it will not interrupt usual business hours. The at daemon (atd) and cron daemon (crond) can be used for scheduling commands
Topics covered in this lesson1. At2. Cron
Installing Linux
© 2006 IIHT Limited
Topic 1 - At
To run processes at a particular time, the at utility can be used.
The at daemon, atd can be used for scheduling a command to run once in the future
There are two access control files created to identify the users, to use the at command and they are:
/etc/at.allow /etc/at.deny
Installing Linux
© 2006 IIHT Limited
Topic 2 - Cron
Tasks can be scheduled to run without being attended through the cron command.
Error messages or output that have not been readdressed anywhere, are emailed to the user who did the task submission.
Tasks can be scheduled to run without being attended through the cron command.
There are two access control files that restrict users to use cron command and they are:
/etc/cron.allow /etc/cron.deny
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
There are four different kinds of causes for data loss , which are hardware-related, software-related environmental and human errors
File systems are taken as backups using tools such as tar, cpio, dump and restore, and compression tools
The at and cron commands are used to schedule a task.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 7 – Linux Boot Loaders
OverviewA boot loader is a small program that exists in the system and loads the operating system into the system’s memory at system boot. This module deals with two most popular boot loaders of Linux, LILO and GRUB.
Lessons Covered in this module1. Lilo Loader2. Grand Unified Boot Loader
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Lilo Loader
IntroductionLILO or Linux Loader is a boot loader for Linux. A boot loader is a small program that exists in the system and loads the operating system into the system’s memory when the system boots. Boot loader also starts the operating system.
Topics Covered in this lesson1. LILO, the Boot Loader2. Configuring LILO
Installing Linux
© 2006 IIHT Limited
Topic 1 – LILO, the Boot LoaderLILO is a flexible boot loader for Linux, which is independent of a file
system.
LILO loads itself into the computer’s memory in two stages
Stage1 – This stage, also known as primary boot loader is read into memory by the BIOS from the master boot record
Stage 2 - This stage, also known as secondary boot loader is read into memory and it displays the Red Hat Linux initial screen
Installing Linux
© 2006 IIHT Limited
Topic 2 – Configuring LILO
To install LILO, it is necessary to know the location of /boot partition.
It is also necessary to know the location of other installed operating systems
LILO can be installed for the first time using a shell script named QuickInst
LILO can be uninstalled using the lilo –u command
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Grand Unified Boot Loader
IntroductionGrand Unified Boot loader or GRUB is a boot loader which operates like LILO and it is presently the default boot loader. GRUB sets the user to select the operating system or kernel to be loaded when a system boots up. It also permits the users to pass arguments.
Topics covered in this lesson1. GRUB, Grand Unified Boot Loader2. GRUB Installation and Configuration3. GRUB and the Boot Process
Installing Linux
© 2006 IIHT Limited
Topic 1 – GRUB, Grand Unified Boot Loader
GRUB an acronym for Grand Unified Boot loader, is a program or boot loader.
It lets the user to pass arguments to the kernel GRUB will install a boot loader to the MBR
GRUB will permit to set particular instructions in the MBR.
These instructions also include passing special instructions to kernel when they boot or find system parameters before system boot.
Installing Linux
© 2006 IIHT Limited
Some of the important features of GRUB
GRUB has the provision of a true command-based, pre-OS environment on x86 machines.
This will help the user in being more flexible in loading operating systems with denoted options or collecting information about the system
GRUB will support Logical Block Addressing (LBA) mode
ext2 partitions can be read by GRUB.
Installing Linux
© 2006 IIHT Limited
Topic 2 – GRUB Installation and Configuration
GRUB can be installed during installation and also post installation..
GRUB Configuration
When Grub is installed two configuration files are created and they are
· /boot/grub/grub.conf is the configuration file of GRUB.
· /etc/grub.conf is a link file to /boot/grub/grub.conf and the user can make the configuration changes here
Continued..
Installing Linux
© 2006 IIHT Limited
Sample copy of Grub.conf file
Installing Linux
© 2006 IIHT Limited
Topic 3 - GRUB and the Boot Process Grub gets loaded into the memory of the system in the following
stages:
1. The Stage 1 or primary boot loader is read into memory by the BIOS from the master boot recorder (MBR).
2. The Stage 1.5 boot loader is read into memory by the Stage 1 boot loader if required.
3. The Stage 2 or secondary boot loader is read into memory.
4. The secondary boot loader will read the operating system or kernel and the contents of /boot/sysroot/ into memory
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
LILO, the Linux loader is the boot loader for Linux which boots the operating system whenever the system boots
The configuration file of LILO is maintained in /etc/lilo.conf file
GRUB, an acronym for Grand Unified Boot loader is the most commonly used boot loader for Linux
Red Hat Linux has /boot/grub/grub.conf as the configuration file.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 8 – Managing Software using RPM Overview
In Linux, Red Hat Package Manager referred as RPM is a tool used for managing software packages and its main function is to permit the installation and deletion of software packages. This module deals with the installation, verification and deletion of software using rpm.
Lesson covered in this lesson1. Installing Software2. Viewing Software3. Removing Software
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Installing Software Introduction
Red Hat Package Manager referred as RPM is a tool or in Linux for software package management that is used to maintain a database of software and their files. RPM is used to install software .
Topics covered in this lesson1. Red Hat Package Manager 2. Installing Software through Command Line Interface3. Installing Software through Graphical Method
Installing Linux
© 2006 IIHT Limited
Topic 1 – Red Hat Package Manager
Red Hat Package Manager, referred as RPM is a tool in Linux for software package management .
A RPM file comprises of all the files essential for running a specific program, and the important scripts to carry out the installation on its own
The RPM tool carries out common management of all the RPM packages, which are installed on a particular host
Installing Linux
© 2006 IIHT Limited
Topic 2 - Installing Software through Command Line Interface
RPM packages are installed using the –i option to the rpm command.
For example if the package, bash-3.0-18.src.rpm has to be installed then the below command can be given.
[root@localhost ~]# bash-3.0-18.src.rpm
Conventionally –i option is also used with –v option that makes rpm to be more verbose.
The –h option makes rpm to display progress meters as given below# rpm -ivh evolution-2.0.4-6.src.rpm
Installing Linux
© 2006 IIHT Limited
Topic 3 - Installing Software through Graphical Method
To install new software using Graphical method, go to Main Menu =>Systems and Settings=>Add or Remove Packages
Package Management
Installing Linux
© 2006 IIHT Limited
Topic 3 - Installing Software through Graphical Method
Select the RPM check box that has to be updated and click on Update Package Details
Installing Linux
© 2006 IIHT Limited
Topic 3 - Installing Software through Graphical Method
This will display the Completed System Preparation panel. Click on Continue Completed System Preparation
Installing Linux
© 2006 IIHT Limited
Topic 3 - Installing Software through Graphical Method
Updating System
Installing Linux
© 2006 IIHT Limited
Topic 3 - Installing Software through Graphical Method
After updating, it will ask for the disk to install the software package. To continue with it, insert a disk and click on OKDisk needed to install packages
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Viewing Software
IntroductionOnce the software is installed, enquiry can be made on the software package and check whether the RPMs are installed. This process is querying.
Topics Covered in this lesson1. Querying the Software Package2. Verifying the Installed Software Package
Installing Linux
© 2006 IIHT Limited
Topic 1- Querying the Software Package
The enquiry of the installed software packages can be done using the command
[root@localhost ~]# rpm –q
If the details about the software package i.e. name, version and release number of the installed software package has to be displayed, then the following command can be run.
[root@localhost ~]# rpm –q <software package>
Installing Linux
© 2006 IIHT Limited
Topic 2 – Verifying the Installed Software Package The software package that is installed has to be checked whether the
installation has been successfully or not. So verification is done.
The command used to verify a software package is [root@localhost ~]# rpm –V
To verify a software package having a specific file:[root@localhost ~]# rpm –Vf /usr/home/user1
To verify all installed software packages:[root@localhost ~]# rpm – Va
Installing Linux
© 2006 IIHT Limited
Graphical Method to Verify the software package
Click on Main Menu =>Systems and Settings=>Add/Remove Packages and click on the software installed and click on Details.
Package Management
Installing Linux
© 2006 IIHT Limited
Graphical Method to Verify the software package
Check the RPMs whose check boxes are enabled. Package Management Package Details
Installing Linux
© 2006 IIHT Limited
Lesson 3 – Removing Software
IntroductionSoftware can be removed or uninstalled using RPM. The software, which is not in use currently, has to be removed so that the space occupied by it is saved for other programs. Software can be uninstalled using RPM on a command line interface and on a graphical interface as well.
Topics covered in this Lesson1. Uninstalling Software using RPM
Installing Linux
© 2006 IIHT Limited
Topic 1 – Uninstalling Software using RPM
Software applications can be uninstalled using the -e option to the rpm command:][root@localhost ~] # rpm -e <software name>
[root@localhost ~] #
Only the name of the software package is used when the software has to be uninstalled.
Installing Linux
© 2006 IIHT Limited
Graphical method of Uninstalling Software
Click on Main Menu =>Systems and Settings=>Add or Remove Packages.
Click on Details on the software that has to be installed.Add/Remove Programs
Installing Linux
© 2006 IIHT Limited
Graphical method of Uninstalling SoftwareUncheck the check boxes of the software package and this way the
software can be uninstalled from the system. Package Details
Installing Linux
© 2006 IIHT Limited
Conclusion Summary
Red Hat Package Manger, RPM is helpful in the management of software in the database
While installing the software RPM traces whether the software required for software being installed is in the database or not
When software is installed, it can be queried and the details about the rpms can be seen.
Software that is not currently used has to be removed or uninstalled
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 9 – Kernel Administration
OverviewThe innermost layer of Linux operating system is the kernel, which is a thin layer of software between hardware and software applications. This module deals with the kernel source structure, loading and unloading of kernel modules.
Lessons covered in this module 1. The Linux Kernel Source Structure2. Loading and Unloading Kernel Modules3. Compiling and Building Custom Kernels
Installing Linux
© 2006 IIHT Limited
Lesson 1 – The Linux Kernel Source Structure
IntroductionThe innermost layer of Linux operating system is the kernel, which is a thin layer of software between hardware and software applications. Kernel has many directories and the structure of the Linux kernel source has to be understood as it helps in knowing various processes performed by the system.
Topics covered in this lesson1. Linux Kernel Source Structure2. Referring a Kernel Source Structure
Installing Linux
© 2006 IIHT Limited
Topic 1 - Linux Kernel Source Structure
Linux distributions such as Red Hat and Debian include the Kernel sources in them.
The Linux kernel that gets installed on a Linux system is made from the Kernel sources included in the Linux distributions.Linux Kernel Source
Installing Linux
© 2006 IIHT Limited
Topic 2 - Referring a Kernel Source Structure
To refer a Linux kernel the following subtopics will be a guide:
System Startup and Initialization Memory Management Kernel PCI Interprocess Communication Interrupt Handling Device Drivers File Systems Network Modules
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Loading and Unloading Kernel Modules
IntroductionLinux is a monolithic kernel or in other words it is a large program in which all the functional components of the kernel have access to all of its internal data structures and routines. Linux kernel modules can be loaded or unloaded into the kernel as per the requirement.
Topics Covered in this module 1. Kernel Version2. Loading and Unloading Kernel Modules
Installing Linux
© 2006 IIHT Limited
Topic 1 – Kernel Version
fresh versions of the kernel are constantly made available, which will offer better support for devices and for an efficiently running system.
Linux kernel will have a version number that has three parts as given below
major number- The major number will increase when the kernel has major changes.
minor number- The minor number defines stability.
revision number- The revision number will refer to the corrected versions.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Loading and Unloading Kernel ModulesA Linux kernel has components known as Modules that can be loaded
and added to it as required.
The modprobe command is a common command, which calls insmod command for loading modules and rmmod for unloading modules
modprobe command- Manual installing a module can be done using the modprobe command and the module name
Installing Linux
© 2006 IIHT Limited
Lesson 3 - Compiling and Building Custom Kernels
IntroductionA custom kernel is a kernel that is built with a configuration file other than the given generic configuration file.
Topics covered in this lesson1. Building Custom Kernels2. Compiling Custom Kernels
Installing Linux
© 2006 IIHT Limited
Topic 1 – Building Custom Kernels
Building custom kernels involves building the kernel file and kernel modules.
Configuring the Custom or New Kernel
· Configuration is the most tedious and essential part of building a custom kernel.
· During configuration, the hardware, file systems and other features that will be supported by the kernel, are decided
Building a Custom Kernel Building a custom kernel is done by carrying out the tasks as root
Installing Linux
© 2006 IIHT Limited
Topic 2 – Compiling the Custom Kernels
After building a custom kernel, it has to be installed and compiled on the system.
The steps involved in compiling a custom kernel are: 1. make modules _install has to be used for installing the kernel
modules
2. make modules _install has to be used for installing the kernel modules
3. Verification has to be made on the custom kernel
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
Kernel is the innermost core of the operating system that is a thin layer between hardware and software applications
The Linux kernel source structure can be referred to know about the system functions
A kernel module is loaded whenever a kernel requires it
A custom kernel is built by creating a new configuration file.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 10 – Connecting to Network
OverviewA network connection is required to communicate with other computers when they are in a network. Network interface cards have to be configured in a Linux system in order to communicate with other computers of the network. A network client is a system that obtains service from the server.
Lessons covered in this module1. Configuring Network Interfaces2. Configuring Network Client Services
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Configuring Network Interfaces
IntroductionA network connection is required to communicate with other computers when they are in a network. This is achieved by adding a network interface card and making the operating system identify the Network Interface Card.
Topics covered in this lesson1. Configuring an Ethernet Connection 2. Configuring a PPP Connection3. Setting the Host Name
Installing Linux
© 2006 IIHT Limited
Topic 1 - Configuring an Ethernet Connection Ethernet device is a type of Network Interface Card (NIC)
Verification of the configuration of all interfaces can be done using ifconfig command[root@localhost ~]# ifconfig
Installing Linux
© 2006 IIHT Limited
Network Configuration
Network configuration for obtaining Internet connection, can be obtained through DHCP and through Static IP address.
To set the network configuration, the user can make use of su command to become root and run the following command
Netconfig Network Configuration
Installing Linux
© 2006 IIHT Limited
Static IP address Network Configuration
Fill in the fields with relevant data in IP Address, Netmask, Default Gateway and Primary Nameserver as shown in the following figure. Click on OK after all the required data is entered
Installing Linux
© 2006 IIHT Limited
DHCP Network ConfigurationIf the network connection has to be DHCP then just go to the Use
dynamic IP Configuration BOOTP/DHCP and press TAB, a * (asterisk symbol) will appear on the space enclosed by square brackets.
This indicates that DHCP is enabled, now click OK.
Installing Linux
© 2006 IIHT Limited
Configuring an Ethernet connection
To configure an ethernet connection, the steps given below have to be followed.
To start a network administration tool, go to Main Menu Button =>Systems and Settings =>Network
Network Administration Tool
Installing Linux
© 2006 IIHT Limited
Configuring an Ethernet connectionClick the Devices tab on Network Administration Tool as shown in
the above figureDouble-click on the highlighted line as shown in the above figure. Now
the following screen appears.
Installing Linux
© 2006 IIHT Limited
Configuring an Ethernet connection
After configuring the Ethernet device, you will see it displayed in the device list as shown in the figure given below
After configuring the Ethernet device, select File => Save to save the changes
Installing Linux
© 2006 IIHT Limited
Topic 2 - Configuring PPP Interface
A point-to-point (PPP) interface is used to build direct connection between two inodes.
There are three technologies that use PPP for connecting computers to a network such as the Internet and they are:
· Integrated Services Digital Network (ISDN)· Modems· Digital Subscriber Line (DSL)
Installing Linux
© 2006 IIHT Limited
Configuring an ISDN Connection
An ISDN connection is an Internet connection that is set with an ISDN modem card via a special phone line installed by the phone company. ISDN connections are popular in Europe.
ISDN connection is done using Network Administration tool. To start the Network Administration tool,
Installing Linux
© 2006 IIHT Limited
Configuring a Modem Connection
A modem can be used to configure an Internet connection over an existing phone line. An Internet Service Provider (ISP) account, also called a dial-up account is needed to establish a modem connection.
Modem connection is configured using the Network Administration Tool
Installing Linux
© 2006 IIHT Limited
Configuring a DSL Connection
DSL devices are becoming popular. The configuration is similar to the Ethernet configuration and only the difference is in permitting configure settings such as the SSID (service set identifier) and key for the DSL device.
DSL is configured using the Network Administration Tool
Installing Linux
© 2006 IIHT Limited
Topic 3 – Setting the Host Name
Network applications depend on the local host name to be set to some reasonable value.
This setting is generally made during the boot process by running the hostname command.
The syntax used to set the host name is: # hostname name
Organizations will have their own authorized fully qualified domain name (FQDNs)
Installing Linux
© 2006 IIHT Limited
Lesson 2 - Configuring Network Client Services
IntroductionA network client is a system that obtains service from the server. A network client has to be configured to avail the services such as sharing files, mail services from the network server. To configure a network client, a user should have root privileges or super user access.
Topics covered in this lesson1. Configuring DNS Client Services2. Configuring NIS Client Services3. Configuring Mail Client Services
Installing Linux
© 2006 IIHT Limited
Topic 1 – Configuring DNS Client Services
Domain name recognizes one ore more IP (Internet Protocol) addresses. Domain names are used in URLs (uniform resource locators) to recognize specific web pages.
The configuration is made into the DNS server using the commands given below:in: /etc/resolv.conf
Installing Linux
© 2006 IIHT Limited
/etc/hosts lists IP addresses and related hosts names and aliases.
Add the line PEERDNS = no to the interface configuration file to avoid the DHCP server from updating the /etc/resolv.conf.
Topic 1 – Configuring DNS Client Services
Installing Linux
© 2006 IIHT Limited
Topic 2 – Configuring NIS Client Services
Network Information Service or NIS was designed to permit sharing files between Unix systems and Unix administrators.
A set up of NIS has two components, a NIS master server that offers centrally administered configuration information and NIS clients
The configuration can be done most rapidly with the use of graphical configuration tool autoconfig
NIS clients can be created using command line interface by manually configuring the following configuration files.
· /etc/sysconfig/network· /etc/yp.conf· /etc/nsswitch.conf
Installing Linux
© 2006 IIHT Limited
Topic 2 – Configuring NIS Client Services
Continued..
Installing Linux
© 2006 IIHT Limited
Topic 3 – Configuring Mail Client Services
Red Hat Linux has a default email client called Evolution. Evolution offers all the standard email client features that include powerful mailbox management, user-defined filters and quick searches.
Evolution also features a flexible calendar and scheduler that permits users to make and authenticate group meetings and special events online.
Start Evolution from the desktop panel go to Main Menu =>Internet=>Email
Installing Linux
© 2006 IIHT Limited
Topic 3 – Configuring Mail Client Services
The first time Evolution is started, a Welcome Screen is displayed that allows you to configure a new email connection. Click Forward to continue. The following screen is displayed
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
Network Interface card such as Ethernet, is a hardware device used in making operating system to connect the network.
A network client has to be configured to the server to obtain the services from the network server.
Email, DNS client and NIS client are some of the network clients configured to their corresponding network server
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 11 – Linux Network Services
OverviewIn Linux, there are network services that can be used to be connected to a network. The services include NFS, Samba and DHCP. This module deals with NFS, Samba and DHCP.
Lessons covered in this module1. Linux Network Services
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Linux Network Services
IntroductionIn Linux, there are network services that can be used to be connected to a network. The services include NFS, Samba and DHCP.
Topics covered in this lesson1. Network File System (NFS) 2. Dynamic Host Configuration Protocol (DHCP)3. Samba
Installing Linux
© 2006 IIHT Limited
Topic 1 - Network File System (NFS)
NFS is a method of sharing files across Linux and UNIX networks. It is a distributed file system that provides local access to remote disks and file systems. In a proper NFS installation, the operation is totally transparent to clients using remote file systems.
NFS has client/server architecture. Illustration of exporting file systems with NFS
diskbeast
guava
/hom e/u4
m ango
/hom e/u3
apple
/hom e/u2
pear
/hom e/u1
peach
/hom e/u7/hom e/w ork
lim e
/hom e/u6/pro jects
kiw i
/hom e/u5/work/proj
/exports/hom es
/proj
Installing Linux
© 2006 IIHT Limited
NFS Server
To run an NFS server with Red Hat Linux the following services are required. portmap, rpc.nfsd and rpc.mountd.
The NFS server software with Red Hat has three facilities, the portmap, nfs-utils and rpc.mountd rpms:
portmap: This maps calls from other devices to the correct RPC service
nfs: This translates NFS requests into requests on the local file system
rpc.mountd: This is for mounting and unmounting file systems
Installing Linux
© 2006 IIHT Limited
NFS Client
NFS is implemented in client machines as a kernel module. Network mounts are specified using /etc/fstab.
You can use autofs to mount NFS shared files when required and unmount them when idle.
To mount a shared directory in your local file system, use mount.
Screen Picture Illustrating the Steps
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise
We have to configure host IIHT1 and IIHT2 as NFS server and client so that user on IIHT2 can access host IIHT1 home directory.
Configure by performing the following steps:1. Host IIHT1 and IIHT2 IP address are 192.168.1.1 and 192.168.1.2
respectively
2. Configure host IIHT1 as a NFS server and share home directory in /etc/exports file
3. Configure host IIHT2 as NFS client and access IIHT2 to home directory by using mount command.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Dynamic Host Configuration Protocol (DHCP)
Many Networks assign IP addresses to the requesting client on a lease for a predetermined amount of time. Here the IP address is dynamic called Dynamic Host Configuration Protocol.
This protocol runs on network layer two and responds to DHCP requests.
In order to request a DHCP lease on a network, you need the dhcpcd software.
The latest version can be obtained from its home site http://www.phystech.comldownloadldhcpcd.htm
Installing Linux
© 2006 IIHT Limited
Configuring a dhcpd server
The first step to install a dhcp rpm if it is not installed. Then you should create the /etc/dhcpd.conf file.
Installing Linux
© 2006 IIHT Limited
Topic 3 - Samba
The presence of diverse machines in the network environment is natural and so their interoperability is critical.
SAMBA is one such advanced Windows-to-UNIX interoperability package.
It has become so successful and practical that you can completely replace Windows servers with Samba servers.
There are more configuration tools in system-config-samba utility.
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Exercise Configure this lab by performing following instructions
1. HOSTA and HOSTB machines with IP address are 192.168.1.1 and 192.168.1.2 respectively
2. Configure HOSTA as a samba server
3. Create one directory name IIHT and give full permission to everyone
4. Make an entry in /etc/samba/smb.conf file so that you can access the Linux machine from a Windows machine
5. Access your directory name IIHT from HOSTB machine which is windows machine
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
NFS is a method of sharing files across Linux and UNIX networks.
DHCP is a network protocol to manage dynamic hosts who use leased IP addresses on a time bound basis.
Samba is a network interoperability package
Red Hat supports all these and there are easy and specific ways to configure these for efficient network services management.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 12 – Kickstart Installation
OverviewIn Linux, system administrators use an automated method of installation called kickstart installation that helps them to save time when installing Linux on several machines in a network. This module deals with the kickstart installation along with configuration of kickstart.
Lessons covered in this module 1. Kickstart Installation
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Kickstart Installation
IntroductionRed Hat Linux has one installation method that is an automation method of installation called Kickstart installation. This type of installation helps system administrator when they have to install Linux in several machines on a network.
Topics covered in this lesson1. What is Kickstart Installation?2. Kickstart Configuration
Installing Linux
© 2006 IIHT Limited
Topic 1 – What is Kickstart Installation?
Red Hat has developed Kickstart installation method, an automated method for installing Red Hat Linux on the systems.
Kickstart files are placed on single server system and individual computers read these Kickstart files while Linux is being installed.
Using a single Kickstart file for installing Red Hat Linux on multiple machines is supported by Kickstart installation method
Kickstart installations can be carried out with the use of a CD-ROM, a local hard drive, FTP or HTTP.
Installing Linux
© 2006 IIHT Limited
Topic 2 – Kickstart ConfigurationKickstart can be configured using command line interface and
graphical tool, kickstart configurator.
Analysis of Kickstart Configuration through Command Line Interface
· When Red Hat Linux is installed, the default kickstart configuration file gets saved as anaconda-ks.cfg in the /root directory.
· The file, anaconda-ks.cfg that is automatically generated by anaconda
Installing Linux
© 2006 IIHT Limited
Kickstart Configuration using Graphical Tool
Kickstart configurator can be started by clicking Main Menu => System Tools => Kickstart.
This will display the Kickstart configurator as shown in the figure given below Basic Configuration
Installing Linux
© 2006 IIHT Limited
Lab Exercises
Automatic Installation with KickstartIn this lab you have to install Linux with kickstart. For this you have to configure NFS and DHCP server. DHCP provides the IP address to the client and the location of kickstart file. NFS server mounts the directory in which the installation files are located. Your kickstart server’s IP address is 192.168.1.2.
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
Kickstart Installation is an automated installation method developed by Red Hat Linux.
Kickstart file can be generated graphically as well as through command line interface
There is a graphical tool called Kickstart Configurator that can be used for creating a kickstart configuration file with all settings
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 13 – Linux Security
OverviewLinux is more prone today to security loopholes and attacks, both inside and outside the network. In this module we learn about the various services and their role in Linux booting process. This module deals with iptables and TCP Wrappers.
Lessons covered in this module1. Introduction to System Service 2. Securing Network
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Introduction to System Service
IntroductionIn Linux, system initialization i.e. starting up the system processes whenever system boots, is controlled and maintained by several files and directories. All the processes run as they are indicated in the files and certain things can be manipulated to meet requirements.
Topics covered in this lesson1. System Initialization 2. Chkconfig
Installing Linux
© 2006 IIHT Limited
Topic 1 - System Initialization
The following three main steps happen each time a system boots up to run Linux:
1. Boot hardware – On the basis of information in the system’s read only memory, i.e. BIOS, the system examines and starts up the hardware.
2. Start boot loader – Ideally, the BIOS examines the master boot record on the primary hard disk to view what to load next.
3. Boot the kernel – With an assumption that Linux is selected to be booted, the Linux kernel will be loaded.
Installing Linux
© 2006 IIHT Limited
System RunLevels
The Linux system is brought to a predefined working condition when the Linux kernel runs /sbin/init.
/sbin/init reads its configuration file and begins all programs listed in the configuration file. This predefined working condition is known as runlevel.
Two styles of init programs, BSD-derived init programs and System V-derived init programs are usually used
BSD-derived init programs have only one predefined runlevel
System V-style init programs are more flexible
Installing Linux
© 2006 IIHT Limited
Predefined RunlevelsRed Hat comes with many predefined runlevels as listed in this table
Installing Linux
© 2006 IIHT Limited
System Startup Files
The system startup files control and manage the tasks after the system gets booted up by the boot loader.
These files are essential for successful operation of the computer since they regulate the processes at system boot up.
There are several system startup files and scripts as listed below:
1. The rc.sysinit script2. The /etc/init.d and /etc/rcX.d directories3. The /etc/rc script 4. The /etc/rc.local file
Installing Linux
© 2006 IIHT Limited
Topic 2 - Chkconfig
The chkconfig command offers the capability to inquire the configurations existing or to customize configuration currently on the system.
[root@localhost ~]#chkconfig –level 345 sendmail on
The above command would configure the system to start sendmail in runlevels 3, 4 and 5.
The present configuration of a particular daemon can be found out by running the below command,
[root@localhost ~]# chkconfig –list daemon
Installing Linux
© 2006 IIHT Limited
Lesson 2 – Securing Network Introduction
In Linux, to make a network environment safe, security has to be provided. TCP Wrapper is a tool usually used on Linux systems to regulate and filter connections to network services. iptables, a firewall product also restricts unauthorized access from accessing a network.
Topics covered in this lesson1. iptables2. TCP Wrappers
Installing Linux
© 2006 IIHT Limited
Topic 1 - iptables
Firewall is a system designed to limit unauthorized access to or from a private network.
Firewalls can be applied in both hardware and software or a combination of both.
Firewalls are often used to avoid unauthorized Internet users from accessing private networks connected to the Internet and Intranet.
Earlier, a firewall package called ipchains that is now replaced by iptables
Installing Linux
© 2006 IIHT Limited
Starting iptablesIptables can be started, stopped and restarted after system boot by
running the following commands:
[root@localhost ~]# service iptables start[root@localhost ~]# service iptables stop[root@localhost ~]# service iptables restart
The iptables can be made to get configured to start at system boot by using the chkconfig command as given below.
[root@localhost ~]# chkconfig iptables on
Installing Linux
© 2006 IIHT Limited
Packet Processing in iptablesThe table given below gives an overview of the procedure for packets
transmitted by the firewall
Installing Linux
© 2006 IIHT Limited
Packet Processing in iptablesIllustration of a TCP packet from the Internet passing through the
interface of the firewall on Network A
Installing Linux
© 2006 IIHT Limited
Targets The way, the rules are added to the chains of the firewall are done
using Targets Targets in iptables
Installing Linux
© 2006 IIHT Limited
Topic 2 – TCP Wrappers
TCP Wrapper is a tool usually used on Linux systems to regulate and filter connections to network services.
TCP Wrappers offer wrapper daemons, which can be installed without making changes in existing software.
Most of the TCP/IP applications depend on the client and server model. The TCP wrapper configurations are stored in two files /etc/hosts.allow
and /etc/hosts.deny. Permissions are stored in /etc/hosts.allow and denials in /etc/hosts.deny.
Installing Linux
© 2006 IIHT Limited
Topic 2 – TCP WrappersExample for Blocking ssh (Secure shell)
sshd: ALL (for all)sshd: ALL EXCEPT 192.168.10.10
Example for Blocking FTP (file transfer protocol)
vsftpd: ALL (for all) vsftpd: ALL EXCEPT 192.168.10.10
Example for Allowing Telnetin.telnetd, sshd: .india.com 192.168.0.8
Installing Linux
© 2006 IIHT Limited
Lab Exercise
iptables and TCP Wrappers In this lab we have to restrict access to the service using iptables and TCP_wrappers. You want to block the telnet service so that HOSTA will not be able to telnet HOSTB. Assume that HOSTA and HOSTB have IP address 192.168.1.1 and 192.168.1.2 respectively.
Installing Linux
© 2006 IIHT Limited
Conclusion
Summary
A Linux system can be brought into a pre-defined working condition called runlevel that signify a particular function
There are several system startup files that control and regulate startup processes whenever a system boots up
There are different ways to secure Linux, through Security services, Firewall and TCP Wrapper.
Question and Answer Session
Installing Linux
© 2006 IIHT Limited
Module 14 – Setting Up a Printer Overview
Linux servers can be used in many different roles on a LAN. File and print servers are the most common roles played by the servers. In this module we learn about the print process and how to administer and set up the printers.
Lesson covered in this module1. Setting up a Printer
Installing Linux
© 2006 IIHT Limited
Lesson 1 – Setting Up a Printer
IntroductionIn Linux, printers are set up on a local computer and on a network as well. Linux has advanced printing system known as Common Unix Printing System. Printer can be configured to share on a network.
Topics covered in this Lesson1. Common Unix Printing System (CUPS)2. Printer Configuration3. Adding a IPP Printer4. Adding a (Unix) LPD Printer5. Adding a Samba Printer6. Sharing Printer
Installing Linux
© 2006 IIHT Limited
Topic 1 - Common Unix Printing System (CUPS)
The Common Unix Printing System (CUPS) is an entirely new and modern printing system.
It has web-based administration that helps in setting up CUPS easily.
CUPS will support network, parallel and serial printers.
A windows system can print to a printer shared by a Linux system through CUPS without using any other software.
CUPS printing system is relatively easy to configure than LPD and LPRng.
Installing Linux
© 2006 IIHT Limited
Topic 2 - Printer ConfigurationPrinter can be configured using graphical tool and command line
interface.
Printer configuration using command line interface
The printer is configured using the setup utility and setting the configurations.
As explained in the mouse configuration, give the Setup command that will take you to the Text mode Setup Utility command line interface
Printer Configuration using Graphical Tool
Installing Linux
© 2006 IIHT Limited
Topic 3 - Adding a IPP Printer
An IPP printer is a printer connected to different Linux system on the same network that runs CUPS or a printer configured on different operating system for using IPP.
By default, the Printer Configuration Tool will browse the network for any shared IPP printers.
A new networked IPP printer can be added by clicking the New button in the main Printer Configuration Tool window.
Installing Linux
© 2006 IIHT Limited
Topic 4 - Adding a Unix (LPD) Printer
A remote Unix printer like the one connected to a different Linux system on the same network can be added by clicking the New button in the main Printer Configuration Tool window.
Installing Linux
© 2006 IIHT Limited
Topic 5 - Adding a Samba Printer
A Samba printer accessed using the SMB protocol, can be added by clicking the New button in the main Printer Configuration Tool window.
Installing Linux
© 2006 IIHT Limited
Topic 6 - Sharing Printer
For configuring a printer to be shared on a network, open the printer configuration tool as explained above that has a printer as shown in the following figure.
Installing Linux
© 2006 IIHT Limited
Lab Exercise
Setting Printer In this lab you have to set up a printer by using graphical tool. You have to create a print queues name IIHT and try to print a test page.
Installing Linux
© 2006 IIHT Limited
Conclusion Summary
Linux supports Common Unix Printing System (CUPS) that is new and modern printing system.
A printer can be configured using command line interface and graphical tool known as Printer Configuration Tool
Printer configuration tool is used to add a local printer, an IPP printer, a Unix printer and a Samba printer
Question and Answer Session