Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mobile operating system wikipedia , lookup

Distributed operating system wikipedia , lookup

Process management (computing) wikipedia , lookup

Burroughs MCP wikipedia , lookup

RSTS/E wikipedia , lookup

DNIX wikipedia , lookup

VS/9 wikipedia , lookup

Spring (operating system) wikipedia , lookup

Plan 9 from Bell Labs wikipedia , lookup

Master boot record wikipedia , lookup

CP/M wikipedia , lookup

Unix security wikipedia , lookup

Booting wikipedia , lookup

Linux kernel wikipedia , lookup

Linux wikipedia , lookup

Windows NT startup process wikipedia , lookup

Caldera OpenLinux wikipedia , lookup

Linux adoption wikipedia , lookup

Security-focused operating system wikipedia , lookup

Smallfoot wikipedia , lookup

Transcript
Chapter 9:
Understanding System
Initialization
The Complete Guide To Linux System
Administration
Objectives
• Describe how standard PC hardware starts an
operating system
• Configure how the LILO or GRUB boot loader
starts the Linux kernel
• Configure the init program and the scripts used to
start system services
• Manage system services after start-up
The Complete Guide to Linux System Administration
2
Hardware Initialization
• Basic process for bootstrapping
– CPU begins executing commands in BIOS
– BIOS passes control to boot loader
– Boot loader passes control to Linux kernel
The Complete Guide to Linux System Administration
3
Hardware Initialization (continued)
• After PC-type computer started:
– CPU initializes itself
• Sends signals to control other parts of computer
– BIOS performs power-on self test (POST)
• Checks memory and other hardware
– BIOS sends signal to SCSI controller card telling it
to initialize itself
• SCSI controllers usually contain own BIOS
The Complete Guide to Linux System Administration
4
Hardware Initialization (continued)
• After PC-type computer started (continued):
– Other hardware components instructed to initialize
themselves
– BIOS determines which devices to search for
operating system
• BIOS loads boot loader into memory and passes
control it
The Complete Guide to Linux System Administration
5
Hardware Initialization (continued)
The Complete Guide to Linux System Administration
6
The Boot Loader
• Boot loader or boot manager
– Small program loaded by BIOS
• Commonly used
– LILO (Linux loader)
– GRUB (grand unified boot loader)
• Default on most systems
• BIOS looks for executable program in first sector
of 3.5-inch disk or CD-ROM
The Complete Guide to Linux System Administration
7
The Boot Loader (continued)
The Complete Guide to Linux System Administration
8
The Boot Loader (continued)
• Chained boot loader
– One boot loader passes control to another boot
loader instead of operating system
• Use boot loader to start different versions of
Linux installed on separate partitions
The Complete Guide to Linux System Administration
9
The Boot Loader (continued)
• uname command
– Display information about kernel
– Full version number of current kernel
• uname -a
– Timestamp of kernel
• uname -v
The Complete Guide to Linux System Administration
10
Starting the Kernel
• Initial piece of kernel
– Loads rest of kernel into memory
– Uncompresses it
• dmesg command
– View messages stored by kernel during boot
process
The Complete Guide to Linux System Administration
11
Starting the Kernel (continued)
The Complete Guide to Linux System Administration
12
Starting the Kernel (continued)
• Kernel ring buffer
– Area of memory
– Stores messages from kernel
The Complete Guide to Linux System Administration
13
Using Boot Parameters
• Boot parameters
– Instruct Linux how to operate or access parts of
computer system’s hardware
– Use to activate features of Linux
• To enter
– GRUB
• Press “a”
– LILO
• Enter after operating system name
The Complete Guide to Linux System Administration
14
Configuring Boot Loaders
• Configuration files
– Created by installation program
– Examine how boot loader operates
– Usually no need to change
The Complete Guide to Linux System Administration
15
Using LILO
• Simpler than GRUB
• To use
– Create configuration file describing operating
systems LILO should start
– Run lilo command
• Examines lilo.conf file
• Stores appropriate information in either
– MBR
– Boot record you have indicated
The Complete Guide to Linux System Administration
16
Using LILO (continued)
• Boot image
– Each version of Linux
• Parameters
–
–
–
–
boot
delay
image
other
The Complete Guide to Linux System Administration
17
Using GRUB
• Installed by default for many versions of Linux
• /boot/grub/grub.conf
– Configuration file for GRUB
– Similar in layout and syntax to lilo.conf
The Complete Guide to Linux System Administration
18
Using GRUB (continued)
The Complete Guide to Linux System Administration
19
init and its Scripts
• init program
–
–
–
–
Master control program
Starts many other programs
Runs scripts to initialize system services
Controlled by /etc/inittab configuration file
• Three main configuration files located in /etc/rc.d
– rc.sysinit
– rc
– rc.local
The Complete Guide to Linux System Administration
20
Understanding Run Levels
• Run level
–
–
–
–
Numbered mode of operation
Preconfigured set of services is activated
Defined in /etc/inittab file
Default run level 5
• init or telinit command
– Change to different run level
– Commonly done only to restart or halt system
The Complete Guide to Linux System Administration
21
Understanding Run Levels
(continued)
The Complete Guide to Linux System Administration
22
Understanding rc Scripts
• rc script
– Located in /etc/rc.d directory
– Started with parameter that includes run level
– Starts appropriate system services based on
selected run level
• Each run level is associated with subdirectory
– Located in /etc/rc.d directory
The Complete Guide to Linux System Administration
23
Understanding rc Scripts
(continued)
• Each file begins with K or S followed by two-digit
number
– Begin with K―stopped (killed)
– Begin with S―started
• Files symbolic links to scripts that stop and start
services
The Complete Guide to Linux System Administration
24
Understanding rc Scripts
(continued)
The Complete Guide to Linux System Administration
25
Controlling Services
• Many services listed in run-level directories relate
to networking
• Scripts allow user to change almost anything on
Linux system without restarting computer
The Complete Guide to Linux System Administration
26
Managing Services
• service command
– Control service
– Must know service name
– Examples:
• service lpd restart
• service named start
• service named status
The Complete Guide to Linux System Administration
27
Managing Services (continued)
• chkconfig command
– Alter files in run-level directories
– Modify services started or stopped each time
system started
– By default alters run levels 2 through 5
– Example: chkconfig named on
The Complete Guide to Linux System Administration
28
Managing Services Graphically
• Service configuration utility
– Main window lists services available on system
• Determined by contents of /etc/rc.d/init.d
– Active services
• Shown with check mark next to them
The Complete Guide to Linux System Administration
29
Managing Services Graphically
(continued)
The Complete Guide to Linux System Administration
30
Configuring System Services
• Initialization scripts in /etc/rc.d/init.d
– Typically use configuration information located in
/etc/sysconfig directory and subdirectories
• Files in /etc/sysconfig
– Named for services
– Each file contains name-value pairs
• Define configuration options for service
The Complete Guide to Linux System Administration
31
Configuring System Services
(continued)
• Use system-config-network utility to configure
– /etc/sysconfig/ network file
– Files within /etc/sysconfig/network-scripts
• system-config-securitylevel utility
– Alters /etc/sysconfig/system-config-securitylevel
file
– Based on firewall selections
• Service itself often has another set of
configuration files in /etc directory
The Complete Guide to Linux System Administration
32
Shutting Down Linux
• Turning off Linux computer without shutting it
down in orderly way can cause data loss
• Journaling file system
– Tracks each disk operation to ensure it is either
completed or not done at all
– Journal permits operating system to “back out” of
disk operation if not completed successfully
The Complete Guide to Linux System Administration
33
Shutting Down Linux (continued)
• Journaling file system
– Means file systems are unlikely to ever be
corrupted by power loss
• Graceful shutdown
–
–
–
–
Orderly or methodical shutdown of Linux
All Linux services are stopped
All data is written to disk
Kernel changes to run level 0 or 6
The Complete Guide to Linux System Administration
34
Shutting Down Linux (continued)
• Shut down Linux gracefully
–
–
–
–
–
Use reboot command
Use halt command
Use shutdown command
Pressing Ctrl+Alt+Del
Entering the command telinit 0
• Halt system
– Entering command telinit 6
• Restart system
The Complete Guide to Linux System Administration
35
Shutting Down Linux (continued)
• Graphical desktop
– Use log out item on main menu of GNOME or
KDE
• On servers or multiuser Linux systems
– Only system administrator should be allowed to
shut down system
The Complete Guide to Linux System Administration
36
Summary
• CPU BIOS and other hardware components of
computer must initialize themselves before
attempting to load operating system
• Boot loader typically first software loaded on
Linux system
• Multiple boot loaders can be installed on one
system and chained together
• Messages generated by kernel after it starts are
stored in kernel ring buffer
The Complete Guide to Linux System Administration
37
Summary (continued)
• Boot loader can pass parameters to Linux kernel
• LILO and GRUB configured using text
configuration files
– Stored in /boot directory
• init program
– First process started by Linux kernel
– Runs several scripts that start numerous daemons
The Complete Guide to Linux System Administration
38
Summary (continued)
• Run level mode of operation defines what
processes are started at boot time
• Must gracefully shut down Linux to avoid data
loss
The Complete Guide to Linux System Administration
39