You are on page 1of 24

Introduction to Linux

Instructors info

Instructor : NGUYEN PHUONG QUAN


Mobi

: 0972.259.260

Email

: nguyenphuongquan@gmail.com

Com

: SHB

Linux Professional Institute Certification


Junior Level Administration (LPIC-1)

Work at the command line.


Perform basic maintenance tasks.
Install and configure a workstation

Advanced Level Administration (LPIC-2)

Administer a small to medium-sized site containing


Microsoft and Linux servers.
Supervise assistants.
Advise upper manangement.

Senior Level Administration (LPIC-3)

Histoy of LINUX, UNIX


1983: GNU
1985: GPL

1991: Linux
1994: Redhat
Linus Torvald

Tux

2001: Linux 2.4

LINUX VS UNIX

Linux

Unix

1. Linux Installation

2. Linux Boot Process

Linux Installation

Linux Installation

File System Overview


Linux filesystem is a single tree with the /
directory as its root directory.
You create the single tree view of the
filesystem by mounting the filesystems on
different devices at a point in the tree called
a mount point
Files or subdirectories that were already in
mountpoint are no longer visible when new
filesystem is mounted there

Filesystem Hierarchy Standard

Partitions
Three types of partition on hard
drives: primary, logical, and extended
The partition table is located in the master boot
record (MBR) of a disk
When more than 4 partitions are required, one of
the primary partitions must become an extended
partition
Linux numbers primary or extended partitions as 1
through 4
If logical partitions are defined, they are
numbered starting at 5

Recommended Partition Scheme


Mountpoint

swap

Size
Description
4GB or
Contains all directories not
more
present on other filesystems
2 x RAM size used to support virtual memory

/boot

100MB

/home

200MB per
user
2GB or
more

/var
/tmp

As much as
possible

Contains the Linux kernel and


boot files
Default location for user home
directories
Contains log files and spools
Holds temporary files created by
programs

Linux Installation Process


1. Boot from an installation source
2. Select installation mode
3. Select language and keyboard layout
4. Partition the hard disk
5. Select boot loader options
6. Configure network interfaces
7. Select time zone
8. Set roots password
9. Customize software packages to be installed
10. Start the installation

Linux Boot Process

Boot Loader PrinciplesLinux


1. Boot process begins with the BIOS
2. BIOS load the MBR (primary boot loader code)
3. Primary boot loader either:
A. Loads the boot sector from bootable primary partition
(secondary boot loader), which continues the process by
loading an OS kernel. DOS and Windows use this.
B. Load the OS kernel directly (bypass the secondary boot
loader). Linux supports this.

Linux boot loader


LILO (LInux LOader) or GRUB (GRand Unified
Bootloader)
Can be installed in MBR or boot sector of primary
bootable partition.
Trouble comes if your system is dual-boot (Windows
+ Linux)
Install LILO/GRUB in MBR: can be wiped out if you re-installing
Windows
Install LILO/GRUB in boot sector: remain intact, although Windows
might configure the system to bypass it.
This partition must be a primary partion
You must you FDISK to re-mark the Linux partition as the boot partitoin

LILO vs GRUB
LILO

GRUB

/etc/lilo.conf

/boot/grub/grub.conf
or
/boot/grub/menu.lst

Support booting from a


network

No

Yes

Command to install

lilo

grub-install

Require re-install after


changing configuration file

Yes

No

Configuration file

Example of grub.conf

Example of lilo.conf

Linux boot process


System booting process:
1.
2.
3.
4.
5.

System is power on, CPU runs the BIOS


BIOS load the primary boot loader in MBR
Primary boot loader load secondary loader in boot sector
Boot loader load the Linux kernel
Linux kernel initializing devices, mounting root partition
and run /sbin/init
6. /sbin/init read /etc/inittab to determine what other
program to run based on default runlevel

Extracting information about the boot process:


dmesg | less
less /var/log/messages

Runlevel

The System Startup Scripts


Runlevel specific scripts are stored in /etc/rc.d/rc?.d
or /etc/init.d/rc?.d
All scriptss name are begin with S or K
Example: S10network, K35smb
Scripts are actually symbolic links to main scripts in
/etc/rc.d or /etc/init.d/
When entering a runlevel, rc:
pass start parameter to S* scripts
pass stop parameter to K* scripts

Managing Runlevel
View default runlevel
grep :initdefault: /etc/inittab
View current runlevel:
runlevel
Change to another runlevel:
telinit runlevel
List the services and their applicable runlevels:
chkconfig --list [servicename]
Modify the runlevels in which a services run
chkconfig --level runlevels servicename {on|off|reset}
Example: chkconfig --level 345 nfs-common on

Text-based menu driven tools:


ntsysv

Exercise
1. Login as root in graphical mode
2. Learn your current runlevel with runlevel

3. If your system reports its in runlevel 5, type telinit 3 to switch


to runlevel 3. See whats difference?
4. Return to your orginal runlevel with telinit 5
5. Edit /etc/inittab and change the default runlevel to 3
6. Reboot the computer by typing reboot now or shutdown -r
now
7. Login as root again and type runlevel to verify that youre
running in the runlevel you specified in step 5
8. Edit /etc/inittab to restore it to its original state
9. Type telinit 6. This enters runlevel 6, which reboot the system.

Q&A

Thank You