Professional Documents
Culture Documents
Units:
unit-1 unit-2 unit-3 unit-4 unit 4 unit-5 unit 6 unit-6 unit-7 unit-8 unit-9 unit-10 About the founder of Linux. Linux VS Windows. Linux Flavors. Introduction to Redhat Linux Linux. Kernel. Types of shells Dos Vs Linux. Redhat Linux Installation Hardware Requirements Installation Methods
Unit -1
Evolution of Linux
Torvalds originally used Minix on his computer, a simplified kernel written by Andrew Tanenbaum for teaching operating system design. The Linux system quickly surpassed Minix in functionality. The first version of the Linux kernel was released to the Internet in September 1991. with the second version following shortly thereafter in October
By the release of the first version of the Linux kernel, the GNU project had produced all the necessary components of this system except the kernel.
Torvalds and other early Linux-kernel developers adapted their kernel to work with the GNU components and user space p g programs to create a fully functional operating system. y p g y
FEATURES OF LINUX
Open source development model. Supports wide variety of hardware. Supports many networking protocols and configurations systems. Supports more File systems Linux has a reputation for fewer bugs (programming mistakes) than Windows.
Linux
Vs
Windows
Open Source Development Model It is not an open source and hence and so the programmer can cannot be redesigned by the p g g y redesign the OS. programmer. Linux is robust and very much Windows gets affected by virus secure from virus. very easily. The Linux servers has surpassed Security is the main issue which windows server operating system in has made windows to think to security. survive. It costs less to design implement a Linux Network. and It costs more to implement Windows Network administration, when compared to Linux.
There are 250000+ developers Compared to Linux, windows is behind Linux for open source developed by few thousands of deployment. people.
Linux Flavors
Red Hat Linux (Red Hat) Fedora Linux Open Linux (Caldera) SuSE Linux (Novell) Mandrake Linux (Mandrake) T b Linux (P ifi Hi T h) Turbo Li (Pacific Hi-Tech) Linux PPC (MAC Power PC version) Info magic Slack ware Linux Project Knoppix (Live CD) etc.,
Kernel
The kernel is the essential center of a computer ope a g sys e , e co e a p o des bas c se ces operating system, the core that provides basic services for all other parts of the operating system. A kernel can be contrasted (compared) with a shell, shell is the outermost part of an operating system that interacts with user commands. Kernel and shell are terms used more frequently in Unix operating systems th ti t than i IBM mainframe or Mi in i f Microsoft ft Windows systems.
Shells
Bash shell (Bourne again Shell) Developed for the GNU Project The actual standard Linux shell Default shell for Red Hat Linux Borne shell (sh) Original Unix shell written by Bill Joy t J at UC B k l Berkeley C shell ( h) h ll (csh) Added many features such as command, history and job control
Continue
Shells
Korn Shell (Ksh) Written by David Korn ( ) y Implemented many csh features such as
Th E h The Enhanced C shell (t h) a community effort d h ll (tcsh) it ff t More features like command-line editing and more sophisticated completion
Shells
command prompt for bash shell
Shells
command prompt for c-shell (csh)
Shells
Shells
Shells
DOS Vs Linux
DOS Command DIR TREE CD MKDIR RMDIR CHDIR DEL LINUX Command C d Action A ti ls -l ls R cd mkdir rmdir pwd rm List directory contents List directory recursively y Change directory Make a new directory Remove a directory Display directory location Remove a fil R file
DOS Vs Linux
DOS Command C d RMDIR /S (NT) DELTREE (Win 95...) COPY XCOPY RENAME or MOVE TYPE MORE HELP or COMMAND /? LINUX Command rm -r Action A ti Remove all directories and files below given directory
Copy a file Copy all file of directory recursively Rename/move a file Dump contents of a file to users screen Pipe output a single page at a time Online manuals O
DOS Vs Linux
DOS Command CLS LINUX Command clear Action Clear screen
EXIT
exit
Exit a shell
FIND
find
FC
diff
Compare two files and show differences. Also see mgdiff and tkdiff. Show environment variables
SET
ECHO text
echo text
DOS Vs Linux
DOS Command SET variable PATH DATE or TIME SORT EDIT filename.txt \ .\ ..\ LINIUX Command export variable name echo $PATH date sort Action Set environment variables Display search path for executables Show date. (also set date DOS only) l ) Sort data alphabetically/numerically Edit a file The Linux editor file. which looks most like DOS edit is probably Pico. Directory pa de ec o y path delimiter e Current directory Parent directory
vim / ./ ../
DOS Vs Linux
DOS Command LINUX Command Action BACKUP files A:\ tar -cvf /dev/fd0 files Save backup files to floppy
Read files from floppy. See Using DOS floppies Change file to a hidden file - rename file with prefix " " "." Print a file Show free memory on system Show system info ( y (Command borrowed from AIX)
MSD
DOS Vs Linux
DOS Command C d LINUX Command C d Action A ti SCANDISK DEFRAG C: fsck Check and repair hard drive file system p y
FDISK
fdisk
FORMAT
Format drive file system. For floppy drive use see YoLinux Tutorial Using DOS Floppies with Linux Operating system version Compress and uncompress files/directories. Use tar to create Linux also has compress, gzip Print host name of computer
VER
pkzip
HOSTNAME
hostname
DOS Vs Linux
DOS Command LINUX Command Action PING ping Send packets to a network host
TRACERT
traceroute
IPCONFIG (NT) WINIPCFG (Win 95 ) 95...) NBTSTAT (Netbios info: n, -c) NBTSTAT -a host-name NBTSTAT -A IP-address ROUTE PRINT
ifconfig
nslookup hostname
route -n t
Network Commands
DOS Command LINUX Command ping Action PING Send packets to a network host Show routes and router hops to g given network destination.
TRACERT
traceroute
IPCONFIG (NT) WINIPCFG (Win 95...) NBTSTAT (Netbios info: n, -c) NBTSTAT -a host-name a host name NBTSTAT -A IP-address ROUTE PRINT
ifconfig
nslookup hostname
route -n
Hardware Requirement
32-bit Intel based processor, at least an Intel or compatible 80386, 80486, or Pentium-class microprocessor is required required. 400 MHz Pentium is recommended for a graphical interface and 200 MHz for text. Normally 64MB RAM for Text, and y , 192 MB for graphical. (Linux can run on as little as 12 MB RAM). At least 2GB free hard disk space for a standard installation, including applications; 3 to 6 GB or more is recommended for a full installation (all applications).
Installation Methods
Red Hat Installation CD-ROM. NFS Image. Kick Start FTP HTTP
NFS Image
NFS (Network File Sharing): It is a common method to h t share fil files. An image of an operating system is taken already which is connected remotely to install the image in a system. The image system is first mounted and operating system path is given to get into the installation.
Type linux askme install either thr FTP, HTTP, Har , , and NFS.
Type linux text askmethod to install either through FTP, HTTP, HTTP Hard disk and NFS.
Type Linux Text and press enter for Text mode Installation
Hardware Detection
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Click here for manual partitioning. Raid and LVM also can be configured (Disk Druid tool can be used only while installation)
Redhat Installations
Select the file system type here.( ext2, ext3 t h ( t2 t3 for normal partition and swap for swap p partition) ) Enter the size of the partitions titi here.
Select the file system type here.( ext2, ext3 t h ( t2 t3 for normal partition and swap for swap p partition) ) Enter the size of the partitions h titi here.
Redhat Installations
GRUB and LILO d are the Red Hat Linux boot loaders. GRUB is the Default Loader of Red Hat Linux 8.0 The default boot operating system can be changed or added here
Redhat Installations
eth0 means first Ethernet card its address getting from DHCP. Hostname also getting from DHCP server..
Firewall Configuration
No firewall option allows all network services t your i to machine No firewall option allows all network services to your machine
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Redhat Installations
Its reading g package information's.
Redhat Installations
Select customize This is Thi i used t select d to l t options to customize the default package. the package selections
Package Selection
The Packages to be installed i t ll d are selected l t d here. Even the office (Like MS-Office in windows) ) Packages are available inbuilt in Red Hat installation CD
Package Selection
Beginning of Installation
Click next to begin the actual installation which begins writing the operating system in the hard drives.
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
Installing Packages
The Red Hat Installation is completed successfully. Remove any Installation media and boot disks. And reboot the system.
Rebooting
Loading Kernel
Initializing services
The Red Hat setup agent will proceed some More basic configurations Before the system is ready to use.
License agreement
Graphics configuration
Select the screen resolution suiting y g your monitor and display card
Select the Colour depth depththe number of distinct colours required supporting the video g card Installed
To register the system to Red Hat enter the Login name and password.
If you dont have redhat login select this option to create a new login.
The update agent p g registers the machine with Red Hat network So that the latest Software packages Get updated automatically
Tests sounds for the 3 channels in sound card can be heard by selecting play test sound
Finishing Setup
Login Screen
Login Screen
Red Hat supports many languages, the language can be selected before login.
Login Screen
Login Screen
Login Screen
Login Screen
Login Screen
Kernel initialization
As systems boots, kernel get initialized and the following functions are occurred. D i Device d t ti detection: k kernel will compile th d i l ill il the device drivers and locate it to the corresponding devices. Mounts root file system: After the device detection the kernel will mount the root file system as read only. Load initial process: The very first process (init) is then loaded.
Initial process
Init :
It is the superior of all processes. As soon as init process is loaded the control is p passed from kernel to this process. p
/etc/inittab: File which contains the information on how init should setup the system in every run level, as well as the run level to use a default default.
Run levels
init 0 : Shutdown the system or halt init 1 : Single-user mode. init i it 2 : M lti Multi-user mode with out networking support. d ith t t ki t init 3 : Multi-user mode with networking support. init 4 : Unused. init i it 5 : G hi l user i t f Graphical interface. init 6 : Reboot the system.
CONSOLES
Text-mode login at virtual console Multiple non-GUI logins are possible Default consoles are in text mode Available through CTRL-ALT-F[1-6]
X Window System
It is the foundation for the graphical user Interface of Red Hat Linux. X applications communicate with a display via. The X protocol. X is OS Independent.
X Protocol
X protocol is a asynchronous network protocol for the communication between X client and X Server.
It defines how the graphical primitives are communicated between X client and server.
GNOME
It is the default desktop environment for Red Hat Linux. Linux It is Power full and easy-to-use desktop environment consisting primarily of a panel and a set of GUI tools. GNOME is free and hence its source code can be downloaded form the GNOME Web Site:
www.gnome.org.
GNOME Interface
The GNOME Interface consists of a Panel and a Desktop. Panel appears as a long bar across the bottom of screen.
The Remainder Screen is the Desktop. Here you can place directories, files or programs.
GNOME Desktop
GNOME Menus
GNOME Menus
KDE
KDE provides an alternative desktop environment with full set of integrated network and internet applications. applications Along with GNOME features, It also includes Konsole Konqueror K Kmail Kdevelop : Highly configurable graphical terminal. : A file manager and web b fil d b browser. : A graphical email client. : Integrated development.
KDE Desktop
KDE Desktop
KDE Desktop
KDE Desktop
Starting X Window
The X window start automatically, If so then a Graphical login screen is prompted by the Display manager. manager
Start X
Start X
Desktop Selection
Select failsafe y in case of any graphical failure To get in to the previously used desktop
KDE MODE
If you click yes the KDE desktop is set as default desktop for future sessions (or) login
Switchdesk
Switchdesk
To switch from kde to gnome desktop
Switchdesk
/lib/modules Holds the kernel modules. /mnt Used to hold directories for mounting file systems like CD-ROMs or floppy disks that are mounted only temporarily. Holds added software applications (for example, pp ( p , KDE on some distributions).
p /opt
p /tmp /usr
/var
Linux Commands
Commands have the following syntax: Command [options] [arguments] Each item is separated by space Options modify the commands behavior Arguments are filenames or other information needed by the command Separate commands with semicolon (;)
DOS Vs Linux
DOS Command DIR TREE CD MKDIR RMDIR CHDIR DEL LINUX Command C d Action A ti ls -l ls R cd mkdir rmdir pwd rm List directory contents List directory recursivly Change directory Make a new directory Remove a directory Display directory location Remove a fil R file
DOS Vs Linux
DOS Command C d RMDIR /S (NT) DELTREE (Win 95...) COPY XCOPY RENAME or MOVE TYPE MORE HELP or COMMAND/? LINUX Command rm -r Action A ti Remove all directories and files below given directory
Copy a file Copy all file of directory recursively Rename/move a file Dump contents of a file to users screen Pipe output a single page at a time Online manuals O
DOS Vs Linux
DOS Command CLS LINUX Command clear Action Clear screen
EXIT
exit
Exit a shell
FIND
grep
FC
diff
Compare two files and show differences. Also see mgdiff and tkdiff. Show environment variables
SET
ECHO text
echo text
DOS Vs Linux
DOS Command SET variable PATH DATE or TIME SORT EDIT filename.txt \ .\ ..\ LINIUX Command export variable name echo $PATH date sort Action Set environment variables Display search path for executables Show date. (also set date DOS only) l ) Sort data alphabetically/numerically Edit a file The Linux editor file. which looks most like DOS edit is probably Pico. Directory pa de ec o y path delimiter e Current directory Parent directory
vim / ./ ../
DOS Vs Linux
DOS Command LINUX Command Action BACKUP files A:\ tar -cvf /dev/fd0 files Save backup files to floppy
Read files from floppy. See Using DOS floppies Change file to a hidden file - rename file with prefix " " "." Print a file Show free memory on system Show system info ( y (Command borrowed from AIX)
MSD
DOS Vs Linux
DOS Command C d LINUX Command C d Action A ti SCANDISK DEFRAG C: fsck Check and repair hard drive file system p y
FDISK
fdisk
FORMAT
Format drive file system. For floppy drive use see YoLinux Tutorial Using DOS Floppies with Linux Operating system version Compress and uncompress files/directories. files/directories Use tar to create compilation of a directory before compressing. Linux also has compress, gzip Print host name of computer
VER
pkzip
HOSTNAME
hostname
DOS Vs Linux
DOS Command LINUX Command Action PING ping Send packets to a network host
TRACERT
traceroute
IPCONFIG (NT) WINIPCFG (Win 95 ) 95...) NBTSTAT (Netbios info: n, -c) NBTSTAT -a host-name NBTSTAT -A IP-address ROUTE PRINT
ifconfig
nslookup hostname
route -n t
Network Commands
DOS Command LINUX Command ping Action PING Send packets to a network host Show routes and router hops to g given network destination.
TRACERT
traceroute
IPCONFIG (NT) WINIPCFG (Win 95...) NBTSTAT (Netbios info: n, -c) NBTSTAT -a host-name a host name NBTSTAT -A IP-address ROUTE PRINT
ifconfig
nslookup hostname
route -n
Login screen
PWD
PWD
Present working Directory Display the absolute path of the current directory.
PWD
ls
ls : List the Files and Directories within the current directory. Syntax: ls [options] Options: -l l Li t fil with permission. List file ith i i
ls
ls -l
l l command
It defines the I d fi h No ofname of the group links to the Owner name, Thepermissionsthe directory the user who created which to assigned hasthe Time stamp h directory. File files permissions over the Size of theor directory the digroups and files owners, or directories names. or directories other users
ls -a
[a] option lists all files and directories including hidden files
ls -al
al option lists all files and directories including hidden files in long listin format.
ls -R
mkdir
mkdir : Make directory (or) To create a directory
mkdir
cd
cd - Change directories Syntax : cd <directory name> cd .. - To a directory one level up (parent directory) cd cd / -
cd
cd ~
Previous slide we have seen cd along with any directory name. y This command cd ~ <enter> will take to your home directory
cd ..
cd ..
Now we can see that we are in advpro directory, the parent directory of the test y
cd /
cd / will take you to / (Slash directory)
cd /
Confirmed through the pwd command
cd
Here the current directory is newdir when we enter cd -, it takes cd - is given as Again to the previously worked it will take shown. Nowdirectory. to the previously h i l worked directory i.e., ( (newdir) )
cat
cat it is the command to create and view files Syntax:
cat [options] [filename] cat > [filename] To create a file cat [filename] To view a file cat >> [filename] T append t t to a t [fil ] To d text t file
cat
As mentioned in the previous slide. cat is used to create a file The file is saved through ctrl -d th h tl d after typing the text
cat
Enter cat <filename> fil to view the content of file.
cat
To append the text in a file, Cat >> (symbol) and file name.
cat
cat
The -s option p trims multiple adjacent blank lines into single blank line
cat
cat
The A option shows all characters including control and non t l d printing characters Here the $ represents the end of the line
touch
touch command is used to update the time stamps of a file. touch is also used to create empty file. Syntax : touch [filename] touch can create multiple empty file too. Syntax : touch [filename1] [filename2]
touch
Here the empty file is created
touch
Multiple files are created using touch command
Copy Command
cp : cp command is known for copying files and directories. Syntax : cp [options] source destination
O ti Options : -r recursively copy an entire directory tree -p preserve permissions, ownership, and time stamps Example : cp File1 File2 e e
Copy Command
There is a file named i d a in the directory test .
Copy Command
Here we notice that test1 is a empty directory. Let us copy the file a into this directory. thi di t
Copy Command
Cp copies the file a from the directory f th di t test to the directory test1.
Copy Command
Copy Command
Directories new and old are listed with their contents. contents
Copy Command
Copy Command
Copy Command
Copy Command
Copy Command
Copy Command
See the comparison of the file one shown above in the new and old directory
Copy Command
Move Command
mv : This command is used to move and renaming files and di t i d directories Syntax: mv <source> <destination>
Move Command
Move Command
Here we see that using mv command the file is moved from old to new directory.
Move Command
Now check into the old directory where the file one is moved. Hence the directory is empty
Move Command
Move Command
Move Command
Move Command
Using the l l command, the above screen shows the renamed file
rm command
This screen shows the contents of the new directory The above rm command is used to remove the file k
rm command
rmdir command
Here a directory is created named donic which is removed through the command rmdir d di
rmdir command
rmdir command
rm command
Using rm with g option r, the directory along with contents can be removed
rm -r command
rm command
rm -ri command
rm -ri command
We can see that the file for which we have given y n y is removed and n is preserved
File command
The file command is used to check the file content.
Syntax : file <filename> Example: file f1 (f1 is a file. File will show the format) file /dev/fd0 (The output shows that the fd0 is a block special file)
File format
The file along with file name (ss) shows the file format
File format
This shows the format of the file cat as executable file fil
more
more
l l lists the content quickly, which makes the viewer to see only last page
more
more
more
more
more
Now the more command is i over and d we are in the end of the page
vi Modes
Command mode: Operations such as cut, copy, paste, delete, p , py, p , , undo, redo etc., are done in this mode. Insert mode: Type in new text y Ex-mode : Extended commands for saving, exiting, searchand-replace can executed here
Command Mode
Insert Mode
This is the insert mode
Insert Mode
After typing the datas hit escape to get into command mode
Ex- Mode
Ex- Mode
Yank
Like this example, you can copy any number of lines by typing numbers of lines and yy
Hit escape and type 3yy t yank t 3 to k three lines from the cursor position p
Text yanked
In the previous slide, we saw how to yank the text. After yanking we see the message as below
Text put
Now the yanked text is pasted from the th cursor position iti by hitting the p
delete
To delete text, place the cursor in the beginning of the line and give the total number and dd
delete
Now 3 lines are deleted and message get displayed as 3 fewer lines as shown below
Get into insert mode and place the cursor p where the data should be pasted. Press esc to get in to command mode
Search
Get into ex mode type / followed by da a o data to be searched and press enter
Search
When we press enter it shows the first s o s e s found match from bottom to top.
Search
Then if we press n it will shows the second match for that da a we co a data.If e continue ue pressing n it will show successive matches.
Find command
Find: To search files and directories in a specified path. Syntax: find <directory> [conditions] [action] Condition: -name <file name> - to search a particular file -user <user name> - lists the files owned by user. -perm <mode> - search a file depending on permission. permission
Find command
Find command
Locate command
Locate:
To search or locate files and directories from the database. It locate the files faster than the find command
Locate command
Locate command
All the files and directories named test1 is located and displayed. p y
Man command
man : Display helpful information about commands. Syntax: man [option] command Option: k - search by command description rather than k command name.
Man command
Man command
The manual page of ls command is displayed h di l d here.
useradd command
useradd : To create a new user account and login directory for that new account account. Useradd will create new entries in system files. Syntax useradd [options] [user] Options -c Comment field. -d Home directory -e Account expiration date.
useradd command
User named abdulkalam is created.
useradd command
Enter the password.
When new user account is created ,a login directory for the user is created in /home dir.
Passwd file
To view password configuration file.
Passwd file
represents First field Groupid. Userx id. encrypted t d represent password is username. available in shadow file.
Shadow file
Shadow file
Encrypted yp password for the user abdulkalam. abdulkalam
Groups file
To view group file
Groups file
Group id for the user abdulkalam.
User login
Abdulkalam logging in .
User login
User home dir or login dir
userdel command
User account can be deleted through userdel command
Creating groups
New group is created by hand-editing the file /etc/group or by using groupadd command. Syntax: groupadd groupname groupdel command is used to remove the group. Syntax groupdel groupname Groupmod is used to rename the existing groupname. Syntax: groupmod n newname oldname n
Groupadd command
A group is added in the name of india by using the command groupadd.
Usermod command
Groups file
To view group file
Groups file
The id number g group assigned to the g p india is 501 The last field shows the user abdulkalam added in India group
Groupdel command
Group Administration
Group Administration
Group Administration
Group Administration
This shows that the three users are added in the sales group.
Group Administration
Change the group name sales to product directory using chgrp command.
Group Administration
The screen sho s shows that the changes been made in the group field.
Group Administration
Group Administration
Group Administration
The user tom is not a member of the group. f So the permission is restricted.
Group Administration
suresh logs in terminal. As g he is the member of the group, he have the privilege to access the file. file
Group Administration
rajesh logs in terminal. As j g he is the member of the group, he have the privilege to access the file. file
Group Administration
tom logs in terminal. he is g not the member of the group so does not have the privilege to access the file. file
Group Administration
The above screen shows the permission been restricted to the user tom tom.
Changing owner
After giving the The chown chown command command change th filis or h the owner the file changed from directory owner. root to suresh.
Changing owner
The owner and group name can be change using h i chown command.
chage command
The chage command let you specify an expiration limit for a user's account and password . Syntax: chage [option] username Option -l lists the current password expiration l expiration. -m set the min. days to change the password. -M set the max. days to change the password. -E specific expiration date for user account. -I set inactive period (in days) -W warning period number of days before W period, expiration.
User administration
Chage l : lists This field sets the the account and password for the password maximum valid information of days given. user tom.
User administration
The password The M expires field is command with updated as the 100 sets by +100 days from user maximum days. creation date.
User administration
User administration
User administration
The -m option for minimum number o of days a use user can exists with password.
User administration
The -E option is E for specific expiration date for an account.
Set userID
It allows an executable file to run under the user or group security context with the permission of its owner.
SUID can be set as follows: chmod u+s [filename] (or) chmod 4xxx [filename]
Set userID
The passwd is the command which updates d hi h d t the password in the shadow file, instead of not having the execute permission.
The above screen shows file shadow and password along with the set user id permission. permission
Set userID
Set userID
The set userid permission is removed from the /usr/bin/passwd file. file
Set userID
Now we can view that tom user cannot change the password.
Set GroupID
The user suresh who create a file, file the group name is assigned as suresh.
The user suresh logs ge into the ogs get o e product directory and create a file.
Set GroupID
Set GroupID
After setting the group id, user suresh creates a file win98. Using the command ls l shows t at t e e s c eated that the file is created under the group sales.
Sticky bit
The files remove is possible b ibl because the sticky bit is not set to the product directory.
The user rajesh logs and he removes the file bios created by suresh.
Sticky bit
Sticky bit
After assigning the sticky bit, user rajesh try to delete the file created by other user but he is unable to do it it.
Switch user
su command is used to switch to another account from the command line. This command is most often used by system y y administrator to temporarily become the root user without logging out of their non privileged account non-privileged account. Syntax su - [user] -c command
Switch user
Switch user
It executes root privileged command from the ordinary user account. account
Each user can login in each terminal and can do multi processing which avoids logging off from the system system.
Multi user
Multi user
Joe, is the user who log in the second terminal
Multi user
harry, is the user who log in the third terminal
Multi user
wilson, is the user who log in the fourth terminal
Multi user
Multi user
thano, is the user who logs g in the sixth terminal
File Repositioning
Press G, Cursor go to last line of a file. Press 1G, Cursor go to first line of a file 1G file. Press Ctrl+f, Cursor forward one full screen. Press Ctrl+b, Cursor go back one full screen. Press Ctrl+d, Cursor go down half a screen. Press Ct l P Ctrl+u, C Cursor go up h lf a screen. half
Screen Repositioning
Press H, Cursor go to first line on screen. Press M, Cursor go to middle line on screen. Press L, Cursor go to last line on screen. Press Z+Enter, Make current line is first line on screen. Press - (hyphen) screen. Make current line last line on
Filtering
A powerful feature of vi is the ability to include into your document the output of Linux commands. For example if you want to display any command output in your file see following syntax . !!command The syntax will be working in exmod in editor. For example to display date ,type following command in exmod. !!date
Filtering
Filtering
This will replace the current line with output of the date command.
Filtering
The output of the p date command is written here.
Sed Command
Sed command just like find and replace .
To display a file , the Sed command change the particular word in standard input only , but not change original content of file. g g
Sed Command
Sed Command
Here sed command displays the output by replacing the localhost as www.example.com, but it wont write output in the file.
line
Here H you can view i output of test file. Open a file in vi mode.
To display the output of another file named test in the current file.
To write the contents of the existing file in another file named test1.
Set number
File contents.
Set number
Set all
Set all
Redirecting Input
A command which accepts the input from a file is known as Redirecting Input. Syntax - command < file1
A file is created in the name file1 and text is entered i capital l tt t d in it l letters, which i redirected hi h is di t d through < symbol and the command translates the data to d t t small l tt ll letters.
tr translates the upper case letters to lower case.Here output of file v is p redirected as input to the tr command.
Piping
Pipes is used to execute more than one command at a time. See following command. Syntax : Example: command1 | command2 ls -l | more
It is also used to execute command result Example: cat file1 | grep station
Piping
If find command is executed, its output can be stored in file2. if error occurs during execution, the error message is stored in file1. For F example: l find / -name passwd 2> file1 >file2
If there is any g error messages while execution the error message will be redirected to the file ex1.
If there is no error the t t ill b th output will be redirected to the ex2 file.
tee Command
tee is useful to save the output at various stages from al long sequence of pipes. f i Example: ls | tee a1 | ls l | tee b2 l The above example shows the types of ls commands p yp and options are used to store output to the files g1, g2 and g3.
tee Command
It saves the output of ls in file a1 and output of ls l in file b2.
grep command
grep - means general regular expression processor. -it analyze th content of a file a li at a ti it l the t t f fil line t time, returning a line that matches a pattern.
grep command
Grep prints the pattern matched with ganesh in the file /etc/passwd.
awk command
An awk program searches for lines in a file and performs some action on those lines. d f ti th li
awk command
File Compressions
Several compression utilities are available for use on y Linux and Unix system. But most software for Linux system use three compression utilities. 1 - compress 2 - GNU gzip 3 - bzip2.
Compression command
compress: It compresses a file and give the extension as that file. Syntax: compress <filename> fil uncompress: It uncompress the compressed file. Syntax: uncompress <filename> .z for
Compression command
The Th actual l size of file is This 107 bytes. y compresses the file a. The compressed file is i di i indicated by the .z db h extension. Thus the file size is compressed to 39 bytes.
Creating Archives
Tar: tar t command i used t create archives on d i or fil d is d to t hi device files. Originally, tar was used to create archives on tape devices, hence its name stands for tape archive. archive When creating a file for a tar archive, the filename is usually given the extension .tar. tar While tar is seldom used to back up entire file system.
x t -
tar command
It create backup for the files a,b,c,d,e and f in d i backup.tar. The backup files are indicated by .tar extension.
tar command
tf options display all the file in backup .
tvf options displays along with the user and group names.
tar command
If incase we miss the file then we can extract those g file back using xvf options .
Printer-configuration
Command to configure the Printer Pi
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Now the printer configuration are been applying the changes to the system
Printer-configuration
Choose yes you will be getting an test page form the printer
Printer-configuration
Printer-configuration
Printer-configuration
Printer-configuration
Introduction to process
Linux treats each task performed on your system as a process, process which is assigned a number and name name. You can examine this process and even stop them. Red Hat provides several tools for examining processes as well as your system performances. The Th process i easy monitoring i provided b several is it i is id d by l GUI tools,like Red Hat Procman System Monitor.
ps Command
ps command is used to list the process process. To display a information about process specific to the active terminal. Syntax: ps [option] Options available: -a : -x : -l : -u : owner. -e : To view the all process id To di l T display all process, not i l di ll t including process not controlled by a terminal To include all process not controlled by a terminal, such as daemon process. To long list including more information such as process owner's user id. To display user name of the process
pstree command
It shows the h th process ancestry for all process running on the system.
ps a command
Display ll Di l all processes excluding processes not controlled by this terminal.. terminal
ps l command
ps x command
Display ll Di l all processes including processes controlled by this terminal. terminal
ps u command
kill process
Kill command is used to send a particular process to get clear. Syntax : Kill -9 <process id> y p ps - aux is the command to view all process name and id Example: kill -9 3743 (This example shows the kill 9 command, option and the process id to kill.)
kill process
S Syntax : renice - +(minus symbol or plus symbol) i ( i b l l b l) <priority number> -p <process id>
How to execute a command in echo statement echo hostname `hostname` <enter> ec o os a e os a e e e How to execute a variable in echo statement A = 10 echo A value: $A <enter>
Second method is
Syntax
:
Give the execute permission the script file through chmod command Run the file by ./<file name>
Second Method
Arithmetic Calculation
Arithmetic Calculation
Using read statement we read the value for A and B
Partitions
The Linux supports four primary partitions and many logical partitions in the extended partition. The Linux kernel supports maximum number of 63 p partitions on each IDE disk. And maximum of 15 partitions on each SCSI device.
Partition Types
Linux-specific partitions would normally be one of the following types with a unique ID ID. 0X 5 0 X 82 0 X 83 0 X fd 0 X 8e Extended Linux swap Linux Linux RAID Linux LVM
Partitioning
In Linux, partitions can be created by either of the following three utilities f ll i th tiliti fdisk sfdisk disk druid (only available during installation) GNU parted
fdisk
fdisk - Fixed Disk - Menu driven programs to create and delete partitions
Before starting fdisk, identify the hard disk type that is whether primary master or slave and secondary master or slave by using command fdisk -l.
Enter the starting cylinderto create a Type n t or just press T t enterpartitionthe new to take default cylinder
Enter the ending cylinder or type the size in MB. Type w to save and exit from fdisk. fdisk
ext filesystems
ext : E Extended fil d d filesystem. ext2 : Older standard Linux file system supporting for filenames and large file sizes.
ext3 : Standard Red Hat Linux file system, used for all hard disk volumes under Red Hat Linux by default.
It is the extension of ext2 with the feature of journaling (aware of unexpected power outages and disk errors)
Mke2fs command
Mke2fs : This command is used to create file system. Syntax : mke2fs [options] device Example: mke2fs /dev/hda1 (it will create ext2 filesystem for hda1 partition) mke2fs j /dev/hda1 ( will create ext3 filesystem j (it y for hda1 partition)
has_journal represents the ext3 file system thus the ext2 is converted to ext3
Mount command
In I partitions Mount the Linux, like any h Li i i lik other device the hda6 in data1 p partitions should directory and hda7 in be y mounted. data2 directory.
Tune2fs command
tune2fs : It is a command used to converting from ext2 to ext3 file system without un mounting.. Syntax : tune2fs j <partitions> Example: tune2fs -j /dev/hda1
Tune2fs command
Here it converts the file system for hdb6 from ext2 to ext3.
Repair Filesystem
e2fsck : This command checks the consistency of the file system and repair it if it is damaged you can use damaged, file system checking tools. Example : e2fsck /dev/hda1 fsck : This command checks and repair a Linux file system. system Example : fsck /dev/hda1 The main difference is e2fsck it will work in ext2 and ext3 filesystem and fsck will work only in ext3 file system.
Repair Filesystem
fsck and e2fsck are the command used to check and repair the file system. y
Disk usage
df and du are used to check the disk usage.
df
: It reports the amount of space used and available on a mount file system as reported.
du
: It displays directories entries and the number of data block assigned to them them.
df command
df command displays the space used and available in the mounted file systems df -h, displays size in human readable format in the power of 1024 df -H displays the H size in the power 1000 instead of 1024. 1024
du command
du command displays the estimate file space usage available df -h & H, displays size in human readable format in the power of 1024 and 1000 respectively. respectively
Performance tools
free command lists the free ram memory and as well as what is used for buffers and swap memory memory.
free command
free command display information about free and y used memory on the system.
vmstat
Report virtual memory statistics
top
Displays top CPU processes
top
Daemon Process
Some process start at boot time and continue running until the system is shutdown. Such process are known as daemon processes. Two types of daemon process: standalone daemon Transient daemon
Daemon Process
Standalone daemon are a program that run all the time and are started up either directly by init or by a startup script under /etc/rc.d.
Transient d T i t daemon are only started up when th l t t d h they are needed, and are controlled by a standalone daemon called xinetd.
checkconfig command
The chkconfig command can also be used to activate and deactivate services.
The chkconfig --list command displays a list of system services and whether they are started (on) or stopped (off) in runlevels 0-6 0 6.
At the end of the list is a section for the services managed by xinetd.
checkconfig command
chkconfig can also be used to configure a service to be started (or not) in a specific run level. For example, to turn httpd off in runlevels 3, 4, and 5, use the following command:
checkconfig command
checkconfig command
checkconfig command
--list option list --list options This command httpd service used to list httpd p status on p httpd service is service status . stop on runlevel runlevel 0-6. 3-5.
checkconfig command
--list options --list --add Now deletes options used --del optionshows sendmail service is not p tooptionsfor theto alladd a service, links used , there. creating links in list the httpd service in all defaults runlevels. service. runlevel directories.
GRUB
GRUB Grand Unified Boot Loader is a multi boot loader that operates similar to LILO and default boot loader for Redhat Linux. Using GRUB user can select operating systems to run from a menu interface displayed when a system boot up Supports MD5 password protection a boot menu protection, editing mode and a shell like command line interface available at b t ti il bl t boot time.
LILO
LILO means Li Linux l d loader LILO is a program written to boot sector of a disk that loads the OS and starts execution. It is an older version of boot loader of Red Hat Linux. LILO loads the Kernel based on its actual sector location on the disk , rather than its file name
LILO
/etc/lilo.conf lil -v lilo Configuration file To i t ll T install or update th lil d t the lilo boot loader. Test the configuration before installation. To restore the MBR backup.
lilo -t
lilo -u
Grubby
Lilo installation
Check the presence of the lilo package.
Lilo installation
This command displays p y the current boot loader, thus we can see the lilo got installed. installed
Lilo installation
Lilo installation
Before booting Specify which the OS it will Denotes the OS will be Prompt presents to wait for five first stage loaded by boot prompt seconds. boot loader. default. y without any user Locateslthea To di the display intervention. Boots second stage text message It specifies image. kernel the file boot loader. at boot time. that containdual Incase of dimages I f l to be boots it OS it loadedtheto initial RAM disk. other.
Lilo installation
Prompts the user for a password before booting this image. This will prompt for password only when we go to single user mode.
Lilo installation
GRUB installation
/boot/grub/grub.conf This is configuration file for grub boot loader. grub-install /d /hd b i t ll /dev/hda To install the grub boot loader in hda device.
GRUB Configuration
GRUB Configuration
Remove thi options to R this ti t The options rhgb quiet willboot through text start xserver while mode. booting.
Grub Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB Configuration
GRUB installation
Now the boot loader is lilo.
To install grub loader use the command grub-install grub install /dev/hda .
GRUB installation
Open the grub configuratio n file.
GRUB installation
Label for first This representsdefault is If that to ItBoots the kernel loads the initial Flash screenthe be stanza. stanza following filesimage. ero are set di zero RAM toat boot disk. displayed ink5th partition of the then it boot hard disk on time. hd0. through first stanza. Loads the dual OS. Label for second stanza.
GRUB installation
To set password to the grub boot loader.
It gives us the encrypted format of the password. password This password is supposed to be entered in the grub.conf file. This can be done by the following method.
GRUB installation
Following the above command type the password two times, this will append the encrypted password to the grub.conf fil d h b f file.
GRUB installation
GRUB installation
GRUB installation
Just cut and copy the password here. Save the file and restart the system.
GRUB installation
Type p to enter grub b password if you Here you can see the want to go to single g grub loader prompting g user mode. for the OS to boot.
GRUB installation
GRUB installation
Change the command prompt to get in to single user mode to do that press e.
GRUB installation
GRUB installation
Press b to boot.
information to install. Each archive is resides as a single file with a name that ends with .rpm rpm
--force
Forces installation despite conflicts. p Install or remove without doing any dependency checks. p y Automatic dependency to install a package. (While available of package rpmdb-redhat aid option will work)
--nodeps --aid -
For installing the package we must the mount the operating system cd-rom of RHEL and then only we can install the packages.
Go to Redhat directory. di
Go to RPMS directory.
List the files in RPMS directory and we can see that the packages end with an extension .rpm.
rpm qpi shows the information about the package before installation.
To view an IP-address
Two methods available in linux to view the ip address ifconfig : -shows the ip address of the active interfaces with hardware address. -it can show ip address of a particular interface by taking the interface name as argument example: ifconfig eth0 ip a : - simply shows the ip address of all interface.
Ifconfig command
Ifconfig command
ip a command
Assigning ip address
In linux ip address can be assigned by the following methods. netconfig: - to assign permanent ip address to the interface Ifconfig: - to assign temporary ip address to the interface. Syntax: ifconfig <interfacename> <ipaddress> subnetmask <subnetmaskaddress> broadcast <broadcastaddress> Ip a a : - to assign additional ip address temporarily Syntax: ip a a <ip/subnetmaskaddress> dev <interfacename>
Assigning ip address
Assigning ip address
Assigning ip address
Assigning ip address
Assigning ip address
Assigning ip address
When network service is restarted, the ipaddress assigned through ifconfig to the device is removed.
Assigning ip address
To update ip address the network service is restarted. ip a command shows the assigned ip address.
Assigning ip address
Assigning ip address
Ip address can p be removed using ip a d command, once network service is i restarted it get di removed.
Router configuration
The ip_forward file is assigned 1 for enabling the router or 0 for disabling.( This process for temporary.)
The 1 is assigned to enable the router and this file is for setting router in permanent manner.
ping command
It is used to detect whether a system is up and running. Syntax: ping [options] <domainname> or ping [options] <ipaddress> Options: p a audible ping b to ping the broadcast address c stop sending packets after count. t di k t ft t
ping command
ping command
ping command
ping command
-c options stops sending packets after the specified count.
LVM Structure
LVM structure In this structure the LVM physical partitions are also known as extents, are organized into logical groups, which are in turn used by logical volumes.
Physical volume
Physical volume:
It is nothing but hard disk partition that you create with partition creation tools such as parted or fdisk. p p The partitions type can be any standard Linux partitions t titi type, such as ext2 or ext3. h t2 t3
Volume groups
Physical volumes are organized into logical groups, y g g g p , known as Volume groups
Volume groups that operate much like logical hard disk. disk
Logical Volumes
A logical volume is a virtual partition.
One or more physical volumes to be combined in to volume group to construct logical volumes.
lvm
LVM Configuration
Type p to check how Create partition many partitions using fdisk available in hard command disk
LVM Configuration
Here 4 partition is created with equal sizes of 100mb through n option option.
LVM Configuration
Newly created partition is listed below as hdb6,7,8 & 9.
LVM Configuration
LVM Configuration
Here below after giving t option t the partition theis To change id changed to lvm We have to partition id as lvm i h id,mention the use T option. hex code of the partition p
LVM Configuration
Now partition id is changed to 8e(LVM)
LVM Configuration
We save the lvm p partition through g w option. Previous versions of redhat needed to restart system after creating partition. partition In current version to avoid restart we use partprobe.
LVM Configuration
Physical volume is Pvdisplay command created for lvm show the details of partition(hda6.7.8&9) physical volume
LVM Configuration
LVM Configuration
Vgcreate creates vgdisplay command group as displays the test0 for lvm b titi information about i f l i partition hdb6 volume group test0.
LVM Configuration
lvcreate l create creates a logical volume and we assign name as data in the lvdisplay, test0 group displays the information about logical volume.
LVM Configuration
Make2fs, Make2fs creates an ext3 file system for data. (logical l (l i l volume) )
LVM Configuration
The logical volume data is mounted to /data directory. Open fstab file for permanently mounted the logical volume data.
LVM Configuration
LVM Configuration
LVM Configuration
LVM Configuration
Create a big file of size g Here40mb in see there is we can /data directory. no free space available in /data directory .
LVM Configuration
If the space assigned to data is not sufficient, we can resize the logical volume .
Extend create filesystem for Now the logical volume size upto 45mb usingsing p the extended volume using e tended ol me g lvextend command. ext2online. After extending volume now we see the free space available in /data directory.
LVM Configuration
Here we can see only 12mb free space ia available in the volume group. group
LVM Configuration
Now the screen shows that test volume group is vgextend, vgextend extends Note that increased to 200mb. the space from the total allocated size for hdb7. the test0 group is 100 mb.
LVM Configuration
The above command shows the increased space of logical volume data. data
LVM Configuration
Extend the logical volume g size upto 50mb using lvextend command. Now create filesystem for the extended volume using e tended ol me sing ext2online. After extending volume now we see the free space available in /data directory.
LVM Configuration
We can remove logical volume first we must unmount the logical volume (/data directory).
LVM Configuration
LVM Configuration
LVM Configuration
After deactivated the We can the logical Removeremove volume group will be iremoved volume name is data lgroup first we must d t using vgremove decativate the volume using lvremove command. group using vgchange command. command. d
RAID
RAID means Redundant Arrays of Independent Disk. RAID is a method of storing data across several disks to provide greater performance and redundancy. In effect you can have several hard disks treated effect, as just as one hard disk by your operating system.
Types of RAID
RAID can be implemented on a
Hardware level or
Software level
Hardware RAID
On a hardware level, you can have hard disk connected to a RAID controller, usually a special PC card. d Your operating system can accesses storage though the RAID hardware controller.
Software RAID
You can implement RAID as software controller, letting a software RAID controller program. g g The controller program manage access to hard disks treated as RAID device. The software version lets you use IDE hard disks as RAID disk.
Striping
Mirroring
Implements a high level of redundancy. Each drive is treated as mirror for all data.
Distributed Parity
Implements data reconstruction capability using parity information. Parity information is distributed across all drives.
RAID
RAID
Raid Configuration
The partition is lists Now the screen created using the partitions. p fdisk command.
Raid Configuration
4 Partitions is created using n option with equal size of 100 mb
Raid Configuration
Now use p to p check created partitions.
The l option, lists the file system. The fd denotes linux raid
Raid Configuration
The l option, lists the option file system. The fd denotes linux raid
Raid Configuration
To set the partition p type use t options.
Raid Configuration
Raid Configuration
We save the raid partition through w option. Previous versions of redhat needed to restart system after creating partition. In partition current version to avoid restart we use partprobe.
Raid Configuration
Using mdadm tool g creating raid level 5 it use four partition /dev/hda6,7,8&9 and creating raid device is /dev/md0.
Raid Configuration
Raid Configuration
Raid Configuration
Creating ext3 file system for raid device /dev/md0 using mke2fs command.
Raid Configuration
Raid Configuration
mdadm detail command show the detail information about the raid devices. devices
Raid Configuration
Here we see each Its show the raid raid disk major & disk status (weather minor no. . raid disk active or not active ).
Raid Configuration
Raid Configuration
Now raid device (/dev/md0) is i mounted on /data t d /d t directory in /etc/fstab file for permanently.
Raid Configuration
Now go to /data directory and create the file name is file1 using df command showdd command. free f & used space d for the raid devices & partitions.
Raid Configuration
Mdadm query command show the information about particular raid device & partitions. partitions
Raid Configuration
Raid Configuration
Mdadm manage command set fault or fail particular partitions Cat /proc/mdstat (/dev/hda9). command show disk the di k is failed. h disk i f il d
Raid Configuration
Raid Configuration
Now remove the /dev/hda9 partition from the raid device /dev/md0 using Mdadm manage manage command .
Raid Configuration
Here you can see mdadm detail detail command show disk /dev/hda9 is removed.
Raid Configuration
Now add the /dev/hda9 partition from the raid device /dev/md0 using Mdadm manage manage command .
Raid Configuration
Raid Configuration
Here we can see the status of online synchronization of raid disks. disks
Raid Configuration
Now the faulty disk is replaced and we can see the data.
Raid Configuration
Here you can see mdadm detail detail command show disk /dev/hda9 is active.
Disk quota
Disk quota is used to control how much disk space a particular user can access. Quota tools: quotac ec quotacheck quotaon quotaoff edquota repquota
Quota tools
Quotacheck: It scans the file system for the current disk usage and update the aquota.user file. Quotaon: It turns on the quota. t th t Quotaoff It turns off the quota quota. Edquota: It is used to set disk quotas for a user. q Repquota: It displays summary of disk quotas and and the quota usage .
Implementing quota
To implement disk quota for an user, set the user quota for the home directory by replacing its defaults entry with usrquota in fstab file.
The following slides will guide you how to implement disk quota for particular user.
Implementing quota
Open th O the fstab file.
Implementing quota
Implementing quota
Implementing quota
Here Remount thethat you can see the/h quota is not user di /home directory updated for the /home to update. directory.
Now you can see the user quota got assigned to /home directory
Implementing quota
Create quota database file named It aquota.user to hold checks the the quota information validity of quota for all users. database of the /home directory.
Implementing quota
Implementing quota
Implementing quota
Implementing quota
The maximum This soft To setwill just memory limit soft limit Blocks for a user. To set hard represents a spacethe inode . This will issue warning if he Inode representsfor disk deny the user to access, if limit for inode. of files exceeds soft limit. number and space in KB. he exceeds the quota limit. q directories can be accessed by the user.
Implementing quota
Here we set soft Here we set limit Here we set hardhard Here we set limit as 40 KB as 20limit as 50 KB soft limit as 15 inodes .so that memory space . usermemory space . inodes . can access only max of 20 inodes.
Implementing quota
It displays p y summary of disk usage. User jack has a hard User jack has a hard limit (file limit(block limits) of 50KB of 20 inodes and soft limits) and soft limit of 40 KB, he of 15 inodes , he already limit already used 10KB. used 10 inodes.
Implementing quota
User jack created five files without any warnings. But when he create sixth file a warning message is displayed. This indicates the user had exceeded the soft limit.
Implementing quota
Now, when the jack attempt to create more than ten files i.e., i e the eleventh file then write failed message occurs.
Implementing quota
Here jack use dd command to create a file named 1 of 30KB. Since the user exceeds the soft limits a warning messages i occurred. is d
Implementing quota
Here jack attempt to create a file named 2 of 10KB . But since, he has exceeded hard limit i f il d h d li i write failed error occurred.
Implementing quota
Here H we can notice that ti th t the jack had used all this quota. So he is restricted to create files.
mount command
Mount Used to mount a file system It takes two argument : the storage device d the d i and th mounting point. ti i t The device is a special device file that connects the system to the hardware device. Mounting point is directory on which the storage device is to be mounted.
mount command
Syntax: mount [options] <device> <mountpoint> Options: -w -r -t -a mount the file system with read/write permission. mount the file system with read permission. to specify the type of file system to be mounted. mounts all the file systems listed in /etc/fstab.
umount command
It un mounts the mounted file system. The removable media like floppy disk, and cd are un mounted after use, by using umount command.
mounting CD-ROM
mounting CD-ROM
Now we can access the CDROM contents from the mounting mo nting point.
Unmounting cd-rom
Unmounting cd-ROM
To mount the floppy on the mounting point /mnt/floppy. ppy Unmount the floppy after access.
To mount the Mount command hard disk partition (hda3 of ext3 lists the mounted file system) in /data device. directory. directory
Mounting NFS
Mounting NFS (network file sharing) : Before mounting we must know the filesystem are exported by a e o e ou g e us o e esys e a e e po ed remote system. The following command is used to know the directory shared.
showmount e remote_server
When the host and share name are known, the following command is used to connected the network file system to the local file system tree
Mounting NFS
Showmount command displays the shared directory on 192.168.0.253 machines 192 168 0 253 machines. .
Mounting NFS
We mount the el directory from remote machine into our /mnt o r directory .
Mounting NFS
Mounting NFS
Mounting smbfs
Mounting smbfs
Mounting smbfs
Auto mount
/etc/fstab: We can also mount the file system by placing mount information in this file. g y y Using entries in this file the file system can be automatically mounted whenever the system boots. It consists of six field per line for each file system as follows
Auto mount
Auto mount
It represents file ItItrepresents the represents It represents the devices. devices thed Itoptions hsystems. mount dumprepresents different the frequency. fsck. for points. mounting the file system. y
Autofs
Autofs service mounts the file system automatically when the user access the mounting p g point. The autofs to supports the removable media without recurring the user to do any thing more than insert the media Autofs configurations file are /etc/auto.master /etc/auto.misc
/etc/auto.misc: The device to be mounted and the corresponding file system is configured in this file.
It file having This specifies when Map represents information's about to the mounting unmounted the point. theauto mountedto be file systems file mounted. system. d
Key,represents file It ep ese ts the t the name t Ityrepresents ofe thesystem type. subdirectory device to be where the data mounted. can be accessed .
The contents of the cdrom is now available in the mounting point /mnt/cdrom/cd .
As soon as we come out from /mnt/cdrom/cd the file system will get auto at ca y u ou ted automatically unmounted after 10 secounds.
Creating cron
cron tab files are stored in /var/spool/cron. This fil i Thi file is accessed only b th root user, whereas th d l by the t h the other users cannot access. User can access this file by using crontab command.
Creating cron
syntax for crontab: crontab [option] t b [ ti ] Option : -e : edit the crontab file. -l : lists the content of the crontab. -r : remove the content in crontab.
The above command gets executed at 13 hours, 34 minutes as daily basis at same time.
Chkconfig command enables the crond services in runlevel 345 in next boot time.
The above command gets executed at 13 hours, 40 minutes as daily basis at same time.
DNS
DNS - Domain naming system. DNS service l i locates and t t d translates d l t domain names i into corresponding associated IP addresses. DNS configuration. It requires the following software packages to be installed. bi d bind Caching-name server bind-utils bind utils
Service profile
Packages bind, bind-utils, bind bind utils caching-nameserver Configuration files /etc/named/named.conf /var/named/named.local Daemons Port number named 53
DNS Configuration
Install bind-utils Install bind, des w c provides which p ov this package includes many utilities like web page manuals host, dig and and documentation nslookup Install cachingname server which provides a working named.conf configuration file
DNS Configuration
Open this file for mentioning the home directory for DNS.
DNS Configuration
DNS Configuration
DNS Configuration
DNS Configuration
Now you are seeing the contents of named.conf named conf file.
DNS Configuration
This file contains the ip Forward zone mapping address and between fully qualified the to particular ip domain locations of all the dot address. servers.
DNS Configuration
DNS Configuration
Enter the and paste the Copy py p forward file and reverse forward Enter the name. and edit them as zones domain follows. follows name here. Enter th E t the Enter the reverse IP address file name. in reverse order.
DNS Configuration
DNS Configuration
Copying the syntax file named.local to example.for and example.rev. example rev
DNS Configuration
DNS Configuration
Enter the fully qualified name of the name server. Enter the authorised Enter the fully name server for this of qualified name zone. host.
Enter the last number segment of the host address in the reverse zone file.
DNS Configuration
DNS Configuration
DNS Configuration
Canonical name, is used Enter the ip address for to define an alias for a p specified domain name. hostname. Set www as h t S t the cname for server1.example.com.
DNS Configuration
DNS Configuration
DNS Configuration
DNS Configuration
DNS Configuration
In a PTR record, you can specify just that last p yj number segment of the address.
DNS Configuration
DNS Configuration
DNS Configuration
DNS Configuration
Thus the DNS makes it possible to p ping an host by its domain name by resolving the domain name into IP address. address
DNS Configuration
Thus the DNS makes it possible to p ping an host by its domain name by resolving the domain name into IP address. address
DNS Configuration
DNS Configuration
Nslookup is a dns diagnostic tool used to Using nslookup query a dns server. you can identifies nameserver for Using nslookup you can particular doamin. doamin identifies address for Using nslookup you can particular FQDN. identifies FQDN for particular IP address.
DNS Configuration
Thus the DNS makes it possible to ping an host by its domain name by resolving the domain name into IP address.
DNS Configuration
Thus the DNS makes it possible to ping an host by its domain name by resolving the domain name into IP address.
DNS Configuration
DNS Configuration
DNS Configuration
Thus the DNS makes it possible to ping an host by its domain name by resolving b resol ing the domain name into IP address.
DNS Configuration
It shows the simple Using l k U i host,thus its lookup of nslookup you can identifies MX record show the corresponding for ip address to the p particular domain. specified fully quailed domain name. Using nslookup you can identifies nameserver for particular domain.
DNS Configuration
DNS Configuration
In this file we can add In this file we can add additional entry MX(mail y additional entry station105 exchange record ) and it h d d its machine and its corresponding ip address corresponding ip address 192.168.0.100. 192.168.0.100 192 168 0 100
DNS Configuration
DNS Configuration
DNS Configuration
DNS Configuration
Using l k U i nslookup you can identifies MX record for Using nslookup you can particular domain. identifies address for particular FQDN. Using nslookup you can identifies id tifi PTR record for d f particular FQDN.
DNS Configuration
DNS Configuration
Forward zone li the F d lists h name servers outside the network that should be searched when the networks name server fails. fails
Service profile
Packages P k Configurations file Daemons Portnumber 80 httpd htt d /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd conf httpd p
Query a httpd package whether installed or not but the screen shows httpd packages is not installed. installed
Now query the httpd package is package itusing g installed show package is rpm command. installed.
Creating index.html page and place this file in the p /var/www/html/ directory.
After typing save Let us create and quit h lfile. . the file htmlfile fil
Open the mozilla web browser and type the fully qualified domain name in address bar and press enter, it will open corresponding web p g p g page.
To allow only Directives that cana ect ves t at ca be particular user to access overridden by the entries Setting upwe our an .htaccess can add in web site file. /var/www/html/ access y directory session inside control directive . virtualhost session.
Create .htaccess file in htaccess /var/www/html/ directory and open the file fil .
Set full permission for p the htpasswd file to make sure that the user has the execute permission .
When we access the web page the mozilla will prompts for the username and password. password
Access Control
The web access can be controlled by using access control directives such as allow and deny.
Directive deny from host host . Description Determines hosts that can access a given directory: all, or partial or full domain name or ip address. Determines which hosts can access a given directory: all, or partial or full domain name or ip address.
This indicates that we can access th web page the b from any network.
To T access the web page th b only from the above specified network.
Virtual host
Virtual hosts allow you to host multiple domains from a single machine. Apache supports two different type of virtual hosts hosts. Name based Name-based virtual hosts Ip-based virtual hosts p
Here we place two Two domains are domains i the name ip d used inin a single of i i l i address and we can example and test.com place number of in a single ip address domains using single 192.168.0.20. IP address.
A Directory is created in the specified path as above here copy test.com webpage..
It is the proxy caching server used in Linux Linux. Handles the request from the local clients for web access. It supports all popular internet protocols including FTP, Gopher ad HTTP.
Service profile
Packages Configuration files Daemons Port number Squid /etc/squid/squid.conf Squid 3128
Squid Configuration
Squid Configuration
This is the default squid configuration file if we want to change the defaults th d f lt then we can edit dit the file.
Squid Configuration
Squid Configuration
Squid Configuration
Create another acl named thano1 t th 1 to restrict the web t i t th b access by time. Thus here the web server can be accessed during 18:30-19:30 only. The specified range of IP address are allowed to access the web server by assigning them in acl named thano.
Squid Configuration
This deny other IP addresses except the IP addresses mentioned in access lists To allow the access lists allo thano and thano1
Squid Configuration
Squid Configuration
Squid Configuration
Squid Configuration
Squid Configuration
Enter the IP address of the proxy server and the port number. d h b
Squid Configuration
Now the time is in between the access time g given in the acl so we can access web server.
Squid Configuration
Here you can see that the access is denied since the we are not allowed to access the web server in this time time.
To make use of encrypted communications, a client must request the https protocol.
Q y Query is made to check whether the mod_ssl package is installed. not installed if not, install the packages
When we restart the httpd service it will prompts for the password.
Open the mozilla browser and type fully q qualified name in the address bar using https protocol.
After examining accept the certificate temporarily or p y permanent and then click ok.
You can see a warning message indicating that this page can not be read by a third party.
Sendmail Configuration
Sendmail: Red Hat Linux uses S d il as it MTA t d li R d H t Li Sendmail its to deliver messages. It listens for any mail messages received from other hosts and address to user on the network host it serves. It handles the remote messages determining the host messages, to be sent.
- 25(smtp),110(pop) ( p), (p p)
Sendmail Configuration
Query is made to check whether the sendmail package is installed. if not, install , the packages.
Sendmail Configuration
Sendmail Configuration
Sendmail Configuration
Sendmail Configuration
Sendmail Configuration
The cursor finds the 127.0.0.0 127 0 0 0 (this line is default for mail transferring only for local host.
Sendmail Configuration
commentingi this li d i ti line The Th word dnl is added in d d l thidd voids to send of this the the beginning mail to line other systems to comment.
Sendmail Configuration
M4 is a macro language that can help to configure the th sendmail.cf file, using d il f fil i sendmail.mc
Sendmail Configuration
Open the Virtusertable file, for mapping user virtual domain addresses.
Sendmail Configuration
The virutusertable configuration helps to define the domain name along with fully qualified domain name.
Sendmail Configuration