redhat linux basics
TRANSCRIPT
-
8/21/2019 Redhat Linux Basics
1/98
Prepared by : Date : Page Number : 1
Prepared by : Ashish TyagiDivision : GIS
Team : Motorola
-
8/21/2019 Redhat Linux Basics
2/98
Prepared by : Your name Date : Page Number : 2
Training Agenda
Conclusion (Post Quiz,
Review of
Expectations, Feedback)
System Initialization
and shutdown process
Basic System
Configuration Tools
Lunch Break
Bash Shell, Text Processing
and Vi
Users & Groups
Tea Break
File system Basics
Introduction to Linux
(Expectations, Pre-Quiz)
DAY 1
Network Configuration12:30-13:00
Lunch Break13:00-14:00
Filesystem Management11:45-12:30
Tea Break11:30-11:45
NFS, FTP,Troubleshooting15:45-17:30
Installation14:00-15:45
Recap of Day 1,
Package Management
10:00-10:30
Conclusion (Post Quiz, Review
of
Expectations, Feedback)
17:30-18:00
System Services and kernelmodules10:30-11:30
Day 2Start times
-
8/21/2019 Redhat Linux Basics
3/98
Prepared by : Your name Date : Page Number : 3
Purpose
To understand Linux Basics
-
8/21/2019 Redhat Linux Basics
4/98
Prepared by : Your name Date : Page Number : 4
Program Objectives
At the end of this course, you will be able to:
Understand Basics of RedHat Enterprise Linux Manage a Linux based system
-
8/21/2019 Redhat Linux Basics
5/98
Prepared by : Your name Date : Page Number : 5
Ground Rules
In order to ensure the productivity of our training, we willneed to be.
- Punctual..
- Put mobile on vibration and do not receive calls within thetraining room..
- Not dropout from the training withoutpermission..
- Be more interactive.
-
8/21/2019 Redhat Linux Basics
6/98
Prepared by : Your name Date : Page Number : 6
CONTENTS
LESSON 1 Linux BasicsLESSON 2 File system Basics
LESSON 3 Users & Groups
LESSON 4 Bash Shell
LESSON 5 Text Processing and Vi
LESSON 6 Basic System Configuration Tools
LESSON 7 System Initialization and shutdown process
LESSON 8 System Services and kernel modules
LESSON 9 Package Management
LESSON 10 File system Management
-
8/21/2019 Redhat Linux Basics
7/98
Prepared by : Your name Date : Page Number : 7
Contents
LESSON 11 Network Configuration
LESSON 12 Installation
LESSON 13 NFS & FTP
LESSON 14 Troubleshooting
-
8/21/2019 Redhat Linux Basics
8/98
Prepared by : Your name Date : Page Number : 8
Linux Basics
Lesson 1
-
8/21/2019 Redhat Linux Basics
9/98
Prepared by : Your name Date : Page Number : 9
Lesson Objectives
Linux Basics
At the end of this lesson, you will be able to
Understand Linux Basics
-
8/21/2019 Redhat Linux Basics
10/98
Prepared by : Your name Date : Page Number : 10
Linux Origins
1984: The GNU Project and the Free Software Foundation
Creates open source version of UNIX utilities
Creates the General Public License (GPL)
1991: Linus Torvalds creates open source, UNIX-like kernel,
released under the GPL
Ports some GNU utilities, solicits assistance online
-
8/21/2019 Redhat Linux Basics
11/98
Prepared by : Your name Date : Page Number : 11
Different Distributions
Linux distributions are OS based on the Linux kernel Red Hat Enterprise Linux
Suse Linux
Fedora (Open Source project supported by RedHat)
-
8/21/2019 Redhat Linux Basics
12/98
Prepared by : Your name Date : Page Number : 12
Linux principles
Everything is a file (including hardware) Small, single-purpose programs
We can chain programs together to perform complextasks
Configuration data stored in text files
-
8/21/2019 Redhat Linux Basics
13/98
Prepared by : Your name Date : Page Number : 13
Logging in to a Linux System
Two types of logins are possible text-based and graphicallogins
By default Linux system run six virtual consoles and onegraphical console
Server systems often have only virtual consoles Desktops and workstations typically have both
You can Switch among virtual consoles by typing: Ctrl-Alt-F[1-6]
To Access the graphical console Press Ctrl-Alt-F7
Login name and password is required to access
Each user has a home directory for personal file storage
-
8/21/2019 Redhat Linux Basics
14/98
Prepared by : Your name Date : Page Number : 14
The X Window System is Linux's graphical subsystem
Xorg is the particular version of the X Window System usedby Red Hat
Look and behavior depends on the desktop environment used
Two desktop environments are provided by Red Hat
GNOME and KDE Log into a virtual console and run startxto manually start
The X server appears on Ctrl-Alt-F7
-
8/21/2019 Redhat Linux Basics
15/98
Prepared by : Your name Date : Page Number : 15
The root user
The root user is a special administrative account,also called the superuser
root has allmost complete control over the system
Do not login as root unless necessary
Normal (unprivileged) users' potential to do damage ismore limited
Sucan be used to switch to root user as required.
sudo commandruns commandas root idshows information on the current user
-
8/21/2019 Redhat Linux Basics
16/98
Prepared by : Your name Date : Page Number : 16
Running Commands
Commands have the following syntax:command opt ionsarguments
Each item is separated by a space
Options modify a command's behavior Single-letter options usually preceded by -
Can be passed as -x -y -zor -xvz
Full-word options usually preceded by --
EX. --help
-
8/21/2019 Redhat Linux Basics
17/98
Prepared by : Your name Date : Page Number : 17
Getting Help on commands
man and info pages can be used to get help oncommands
man date : will show a help page on date command
info date : will provide more details on command
command--helporh
/usr/share/doc/ directory contains good documentsfor some commands.
-
8/21/2019 Redhat Linux Basics
18/98
Prepared by : Your name Date : Page Number : 18
-
8/21/2019 Redhat Linux Basics
19/98
Prepared by : Your name Date : Page Number : 19
File system Basics
Lesson 2
-
8/21/2019 Redhat Linux Basics
20/98
Prepared by : Your name Date : Page Number : 20
File system Basics
Files and directories are organized into a single-
rooted tree structure File system Hierarchy begins at the rootdirectory,
represented by / character.
Names are case-sensitive
Paths are delimited by / Each shell and system process has a current
working directory(cwd), which is shown bypwdcommand
Names may be up to 255 characters
-
8/21/2019 Redhat Linux Basics
21/98
Prepared by : Your name Date : Page Number : 21
All characters are valid, except the forward-slash Absolute pathnames Begins with a forward slash
Relative pathnames do not begin with a slash andspecify location relative to your current workingdirectory
-
8/21/2019 Redhat Linux Basics
22/98
Prepared by : Your name Date : Page Number : 22
Some Important Directories
Home Directories: /root,/home/username
User Executables: /bin, /usr/bin, /usr/local/bin
System Executables: /sbin, /usr/sbin, /usr/local/sbin
Other Mount points: /media, /mnt
Configuration: /etc Temporary Files: /tmp, /var/tmp
Log files: /var/log/
Kernels and Boot loader: /boot
System Information: /proc, /sys Libraries: /lib, /usr/lib, /usr/local/lib
-
8/21/2019 Redhat Linux Basics
23/98
Prepared by : Your name Date : Page Number : 23
Some Commands
cdchanges directoriescd/home/
To a directory one level up
cd..
To your home directory
Cd ls can be used to list the directory contents.
-l, -ld, -a
cpcopy files and directories
cp file1 file2 destination
-r, -f, -v
mv moves files and directories from one location to other
mv file destination
-
8/21/2019 Redhat Linux Basics
24/98
Prepared by : Your name Date : Page Number : 24
touch- create empty files or update file timestamps
rm- remove files
rm [options]
-r, -f, -v, -i
mkdircreates directories
rmdirremoves empty directories rm -rrecursively removes directory trees
Determining File Content
file
-
8/21/2019 Redhat Linux Basics
25/98
Prepared by : Your name Date : Page Number : 25
Hard Links
A hard link adds an additional pathname to referencea single file One physical file on the file system
Each directory references the same inode number
Increments the link count The rmcommand decrements the link count File exists as long as at least one link remains
When the link count is zero, the file is removed
Cannot span drives or partitions
Syntax: ln f i lename[l inkname]
-
8/21/2019 Redhat Linux Basics
26/98
Prepared by : Your name Date : Page Number : 26
Symbolic or Soft Links
A symbolic link points to another file ls -ldisplays the link name and the referenced file
lrwxrwxrwx 1 u1 u1 11 Sep 25 18:02 sl -> /etc/passwd
lfor symbolic link
Syntax:
ln -s filename l inkname
-
8/21/2019 Redhat Linux Basics
27/98
Prepared by : Your name Date : Page Number : 27
-
8/21/2019 Redhat Linux Basics
28/98
Prepared by : Your name Date : Page Number : 28
Users and groups
Lesson 3
-
8/21/2019 Redhat Linux Basics
29/98
Prepared by : Your name Date : Page Number : 29
Users and groups
Every user is assigned a unique User ID number (UID)UID 0 identifies root
Users' names and UIDs are stored in /etc/passwd
Users are assigned a home directory and a shell
Users cannot read, write or execute each others' files withoutpermission
Users are assigned to groups
Each group is assigned a unique Group ID number (gid)
GIDs are stored in /etc/group
-
8/21/2019 Redhat Linux Basics
30/98
Prepared by : Your name Date : Page Number : 30
Each user is given their own private group Can be added to other groups for additional access
All users in a group can share files that belong to the group
User names are case sensitive To add a new user
useradd options
Options are
-dhome_dir-ccomment
-ginitial_group
-G Secondry Group
-muser's home directory will be created if it does not exist.
-sshell
-
8/21/2019 Redhat Linux Basics
31/98
Prepared by : Your name Date : Page Number : 31
Groupsare logical expressions of organization, tying userstogether for a common purpose.
Users within the same group can read, write, or execute filesowned by the group.
Groups are assigned GIDs which are stored in /etc/group
To add a group
groupadd options
-g gid
When user accounts are created, a private group is alsocreated with the same name
Users are assigned to this private group
User's new files affiliated with this group
-
8/21/2019 Redhat Linux Basics
32/98
Prepared by : Your name Date : Page Number : 32
File Security
Every file is owned by a user and a group If UID matches, userpermissions will apply
if GID matches, grouppermissions will apply
If neither match, otherpermissions will apply
Four symbols are used when displaying permissions:
r: permission to read a file or list a directory's contents
w: permission to write to a file or create and remove files froma directory
x: permission to execute a program or change into a directory
and do a long listing of the directory-: no permission (in place of the r, w, or x)
-
8/21/2019 Redhat Linux Basics
33/98
Prepared by : Your name Date : Page Number : 33
File permissions may be viewed using ls -l
$ ls -l /var/log/xyz
-rwxr-xr-x 1 root root 152147 Jan 1 11:30 /var/log/xyz
File type and permissions represented by a 10-character string
Only root can change a file's owner Only root or the owner can change a file's group
Ownership is changed with chown
chown [-R] user_namef i le|directory
Group-Ownership is changed with chgrp chgrp [-R] group_namef i le|directory
-
8/21/2019 Redhat Linux Basics
34/98
Prepared by : Your name Date : Page Number : 34
To change permission of a file use chmod command
chmod mode
-R option for recursive mode Where modecan be one of the following:
u for user,g for group and ofor other
+for grant and -for denyr, wor xfor read, write and execute
Examples:
ugo+r: Grant read access to all
o-wx: Deny write and execute to others
-
8/21/2019 Redhat Linux Basics
35/98
Prepared by : Your name Date : Page Number : 35
A numeric method can also be used
first digit specifies owner's permissions
second digit specifies group permissions
third digit represents others' permissions
Permission are denoted by
4 (for read)2 (for write)
1 (for execute)
e.g.: chmod 755 datafile.dbf
-
8/21/2019 Redhat Linux Basics
36/98
Prepared by : Your name Date : Page Number : 36
Bash Shell
Lesson 4
-
8/21/2019 Redhat Linux Basics
37/98
Prepared by : Your name Date : Page Number : 37
What is a shell
a shell is a macro processor that executescommands and provides the user interface to theother commands.
Shells also provide a small set of built-in commands(builtins) implementing functionality impossible orinconvenient to obtain via separate utilities. Forexample, cd, break, continue, and exec)
A shell provides access to the services of a kerneland works as a interface between Kernel and user
programs.
-
8/21/2019 Redhat Linux Basics
38/98
Prepared by : Your name Date : Page Number : 38
Bash Shell
There are many shells available for Linux
- sh, csh, ksh, zsh, bash etc. Bash is an acronym for `Bourne-Again SHell'
The Bourne shell is the traditional Unix shell originally writtenby Stephen Bourne. All of the Bourne shell builtin commands
are available in Bash The improvements offered by BASH include:
Command line editing
Unlimited size command history
Job ControlShell Functions and Aliases
-
8/21/2019 Redhat Linux Basics
39/98
Prepared by : Your name Date : Page Number : 39
Using Bash Shell
*- matches zero or more characters ?- matches any single character
Type Tabto complete command lines:
For the command name, it will complete a command
nameFor an argument, it will complete a file name
bashstores a history of commands you've entered,which can be used to repeat commands
Use historycommand to see list of "remembered"commands
-
8/21/2019 Redhat Linux Basics
40/98
Prepared by : Your name Date : Page Number : 40
Use the upand downkeys to scroll through previouscommands
use Ctrl-rto search for a command in command history. To recall last argument from previous command
Esc .
Alt.
A commands output can be redirected to a file> Redirect STDOUT to file
2> Redirect STDERR to file
&> Redirect all output to file
Pipes (the |character) can connect 2 or more commandscommand1| command2
-
8/21/2019 Redhat Linux Basics
41/98
Prepared by : Your name Date : Page Number : 41
Aliases let you create shortcuts to commands
$ alias dir='ls -laF' Use aliasby itself to see all set aliases
-
8/21/2019 Redhat Linux Basics
42/98
Prepared by : Your name Date : Page Number : 42
Text processing and Vi editor
Lesson 5
-
8/21/2019 Redhat Linux Basics
43/98
Prepared by : Your name Date : Page Number : 43
Text processing
To view file Contents use less, moreand cat/textsearches for text
n/Njumps to the next/previous match
To view some lines from starting or end use headand tail
tailf to read subsequent additions to the fileUse -nto change number of lines displayed
To find a keyword in a file use grep
grep user1 /etc/passwd
Use -ito search case-insensitively
-
8/21/2019 Redhat Linux Basics
44/98
Prepared by : Your name Date : Page Number : 44
Use wcto count numbers of lines and word in a file
cat /etc/passwd | wclUse -wfor word count
Use sort to sort contents to STDOUT
sort options file
Common options-rperforms a reverse (descending) sort
-nperforms a numeric sort
-fignores (folds) case of characters in strings
-u(unique) removes duplicate lines in output
Vi Edit
-
8/21/2019 Redhat Linux Basics
45/98
Prepared by : Your name Date : Page Number : 45
Vi Editor
Vi is the standard Unix text editor Three main modes:
Command Mode : Move cursor, cut/paste text,change mode
Insert Mode: Modify text
Ex Mode: Save, quit, etc
Escexits current mode
PressingEsc2 times returns to command mode
-
8/21/2019 Redhat Linux Basics
46/98
Prepared by : Your name Date : Page Number : 46
To start Vi execute..
vi
If the file exists, the file is opened and the contents aredisplayed
If the file does not exist, viwill create it when the edits aresaved for the first time
ibegins insert mode at the current cursor position
a begins in append mode
Aappend to end of line
Iinsert at beginning of line
oinsert a new line belowOinsert a new line above
-
8/21/2019 Redhat Linux Basics
47/98
Prepared by : Your name Date : Page Number : 47
Enter Ex Mode by pressing : in command mode Creates a command prompt at bottom-left of screen
Common write/quit commands::wwrites the file contents to disk
:wqwrites and quits
:q!quits without saving the changes.
To search text in a file/, n for forward search, Nfor backwardsearch
To copy a line press yy, to delete dd, to paste p in
command mode
-
8/21/2019 Redhat Linux Basics
48/98
Prepared by : Your name Date : Page Number : 48
Basic System Configuration Tools
Lesson 6
T t t ' D t d Ti f li
-
8/21/2019 Redhat Linux Basics
49/98
Prepared by : Your name Date : Page Number : 49
To set system's Date and Time from cli
date [MMDDhhmm[YYYY][.ss]]
To check current date and timedate
To find files based on a pattern:
Locate & Find
Locatequeries a pre-built database of paths to fileson the system. Use updatedbto update thedatabase
locate
-iperforms a case-insensitive search
Use find to find files based on a criteria
-
8/21/2019 Redhat Linux Basics
50/98
Prepared by : Your name Date : Page Number : 50
Use find to find files based on a criteria
find [directory...] [criteria...]
Searches directory trees in real-time Slower but more accurate than locate
CWD is used if no starting directory given
Ex. find / -namemyfile.txt
find / -inamemyfile.txtfind /var -useruser2group staff
Criteria are ANDed together by default.
Can be OR'd or negated with -oand -not
find -user joe -o -user jane
A non GUI web browser
-
8/21/2019 Redhat Linux Basics
51/98
Prepared by : Your name Date : Page Number : 51
A non GUI web browser
Links http://www.csc.com
wgetcan be used to retrieve files through http and ftp.
wget ftp://example.com/file1.doc
ssh is a Secure replacement for older remote-access toolslike rsh and telnet.
sshl
ssh root@hostname
Scp is Secure replacement for rcp, used to copy files fromone host to onther over ssh
scp sourcedest inat ion
scp /var/users.txt root@hostname:/root
-r can be used to recursively copy directories
-
8/21/2019 Redhat Linux Basics
52/98
Prepared by : Your name Date : Page Number : 52
Rsync can also be used to copy files from one hostto another. Faster than scp- copies differences in
like filesrsync/var/users.txt root@hostname:/root
lftpis a cli based ftp client
lftp ftp.csc.com
Sftp provide ftp like access over SSH protocol
-
8/21/2019 Redhat Linux Basics
53/98
Prepared by : Your name Date : Page Number : 53
System Initialization and shutdown process
Lesson 7
Boot Sequence Overview
-
8/21/2019 Redhat Linux Basics
54/98
Prepared by : Your name Date : Page Number : 54
Boot Sequence Overview
BIOS Initialization Boot Loader
Kernel initialization
initstarts and enters desired run level by executing:
/etc/rc.d/rc.sysinit
/etc/rc.d/rc and /etc/rc.d/rc?.d/
/etc/rc.d/rc.local
X Display Manager if appropriate
Boot Loader Components
-
8/21/2019 Redhat Linux Basics
55/98
Prepared by : Your name Date : Page Number : 55
Boot Loader
1st Stage - small, resides in MBR or boot sector
2nd Stage - loaded from boot partition Minimum specifications for Linux:
Label, kernel location, OS root filesystem and location of the initialramdisk (initrd)
GRUB the GRand Unified Bootloader
Command-line interface available at boot prompt Boot from ext2/ext3, ReiserFS, JFS, FAT, minix, or FFS file
systems
Configurtion file is /boot/grub/grub.conf
Changes to grub.conf take effect immediately
If MBR on /dev/hda is corrupted, reinstall the first stage bootloaderwith:
/sbin/grub-install
Boot Process
-
8/21/2019 Redhat Linux Basics
56/98
Prepared by : Your name Date : Page Number : 56
Boot Process
Kernel boot time functionsDevice detection
Device driver initialization
Mounts root file system read only
Loads initial process (init)
initreads its configuration file /etc/inittab and startother processes as configured.
Run Levels
-
8/21/2019 Redhat Linux Basics
57/98
Prepared by : Your name Date : Page Number : 57
initdefines run levels 0-6, S, emergency The run level is selected by either
the default in /etc/inittab at boot passing an argument from the boot loader using the command init
To check current and previous run levelsrunlevel
Default run level is specifies in /etc/inittabid:3:initdefault
Run level defines which services to start Each run level has a corresponding directory:
/etc/rc.d/rcX.d
The System V init scripts reside in: /etc/rc.d/init.d
Shutting down the system
-
8/21/2019 Redhat Linux Basics
58/98
Prepared by : Your name Date : Page Number : 58
Shutting down the system
Use Init 0 to switch to run level 0 Shutdownh now to shut down system immediately
-r to reboot the system
a time can also be given
shutdownh hh:mm to shutdown at aspecific time
shutdownh +m to shutdown after m minutes
-
8/21/2019 Redhat Linux Basics
59/98
Prepared by : Your name Date : Page Number : 59
System Services and kernel modules
Lesson 8
What is a Process
-
8/21/2019 Redhat Linux Basics
60/98
Prepared by : Your name Date : Page Number : 60
A process is a set of instructions loaded into memory
Numeric Process ID(PID) used for identification UID, GID determines file system access
Normally inherited from the user executing the command
View Process information with pscommand
psef-e shows extended information
-f shows PPID
-u print process owner
Use Top command to see real time process information
Sending Signals to Processes
-
8/21/2019 Redhat Linux Basics
61/98
Prepared by : Your name Date : Page Number : 61
Sending Signals to Processes
To send signal by PID
kill [signal] p id
Most common signals are
-1, -HUP send signal to process to reread its configuration file
-9 Kill a process forcefully-15 send signal to process to end it.
Run a process in the background
Append an ampersand to the command line firefox &
Cron
-
8/21/2019 Redhat Linux Basics
62/98
Prepared by : Your name Date : Page Number : 62
Cron
Cron is used to schedule process to run at a specifictime.
Crontab entries are saved in a file
Entry consists of five space-delimited fields followedby a command line
One entry per line, no limit to line length
Fields are minute, hour, day of month, month, andday of week
Comment lines begin with # Crontabe to edit crontab.
Managing ServicesC l f d t "S t V" "S V i
-
8/21/2019 Redhat Linux Basics
63/98
Prepared by : Your name Date : Page Number : 63
Commonly referred to as "System V" or "SysV services Several configuration files are often used Most services start one or more processes Services are managed by scripts, found in /etc/init.d/
Examples:/etc/init.d/httpd status
service httpd status
Chkconfig command is used to switch on or off a service at aparticular runlevel.Does not modify current run state of System V serviceschkconfig httpd on ( will switch on httpd service in runlevel 2,3,4and 5)Chkconfig --list httpd ( will display current status at different
runlevels)
xinetd Managed Services
-
8/21/2019 Redhat Linux Basics
64/98
Prepared by : Your name Date : Page Number : 64
g
Less frequently used services are managed by thexinetdservice
Incoming requests are listened by xinetd
Configuration files: /etc/xinetd.conf,
/etc/xinetd.d/ Services can be controlled with chkconf igcommand
chkconf ig t f tp on
Linux Kernel
-
8/21/2019 Redhat Linux Basics
65/98
Prepared by : Your name Date : Page Number : 65
The kernel constitutes the core part of the Linux operating system. It
interacts with hardware and provide resources to application. Some features are
System initialization: detects hardware resources and boots up thesystem.
Process scheduling: determines when processes should run and for howlong.
Memory Management: allocates memory on behalf of running processes.
Security: Constantly verifies filesystem permissions and firewall rules.
Implements standard network protocols and filesystem formats.
Architectures supported are x86, x86_64, IA64/Itanium etc.
Kernels are installed under /boot/vmlinuz-*
Kernel Modules
-
8/21/2019 Redhat Linux Basics
66/98
Prepared by : Your name Date : Page Number : 66
Modules are small kernel extensions that may beloaded and unloaded as required
These Can implement drivers, filesystems, firewall,and more
Modules Are located under /lib/modules/$(uname -r)/ Compiled for a specific kernel version and are
provided with the kernel RPM.
Third party modules may be added as perrequirement
-
8/21/2019 Redhat Linux Basics
67/98
Prepared by : Your name Date : Page Number : 67
lsmodprovides a list of loaded modules
modprobecan load and unload modules modinfodisplays information about any available
module
/etc/modprobe.conf used for module configuration
The initial RAM disk provides modules loaded earlyin the boot process.
This file is located under /boot/initrd-$(uname -r).img
Hardware Devices
-
8/21/2019 Redhat Linux Basics
68/98
Prepared by : Your name Date : Page Number : 68
Files under /dev used to access drivers Block Devices
/dev/hda, /dev/hdc - IDE hard disk, CDROM
/dev/sda, /dev/sdb - SCSI, SATA, or USB Storage
/dev/md0, /dev/md1 - Software RAID Character Devices
/dev/tty[0-6] - virtual consoles
/dev/null, /dev/zero - software Devices
/dev/random, /dev/urandom - random Numbers
Kernel Configuration using /proc
-
8/21/2019 Redhat Linux Basics
69/98
Prepared by : Your name Date : Page Number : 69
g g
/proc is a virtual file system which contains informationregarding running system.
Any modification is not persistent across reboot
It can be used to display process information, memoryresources, hardware devices, kernel memory, etc
Can be used to modify network and memory subsystems ormodify kernel features
Modifications apply immediately
sysctladds persistence to /proc/sys settings
Statements added to /etc/sysctl.conf automatically reflected
under /proc after a reboot
-
8/21/2019 Redhat Linux Basics
70/98
Prepared by : Your name Date : Page Number : 70
Package Management
Lesson 9
Th t t dd ft t R d H t Li
-
8/21/2019 Redhat Linux Basics
71/98
Prepared by : Your name Date : Page Number : 71
There are two ways to add software to Red Hat Linux
- Through source code compilation
- Using RPMcommand
RPM command can be used to install/remove, query andverify installed software.
RPM files have a .rpm extension for naming convention
Primary RPM options includes
Install: rpm -i, --install
Upgrade: rpm -U, --upgrade
Freshen: rpm -F, --freshen
Erase: rpm -e, --erase
To install a rpm use
-
8/21/2019 Redhat Linux Basics
72/98
Prepared by : Your name Date : Page Number : 72
rpm -i use -v for verbose installation
use -h to print hash mark to show installation progressrpm -ivh httpd-doc.i386.rpm
To remove a rpm userpme
To query a rpm userpmq rpmqi will show information about a particulatpackagerpm -qalists installed packagesrpmqa | grep will show whether a particularrpm is installed or not.
To upgrade a installed rpm
-
8/21/2019 Redhat Linux Basics
73/98
Prepared by : Your name Date : Page Number : 73
rpmU
Kernel RPM are never upgraded usingU option To install a kernel rpm first install the rpm
To verify a installed package for integrity
rpm -V
rpmVp to verify a package beforeinstallation
-
8/21/2019 Redhat Linux Basics
74/98
Prepared by : Your name Date : Page Number : 74
File system Management
Lesson 10
a file systemis a method for storing and organizingcomputer files and the data they contain to make it
-
8/21/2019 Redhat Linux Basics
75/98
Prepared by : Your name Date : Page Number : 75
computer files and the data they contain to make iteasy to find and access them.
File systems use a data storage device such as ahard disk or CD-ROM.
More formally, a file system is a special-purposedatabase for the storage, organization, manipulation,
and retrieval of data. Linux provides many types of file systems like ext2,
ext3, reseirfs, Vfat etc.
Ext3 is the default filesystem for RedHat Linux.
Ext3 is journaling based filesystem.
Adding New Filesystems
-
8/21/2019 Redhat Linux Basics
76/98
Prepared by : Your name Date : Page Number : 76
Identify Device
Partition Device
Make File system
Label File system
Create entry in /etc/fstab
Mount New Filesystem
Disk Partitioning
-
8/21/2019 Redhat Linux Basics
77/98
Prepared by : Your name Date : Page Number : 77
Total maximum number of partitions supported by the kernel
are63 for IDE drives
15 for SCSI drives
Why should we partition drives
containment, performance, quotas, recovery Partitions can be created using fdiskcommand.
fdisk
fdiskl to display current partition table on all the devices
Run partprobecommand to reinitializes the kernel's in-memory version of the partition table
Use mkfs to make a new filesystem
-
8/21/2019 Redhat Linux Basics
78/98
Prepared by : Your name Date : Page Number : 78
mkfs[ -V] [ -tfstype] [ fs-options]
mkfsVt ext3 /dev/hda1 mount the device to a mount point to make it usable
mountto
-t to specify filesystem type-o to specify mounting options
mount /dev/hda1 /mnt/
Add the filesystem to /etc/fstab to make the mount
persistent across reboot.
Use umount to unmount a mounted filesystem.
Use the remount option to change a mounted
-
8/21/2019 Redhat Linux Basics
79/98
Prepared by : Your name Date : Page Number : 79
Use the remountoption to change a mountedfilesystem's options
mount -o remount,ro /data
-
8/21/2019 Redhat Linux Basics
80/98
Prepared by : Your name Date : Page Number : 80
Network Configuration
Lesson 11
Drivers for network interface cards are built as modules
/etc/modprobe conf maps logical names to specific mod les
-
8/21/2019 Redhat Linux Basics
81/98
Prepared by : Your name Date : Page Number : 81
/etc/modprobe.conf maps logical names to specific modules:
alias eth0 3c59x
interface names for Ethernet cards are eth0, eth1 and so on
Loopback adapter is named as lo
Display network interfaces by using
ifconfiga
Enable interface with ifup ethX
Disable interface with ifdown ethX
Device configuration is stored in text files
/etc/sysconfig/network-scripts/ifcfg-ethX
Global Settings are stored in /etc/sysconfig/network
NETWORKING es
-
8/21/2019 Redhat Linux Basics
82/98
Prepared by : Your name Date : Page Number : 82
NETWORKING=yesHOSTNAME=server1.example.comGATEWAY=192.168.2.254
Domain Name Service translates hostnames tonetwork addresses
DNS Server address is specified by dhcp or in/etc/resolv.conf
search example.com cracker.orgnameserver 192.168.0.254
nameserver 192.168.1.254
Device Aliases
-
8/21/2019 Redhat Linux Basics
83/98
Prepared by : Your name Date : Page Number : 83
We can Bind multiple IP addresses to a single NIC
eth1:1eth1:2
Make a separate configuration file for each virtual interfaceifcfg-ethX:x
Aliases must be configured to use static IPs, they can not be
configured using DHCP To verify network connectivity use
ping /etc/hosts is a local database of hostname to IP address
mappings /etc/nsswitch.conf sets precedence of DNS versus /etc/hosts
-
8/21/2019 Redhat Linux Basics
84/98
Prepared by : Your name Date : Page Number : 84
Installation
Lesson 12
Anaconda is the Red Hat Enterprise Linux Installer Consists of two stages:
Fi t t t t th i t ll ti
-
8/21/2019 Redhat Linux Basics
85/98
Prepared by : Your name Date : Page Number : 85
First stage starts the installationSecond stage performs the installation
The first stage consists of a installation kernel and aninitrd.img
Tasks of the First Stage:Initializes the InstallerParses command line arguments
Autodetects hardwareLoads additional driversSelects language, keyboard layout and installation methodSets up networking if required for installation
Task of second stage installer areLanguage and keyboard selectionInstallation Key
-
8/21/2019 Redhat Linux Basics
86/98
Prepared by : Your name Date : Page Number : 86
Installation KeyDisk partitioningBootloader configurationNetwork and time zone configurationPackage selection
Installation can be done in graphical mode or text mode
Available Installation Methods areLocal CDROMHard driveNFS imageFTP
HTTP
-
8/21/2019 Redhat Linux Basics
87/98
Prepared by : Your name Date : Page Number : 87
Partitioning layout must contain / and swap partition
Other partitions may be created like /var, /home etc.
Partitions can use software RAID and LVM
A default set of packages is automatically installed
Select Customize now to change the default set ofpackages
Packages can also be added after system is installed
L 13
-
8/21/2019 Redhat Linux Basics
88/98
Prepared by : Your name Date : Page Number : 88
NFS and FTP
Lesson 13
File Transfer Protocol
-
8/21/2019 Redhat Linux Basics
89/98
Prepared by : Your name Date : Page Number : 89
File Transfer Protocol(FTP) is a network protocol used to
transfer data from one computer to another through a networksuch as the Internet.
FTP is a file transfer protocol for exchanging and manipulatingfiles over a TCP computer network. An FTP client mayconnect to an FTP server to manipulate files on that server.
FTP sites are typically used for uploading and downloadingfiles to a central server computer, for the sake of filedistribution
In order to download and upload files to an FTP site, youneed to connect using a FTP client program.
vsftpd- the default Red Hat Enterprise Linux ftpserver
-
8/21/2019 Redhat Linux Basics
90/98
Prepared by : Your name Date : Page Number : 90
Allows system, anonymous or user access
/etc/vsftpd/vsftpd.conf is the main configuration file
It is a SystemV-managed service
Package required for FTP is vsftpd
Daemon is/usr/sbin/vsftpd Script is /etc/init.d/vsftpd
FTP uses Port 21 (ftp) and 20 (ftp-data)
Configuration files are /etc/vsftpd/vsftpd.conf
/etc/vsftpd.ftpusers /etc/pam.d/vsftpd
NFS
-
8/21/2019 Redhat Linux Basics
91/98
Prepared by : Your name Date : Page Number : 91
Network File System(NFS) is a network file systemprotocol originally developed by Sun Microsystems in1984.
It allows a user on a client computer to access filesover a network
The server implements NFS daemon processes inorder to make its data generically available to clients
The client machine can requests access to exported
data, typically by issuing a mount command.
Exports are listed in /etc/exports
Each entry specifies the hosts to which the filesystem is
-
8/21/2019 Redhat Linux Basics
92/98
Prepared by : Your name Date : Page Number : 92
y p yexported plus associated permissions and options
Server notified of changes to exports list with exportfs -rorservice nfs reload
The NFS server is an RPC service and thus requiresportmap
It is a System V-managed service
Package required is nfs-utils
Daemons are rpc.nfsd, rpc.lockd, rpciod, rpc.mountd,rpc.rquotad, rpc.statd
Use showmount -e hostnameto show available exports on a
server.
/etc/exports syntax is/some/directory Host(options)
-
8/21/2019 Redhat Linux Basics
93/98
Prepared by : Your name Date : Page Number : 93
/some/directory Host(options) When specifying hostnames, use the following methods
single hostWhere one particular host is specified with afully qualified domain name, hostname, or IP addresswildcardsWhere a * or ? character is used to take intoaccount a grouping of fully qualified domain names that matcha particular string of letters.
*.csc.comIP networksAllows the matching of hosts based on their IPaddresses within a larger network. For example,192.168.1.0/24
Default options arero, sync, root_squash
Lesson 14
-
8/21/2019 Redhat Linux Basics
94/98
Prepared by : Your name Date : Page Number : 94
Troubleshooting
Lesson 14
Filesystem Recovery
-
8/21/2019 Redhat Linux Basics
95/98
Prepared by : Your name Date : Page Number : 95
Filesystem recovery may be needed after crash or
improper shutdown
journal indicates if recovery is needed
only need to check files recorded in journal
/etc/rc.d/rc.sysinitruns fsckon filesystems markedin /etc/fstab
fsck is a front end to other programs
A failed fsck must be run manually
Rescue Environment
-
8/21/2019 Redhat Linux Basics
96/98
Prepared by : Your name Date : Page Number : 96
Required when root filesystem is unavailable
Boot from CDROM (boot.iso or CD #1)
Type Linux rescue at the installation prompt
Anaconda will ask if filesystems should be mounted
Currently installed environment will be mountedunder /mnt/sysimage
Run chroot /mnt/sysimage to access currentlyinstalled environment.
Type exit when done to reboot the system.
END
-
8/21/2019 Redhat Linux Basics
97/98
Prepared by : Your name Date : Page Number : 97
Thank you for your attention!!
Any Questions?
Trainer Contacts
-
8/21/2019 Redhat Linux Basics
98/98
Prepared by : Your name Date : Page Number : 98
Seat No: SA 77Ext. no. 709363
Mobile no. 9310470605
Training material will be uploaded on TPD
(Training Process Database IN-NDA02)