1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Kỹ thuật lập trình >

Chapter 12. Exam 102 Study Guide

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (10.57 MB, 1,207 trang )


This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks



12.1. Exam Preparation



LPI Exam 102 is thorough, but if you have a solid foundation in Linux concepts as described here, you should find it straightforward. If

you've already taken Exam 101, you'll find that 102 covers a broader range of Linux administration skills. Included are kernel tasks, boot

and system initialization, printing, documentation, shells and scripting, administrative tasks, networking fundamentals, networking

services, and security. Exam 102 is quite specific on some Topics, such as network applications like Apache and Sendmail, but you

won't come across questions intended to trick you, and you're unlikely to find questions that you feel are ambiguous.

For clarity, this material is presented in the same order as the LPI Topics and Objectives. To assist you with your preparation, Tables

12-1 through 12-9 provide a complete listing of the Topics and Objectives for Exam 102. Because of changes made during test

development, the final Objectives are not always in exact numberical order. After you complete your study of each Objective, simply

check it off here to measure and organize your progress.



Table 12-1. Kernel (Topic 1.105)

Objective



Weight



Description



1



4



Manage/Query Kernel and Kernel Modules at Runtime



2



3



Reconfigure, Build, and Install a Custom Kernel and Kernel Modules



Table 12-3. Boot, Initialization, Shutdown, and Runlevels (Topic 1.106)

Objective



Weight



Description



1



3



Boot the System



2



3



Change Runlevels and Shut Down or Reboot System



Table 12-3. Printing (Topic 1.107)

Objective



Weight



Description



2



1



Manage Printers and Print Queues



3



1



Print Files



4



1



Install and Configure Local and Remote Printers



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks



Table 12-4. Documentation (Topic 1.108)

Objective



Weight



Description



1



4



Use and Manage Local System Documentation



2



3



Find Linux Documentation on the Internet



5



1



Notify Users on System-related Issues



Table 12-5. Shells, Scripting, Programming, and Compiling (Topic 1.109)

Objective



Weight



Description



1



5



Customize and Use the Shell Environment



2



3



Customize or Write Simple Scripts



Table 12-6. Administrative Tasks (Topic 1.111)

Objective



Weight



Description



1



4



Manage Users and Group Accounts and Related System Files



2



3



Tune the User Environment and System Environment Variables



3



3



Configure and Use System Log Files to Meet Administrative and Security Needs



4



4



Automate System Administration Tasks by Scheduling Jobs to Run in the Future



5



3



Maintain an Effective Data Backup Strategy



6



4



Maintain System Time



Table 12-7. Networking Fundamentals (Topic 1.112)

Objective



Weight



Description



1



4



Fundamentals of TCP/IP



3



7



TCP/IP Configuration and Troubleshooting



4



3



Configure Linux as a PPP Client



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks



Table 12-8. Networking Services (Topic 1.113)

Objective



Weight



Description



1



4



Configure and Manage inetd, xinetd, and Related Services



2



4



Operate and Perform Basic Configuration of Mail Transfer Agent (MTA)



3



4



Operate and Perform Basic Configuration of Apache



4



4



Properly Manage the NFS, and Samba Daemons



5



4



Set Up and Configure Basic DNS Services



7



4



Set Up Secure Shell (OpenSSH)



Table 12-9. Security (Topic 1.114)

Objective



Weight



Description



1



4



Perform Security Administration Tasks



2



3



Set Up Host Security



3



1



Set Up User-level Security



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.



Chapter 13. Kernel (Topic 1.105)

In the early days of personal computing, operating systems were simple interfaces, designed to provide access to a rudimentary

filesystem and to launch programs. Once a program was running, it had full control of the system. This made the system simple but also

contributed to instability, because a single program failure could cause the entire system to crash. To run a computer in an organized

and reliable fashion, it is important to isolate physical hardware resources from the software running on the system. In Linux, the kernel

is the core software that owns and manages your system. It controls hardware, memory, and process scheduling and provides an

interface for programs to indirectly access hardware resources.

This Topic on the Linux kernel has two Objectives:



Objective 1: Manage/Query Kernel and Kernel Modules at Runtime

This Objectives states that candidates should be able to manage and query a kernel and its loadable modules. This Objective

includes using command-line utilities to get information about a running kernel and kernel modules. It also includes manually

loading and unloading modules as appropriate. In addition, a candidate should be able to determine what parameters a

module accepts. Weight: 4.



Objective 2: Reconfigure, Build, and Install a Custom Kernel and Kernel Modules

A candidate should be able to customize, build, and install a kernel and kernel modules from source. This Objective includes

customizing the current kernel configuration, building a new kernel, and building kernel modules as appropriate. It also

includes installing the new kernel and modules and ensuring that the boot manager can locate the new kernel and associated

files. Weight: 3.



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks



13.1. Objective 1: Manage/Query Kernel and Kernel Modules at Runtime



With Linux, code for system devices can be compiled into the kernel. Because the kernel already has built-in support for most devices, it

is said to be monolithic, since the kernel manages all system hardware by itself. Monolithic kernels aren't very flexible because a new

kernel build is necessary for new peripheral devices to be added to the system. Monolithic kernels also have the potential to become

"bloated" by drivers for hardware that aren't physically installed. Instead, most users run modular kernels, in which device drivers are

inserted into the running kernel as needed. Modular configurations can adapt to changes in the hardware and provide a convenient way

of upgrading driver software while a system is running.



13.1.1. Module Files

Linux kernel modules are object files (.o) produced by the C compiler but not linked into a completed executable (in this case, the kernel

executable file). Most modules are distributed with the kernel and compiled along with it. Because they are so closely related to the

kernel, separate sets of modules are installed when multiple kernels are installed. This reduces the likelihood that a kernel module will be

inserted into the wrong kernel version.

Modules are stored in /lib/modules/kernel-version, where kernel-version is the string reported byuname -r, such as 2.4.18-10. In this

example, the modules directory would be /lib/modules/2.4.18-10. Multiple module hierarchies may be available under/lib/modules if

multiple kernels are installed. Within each kernel-version hierarchy is a kernel subdirectory that contains the kernel modules, sorted into

additional subdirectories by category.



Tip: The path to these additionalcategory subdirectories changed for the 2.4 kernel series to include akernel



subdirectory to contain all the categories. Prior to 2.4, all of the category subdirectories were located directly under

/lib/modules/kernel-version.



Some of the categories are:



block

Modules for a few block-specific devices such as RAID controllers or IDE tape drives.



cdrom

Device driver modules for nonstandard CD-ROM devices.



fs

Device drivers for filesystems such as MS-DOS (the msdos.o module).



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks



ipv4

Kernel features having to do with TCP/IP networking, such as the Netfilter firewall modules.



misc

Anything that doesn't fit into one of the other subdirectories ends up here. Note that no modules are stored at the top of this

tree.



net

Network interface driver modules.



scsi

Driver modules for the SCSI controller.



video

Driver modules for video adapters.



13.1.2. Manipulating Modules



A module is dynamically linked into the running kernel when it is loaded. Much of Linux kernel module handling is done automatically.

However, there may be times when it is necessary for you to manipulate the modules yourself, and you may come across the

manipulation commands in scripts. For example, if you're having difficulty with a particular driver, you may need to get the source code

for a newer version of the driver, compile it, and insert the new module in the running kernel. The commands listed in this section can be

used to list, insert, remove, and query modules.



Syntax

lsmod



Description

For each kernel module loaded, display its name, size, use count, and a list of other referring modules. This command yields

the same information as is available in /proc/modules.



Example

Here, lsmod shows that quite a few kernel modules are loaded, including filesystemvfat,

( fat), networking (3c59x), and sound



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks

(soundcore, mpu401, etc.) modules, among others:

# lsmod

Module

radeon

agpgart

parport_pc

lp

parport

e100

ohci1394

ieee1394

scsi_mod

evdev

printer

wacom

emu10k1

ac97_codec

sound

soundcore

keybdev

mousedev

hid

input

ehci-hcd

usb-uhci

usbcore

ext3

jbd



Size Used by

112996 24

45824 3

18756 1 (autoclean)

8868 0 (autoclean)

36480 1 (autoclean) [parport_pc lp]

59428 1

19976 0 (unused)

48300 0 [ohci1394]

106168 0

5696 0 (unused)

8832 0

7896 0 (unused)

68104 1

13512 0 [emu10k1]

73044 0 [emu10k1]

6276 7 [emu10k1 sound]

2912 0 (unused)

5428 1

21700 0 (unused)

5824 0 [evdev wacom keybdev mousedev hid]

19432 0 (unused)

25964 0 (unused)

77760 1 [printer wacom hid ehci-hcd usb-uhci]

87240 3

51156 3 [ext3]



Syntax

insmod [options] module



Description

Insert a module into the running kernel. The module is located automatically and inserted. You must be logged in as the

superuser to insert modules.



Frequently used options



-s

Direct output to syslog instead of stdout.



-v

Set verbose mode.



Example



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks

The msdos filesystem module is installed into the running kernel. In this example, the kernel was compiled with modular

support for the msdos filesystem type, a typical configuration for a Linux distribution for i386 hardware. To verify that you have

this module, check for the existence of /lib/modules/kernel-version/fs/msdos.o:

# insmod msdos

/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol fat_add_cluster_Rsmp_eb84f594

/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol fat_cache_inval_inode_Rsmp_6da1654e

/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol fat_scan_Rsmp_d61c58c7

( ... additional errors omitted ... )

/lib/modules/2.2.5-15smp/fs/msdos.o: unresolved symbol fat_date_unix2dos_Rsmp_83fb36a1

# echo $?

1



This insmod msdos command yields a series of unresolved symbol messages and an exit status of 1, indicating an error. This is the

same sort of message that might be seen when attempting to link a program that referenced variables or functions unavailable to the

linker. In the context of a module insertion, such messages indicate that the functions are not available in the kernel. From the names of

the missing symbols, you can see that the fat module is required to support the msdos module, so it is inserted first:

# insmod fat



Now the msdos module can be loaded:

# insmod msdos



Use the modprobe command to automatically determine these dependencies and install prerequisite modules first.



Syntax

rmmod [options] modules



Description

The rmmod command is used to remove modules from the running kernel. You must be logged in as the superuser to

remove modules, and the command will fail if the module is in use or being referred to by another module.



Frequently used options



-a

Remove all unused modules.



-s

Direct output to syslog instead of stdout.



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks

Example

Starting with both the fat and msdos modules loaded, remove the fat module (which is used by themsdos module):

# lsmod

Module

msdos

fat



Size Used by

8348 0 (unused)

25856 0 [msdos]



# rmmod fat

rmmod: fat is in use



In this example, the lsmod command fails because the msdos module is dependent on the fat module. So, to unload the fat

module, the msdos module must be unloaded first:

# rmmod msdos

# rmmod fat



The modprobe -r command can be used to automatically determine these dependencies and remove modules and their

prerequisites.



Syntax

modinfo [options] module_object_file



Description

Display information about a module from its module_object_file. Some modules contain no information at all, some have a

short one-line description, and others have a fairly descriptive message.



Options



-a

Display the module's author.



-d

Display the module's description.



-p

Display the typed parameters that a module supports.



Examples

In these examples, modinfo is run using modules compiled for a multiprocessing (SMP) kernel Version 2.2.5. Your kernel

version, and thus the directory hierarchy containing modules, will be different.



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register

. it. Thanks

# modinfo -d /lib/modules/2.2.5-15smp/misc/zftape.o

zftape for ftape v3.04d 25/11/97 - VFS interface for the

Linux floppy tape driver. Support for QIC-113

compatible volume table and builtin compression

(lzrw3 algorithm)

# modinfo -a /lib/modules/2.2.5-15smp/misc/zftape.o

(c) 1996, 1997 Claus-Justus Heine

(claus@momo.math.rwth-aachen.de)

# modinfo -p /lib/modules/2.2.5-15smp/misc/ftape.o

ft_fdc_base int, description "Base address of FDC

controller."

Ft_fdc_irq int, description "IRQ (interrupt channel)

to use."

ft_fdc_dma int, description "DMA channel to use."

ft_fdc_threshold int, description "Threshold of the FDC

Fifo."

Ft_fdc_rate_limit int, description "Maximal data rate

for FDC."

ft_probe_fc10 int, description "If non-zero, probe for a

Colorado FC-10/FC-20 controller."

ft_mach2 int, description "If non-zero, probe for a

Mountain MACH-2 controller."

ft_tracing int, description "Amount of debugging output,

0 <= tracing <= 8, default 3."



Syntax

modprobe [options] module [symbol=value ...]



Description

Like insmod, modprobe is used to insert modules. In fact,modprobe is a wrapper around insmod and provides additional

functionality. In addition to loading single modules, modprobe has the ability to load modules along with their prerequisites or

all modules stored in a specific directory. The modprobe command can also remove modules when combined with the-r

option.

A module is inserted with optional symbol=value parameters (see "Configuring Modules" in the next section for more on

parameters). If the module is dependent upon other modules, they will be loaded first. The modprobe command determines

prerequisite relationships between modules by reading modules.dep at the top of the module directory hierarchy (i.e.,

/lib/modules/2.2.5-15smp/modules.dep).

You must be logged in as the superuser to insert modules.



Frequently used options



-a

Load all modules. When used with the -t moduletype, all is restricted to modules in the moduletype directory. This

action probes hardware by successive module-insertion attempts for a single type of hardware, such as a network

adapter (in which case the moduletype would be net, representing /lib/modules/kernel-version/kernel/net). This

may be necessary, for example, to probe for more than one kind of network interface.



This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register

.

it. Thanks

-c

Display a complete module configuration, including defaults and directives found in /etc/modules.conf (or

/etc/conf.modules on older systems). The -c option is not used with any other options.



-l

List modules. When used with the -t moduletype, list only modules in directory moduletype. For example, if

moduletype is net, then modules in/lib/modules/kernel-version/net are displayed.



-r

Remove module, similar to rmmod. Multiple modules may be specified.



-s

Direct output to syslog instead of stdout.



-t moduletype

Attempt to load multiple modules found in the directory moduletype until a module succeeds or all modules in

moduletype are exhausted. This action "probes" hardware by successive module-insertion attempts for a single

type of hardware, such as a network adapter (in which case moduletype would be net, representing

/lib/modules/kernel-version/kernel/net).



-v

Set verbose mode.



Example 1

Install the msdos filesystem module into the running kernel:

# modprobe msdos



Module msdos and its dependency, fat, will be loaded. modprobe determines that fat is needed by msdos when it looks through

modules.dep. You can see the dependency listing usinggrep:

# grep /msdos.o: /lib/modules/2.2.5-15smp/modules.dep

/lib/modules/2.2.5-15smp/fs/msdos.o:

/lib/modules/2.2.5-15smp/fs/fat.o



Example 2

Remove fat and msdos modules from the running kernel, assuming msdos is not in use:

# modprobe -r fat msdos



Xem Thêm
Tải bản đầy đủ (.pdf) (1,207 trang)

×