Professional Documents
Culture Documents
using RPM
RPM - Red Hat Package Manager
RPM
• RPM (Red Hat Package Manager) is an default open
source and most popular package management
utility for Red Hat based systems like (RHEL, CentOS
and Fedora).
• The tool allows system administrators and users to
install, update, uninstall, query, verify and manage
system software packages in Unix/Linux operating
systems.
RPM Package
• RPM packages have file names like
xyz-1.0-1.i386.rpm
where package name (xyz),
version (1.0),
architecture (i386)
Some Facts about RPM
• RPM is free and released under GPL (General
Public License).
Types of Kernel
To Log Out:
Monolithic Kernel
❑ The user services and the kernel services are implemented in
the same memory space
❑ i.e. different memory for user services and kernel services are
not used in this case. In monolithic approach the size of the
Kernel is increased and this, in turn, increases the size of the
Operating System.
❑ i.e. we use separate User Space and Kernel Space in case of the
Microkernels. This separation of user space and kernel space, in
turn reduces the size of the Kernel and thus reduces the size
of Operating System.
Process Management
Memory Management
Scheduling
The kernel uses Scheduling Algorithms to determine which process is running next
and how much time it will be given
Linux Kernel Management – Basic Functions
Protection from the error and malicious behaviour is done by the kernel
Installing a kernel in Linux
There are two methods to install a kernel :
➢Verify kernel
• For Linux, the two most common boot loaders are known as LILO (LInux
LOader) and LOADLIN (LOAD LINux). An alternative boot loader, called GRUB
(GRand Unified Bootloader), is used with Red Hat Linux.
• LILO is the most popular boot loader among computer users that employ
Linux as the main, or only, operating system.
Linux Booting process
1. BIOS : BIOS stands for Basic Input/Output System
• BIOS, in full Basic Input/Output System, computer program that is typically stored in EPROM and
used by the CPU to perform start-up procedures when the computer is turned on.
• Once the boot loader program is detected and loaded into the memory, BIOS gives the control to
it. So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR : MBR stands for Master Boot Record.
executes the /sbin/init program. Since init is the 1st program to be executed by
Linux Kernel, it has the process id (PID) of 1. initrd stands for Initial RAM Disk.
• initrd is used by kernel as temporary root file system until kernel is booted and
the real root file system is mounted. It also contains necessary drivers compiled
inside, which helps it to access the hard drive partitions, and other hardware.
5. init
• It looks at the /etc/inittab file to decide the Linux run level. Following are the
available run levels
a. Run level 0 is matched by poweroff.target (Halt)
b. Run level 1 is matched by rescue.target (Single user mode)
c. Run level 2 is emulated by multi-user.target (Multi-user mode without
networking)
d. Run level 3 is emulated by multi-user.target (Multi-user mode with
networking)
e. Run level 4 is unused. (user definable)
f. Run level 5 is emulated by graphical.target
g. Run level 6 is emulated by reboot.target (Reboot)
Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run
level. Typically the default run level is set to either 3 or 5.
6. Run-level Programs
• When the Linux system is booting up, various services can be seen getting
started. For example, it might say “starting sendmail …. OK”. Those are
the runlevel programs, executed from the run level directory as defined
by your run level. Depending on the default init level setting, the system
will execute the programs from one of the following directories.
1. Run level 0 – /etc/rc.d/rc0.d/
2. Run level 1 – /etc/rc.d/rc1.d/
3. Run level 2 – /etc/rc.d/rc2.d/
4. Run level 3 – /etc/rc.d/rc3.d/
5. Run level 4 – /etc/rc.d/rc4.d/
6. Run level 5 – /etc/rc.d/rc5.d/
7. Run level 6 – /etc/rc.d/rc6.d/
MODULE IV
NETWORKING IN LINUX
Network Interfaces
❑ lo (Loopback) : Loopback address – 127.0.0.1
❑ wlan0 (wifi)
Network Manager
❑ The default networking service is provided by NetworkManager, which is a dynamic network
control and configuration daemon to keep network devices and connections up and active when
they are available.
❑ NetworkManager is installed by default on Red Hat Enterprise Linux. If it is not, enter as root:
# yum install NetworkManager
❑ To start NetworkManager:
# /etc/init.d/network start
# /etc/init.d/network stop
Configuring IP Networking with ip commands
➢ We can configure a network interface using the ip command, but changes are not
persistent across reboots; when you reboot, you will lose any change.
➢ The ip utility can be used to assign IP addresses to an interface with the following form:
• There are two techniques commonly used for sharing printers on a corporate
network. One technique is to use the sharing services provided by Samba. The
other approach is to use the traditional Unix lpr command and an lpd server or
Common Unix Printing Service (CUPS) for setting up shared printers.
Firewall Services
• A Firewall is a network security device that monitors and filters
incoming and outgoing network traffic based on an
organization's previously established security policies.
➢PRIMARY PARTITION
➢EXTENDED PARTITION
➢LOGICAL PARTITION
Initially, a hard disk drive could be divided in to two partitions called the primary
partition and extended partition. Information about the partitions in a computer is
included in the Partition table, which is located in the Master Boot Record.
TYPES OF PARTITION
➢PRIMARY PARTITION
A disk drive can contain a maximum of four primary partitions or three
primary partitions and a single extended partition. A primary partition
can be used to boot an Operating System. Boot files should be located
in a primary partition.
TYPES OF PARTITION
➢EXTENDED PARTITION
• Only a single extended partition can be contained in a hard disk. But the
extended partition could be subdivided in to several partitions called logical
partitions.
• Extended partition can be used for storing user data. (files, images, video etc)
PRIMARY V/S EXTENDED PARTITION
c - toggle the dos compatibility flag s - create a new empty Sun disklabel
o - create a new empty DOS partition table x - extra functionality (experts only)
Creating and Managing File Systems
File System
Linux offers many file systems such as Ext, Ext2, Ext3, Ext4, JFS, XFS and swap etc..
1. Ext, Ext2, Ext3 and Ext4 file system
❑ The file system Ext stands for Extended File System. The Ext file system is an older version, and
is no longer used due to some limitations.
❑ Ext2 (Second extended file system) is the first Linux file system that allows managing two
terabytes of data.
❑ Ext3 (Third extended file system) is an upgraded version of Ext2 and contains backward
compatibility. This file system does not support file recovery and disk snapshot.
❑ Ext4 (Fourth extended file system) is the faster file system among all the Ext file systems. It is
the default file system in Linux distribution.
Types of Linux File System
JFS stands for Journaled File System Journaling file systems keep a log called the
journal, that keeps track of the changes made to a file but not yet permanently
committed to the disk so that in case of a system failure the lost changes can be
brought back.
XFS File System : XFS file system was considered as high-speed JFS, which is
developed for parallel I/O processing. NASA is still using this file system with its
high storage server (300+ Terabyte server).
Swap File System : The swap file system is used for memory paging in Linux
operating system.
Mounting
• Mounting is a process by which the operating system makes files and directories on a storage
device (such as hard drive, CD-ROM, or network share) available for users to access via the
computer's file system.
• All files accessible in Unix/Linux, are arranged in one big tree: the file hierarchy, rooted at /
• The mount command attaches a file system, located on some device or other, to the file tree.
Conversely, the umount command will detach it again.
The standard form of the mount command is:
mount -t type device dir
• This tells the kernel to attach the filesystem found on device (which is of type type) at the
directory dir.
Eg. mount /dev/sdb1 /mnt/media (This mounts the /dev/sdb1 file system into the
/mnt/media directory)
/etc/fstab
▪ The /etc/fstab file is one of the most important files in a Linux-based system, since it stores
static information about filesystems, their mountpoints and mount options.
▪ It is a system configuration file that contains all available disks, disk partitions and their
options. Each file system is described on a separate line.
▪ The /etc/fstab file is used by the mount command, which reads the file to determine which
options should be used when mounting the specified device.
umount command
To unmount a file system, use the umount command. The command format is :
umount [-f] directory
where directory is the directory to be unmounted. –f : force an unmount
For example:
[root@rhel] # umount /mnt/media
unmounts the partition mounted on the /mnt/media directory.
The umount command detaches the specified file system(s) from the file
hierarchy.
Symbolic Links and Hard Links
A link in UNIX is a pointer to a file. Like pointers in any programming languages, links in
UNIX are pointers pointing to a file or a directory. Creating links is a kind of shortcuts to
access a file. Links allow more than one file name to refer to the same file, elsewhere.
There are two types of links :
Soft Link or Symbolic links - A soft link is a short pointer file that links a filename to a
pathname. It's nothing more than a shortcut to the original file, much like the Windows OS's
shortcut option. The soft link serves as a pointer to another file without the file's actual
contents. It allows the users to delete or the soft links without affecting the original file's
contents.
Hard Links – It is a copy of the original file that serves as a pointer to the same file, allowing
it to be accessed even if the original file is deleted or relocated.
The "ln" command is used to make a hard link in Linux. On the other hand, the command for a
soft link is "ln -s".
Symbolic Links and Hard Links
A symbolic or soft link is an actual link to the original file, whereas a hard link is a mirror copy
of the original file. If you delete the original file, the soft link has no value, because it points to
a non-existent file.
But in the case of hard link, it is entirely opposite. Even if you delete the original file, the hard
link still has the data of the original file. This is because hard link acts as a mirror copy of the
original file.
ln -s sourcefile softlinkfile
//above command creates a soft link of sourcefile
ln sourcefile hardlinkfile
//above command creates a hardlink of sourcefile