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

Chapter 24. Exam 102 Highlighter's Index

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



24.1. Kernel (Topic 1.105)



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

The Linux kernel is modular, and device driver software is inserted into the running kernel as needed.

Module files are objects, stored under /lib/modules.

Kernel modules can be managed using:



insmod

Insert a module into the kernel.



lsmod

List modules.



modinfo

Get information about a module.



modprobe

Insert modules along with their prerequisites.



rmmod

Remove a module from the kernel.

Modules are configured in /etc/conf.modules or /etc/modules.conf.

modprobe determines module dependencies using a filecalled modules.dep. This file is usually created at boot time

usingdepmod.



24.1.2. Objective 2: Reconfigure, Build, and Install a Custom Kernel and Kernel

Modules



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



To build a kernel, you need the compiler, assembler, linker, make, kernel source, and kernel headers.

These are typical kernel compilation steps, done in /usr/src/linux:

a.



Make a configuration using make oldconfig (existing setup), make config (basic interactive text program), make

menuconfig (interactive text menu program), or make xconfig (graphical program). Each method creates the .config

file containing kernel options.



b. Modify EXTRAVERSION in Makefile, if desired.

c.



Build dependencies using make dep.



d. Clean old results with make clean.

e.



Create the kernel with make bzImage.



f. Create modules with make modules.

g. Install the modules with make modules_install.

h. Copy the new image to /boot.

i. Update /etc/lilo.conf for the new image.

j. Update the boot loader by running the lilo command.



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



24.2. Boot, Initialization, Shutdown, and Runlevels (Topic 1.106)



24.2.1. Objective 1: Boot the System



24.2.1.1. LILO, the Linux loader



LILO is a utility designed to load a Linux kernel (or another operating system) into memory and launch it. It has two parts:



The boot loader

A two-stage program intended to find and load a kernel. The first stage resides in the disk boot sector and is

started by the system BIOS. It locates and launches a second, larger stage residing elsewhere on disk.



The lilo command



The map installer, used to install and configure the LILO boot loader. It reads /etc/lilo.conf and writes a

corresponding map file.

The /etc/lilo.conf file contains options and kernel image information. Popular directives are:



boot

The name of the hard disk partition that contains the boot sector.



image

Refers to a specific kernel file.



install

The file installed as the new boot sector.



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



label

Provides a label, or name, for each image.



map

Directory where the map file is located.



prompt

Prompts the user for input (such as kernel parameters

the user.



or runlevels) before booting and without a keystroke from



read-only

The root filesystem should initially be mounted read-only.



root

Used following each image, this specifies the device that should be mounted asroot.



timeout

The amount of time, in tenths of a second, the system waits for user input.



24.2.1.2. Kernel parameters and module configuration



LILO can pass kernel parameters using name=value pairs.

Linux kernels are modular, with portions of kernel functionality compiled as modules to be used as needed.

Parameters to modules can be specified in /etc/conf.modules.



24.2.1.3. Boot-time messages



The kernel gives detailed status information as it boots. This information can also be found in system logs such as

/var/log/messages and from the dmesg command.



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



24.2.2. Objective 2: Change Runlevels and Shut Down or Reboot System

Runlevels specify how a system is used by controlling which services are running.

Runlevels are numbered through 6, as well as with a few single characters.

Runlevel 0 implies system shutdown.

Runlevel 6 implies system reboot.

The intermediate runlevels differ in meaning among distributions.

Runlevel 1 (also s or S) is usually single-user (maintenance) mode.

Runlevels 2 through 5 usually define some kind of multiuser state, including an X login screen.



24.2.2.1. Single-user mode



Runlevel 1 is a bare-bones operating environment intended for maintenance. Remote logins are disabled, networking is

disabled, and most daemons are shut down.

Single-user mode can be entered with the single, or simply 1, parameter at the LILO prompt.

Switching to single-user mode is done using init 1.



24.2.2.2. The /etc/rc.d directory



The /etc/rc.d file contains initialization scripts and links controlling the boot process for many Linux distributions:



rc.sysinit

The startup script launched by init at boot time



rc.local

A script for local startup customizations, started automatically after the system is running



rc

A script used to change runlevels



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

init.d

The directory containing scripts to start and stop system services



rc0.d through rc6.d

Links to scripts in init.d

Names of the links are [K|S][nn][init.d_name]:

K and S prefixes mean kill and start, respectively.

nn is a sequence number controlling startup or shutdown order.

init.d_name is the name of the script being linked.



24.2.2.3. Default runlevel, determining runlevel, changing runlevels



The default runlevel is located in /etc/inittab on the line containinginitdefault:



id:n:initdefault:

n is a valid runlevel number such as 3.

Runlevel is determined by the runlevel command, which displays the previous and current runlevels. AnN for previous

runlevel indicates that the runlevel has not changed since startup.

Runlevels can be changed using init:



init n

Change to runlevel n.

System shutdown can also be initiated using shutdown:



shutdown time

Bring the system down in a secure, organized fashion. time is mandatory, in the form of hh:mm, now, or +n for n

minutes.



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



24.3. Printing (Topic 1.107)



24.3.1. Objective 2: Manage Printers and Print Queues

Printers are assigned to queues, which are managed by lpd, the print daemon. lpd listens for inbound print requests, forking a

copy of itself for each active print queue.

lpr submits jobs to print queues.

lpq queries and displays queue status.

lprm allows jobs to be removed from print queues.

lpc allows root to administer queues; it has both interactive and command-line forms.

Filters translate data formats into a printer definition language.

Spool directories hold spooled job data.



24.3.2. Objective 3: Print Files

Files are printed with the lpr command:

# lpr /etc/lilo.conf

# man -t 5 myfile.txt | lpr -Pqueue2



24.3.3. Objective 4: Install and Configure Local and Remote Printers



24.3.3.1. /etc/printcap



New printer definitions are added to /etc/printcap:

lp|ljet:\



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

. it. Thanks

:sd=/var/spool/lpd/lp:\

:mx#0:\

:sh:\

:lp=/dev/lp0:\

:if=/var/spool/lpd/lp/filter:

:lf=/var/spool/lpd/lp/log:



The lines in this example are defined as follows:



lp|ljet:\

This parameter defines two alternate names for the printer, lp or ljet.



sd=spool_directory

This parameter specifies the spool directory, under /var/spool/lpd.



mx=max_size

The maximum size of a print job in blocks. Setting this to #0 indicates no limit.



sh

Suppress header pages. Placing this attribute in printcap sets it, eliminating the headers.



lp=printer_device

The local printer device, such as a parallel port.



if=input_filter

The input filter to be used. See "Filters" in Chapter 15 for additional information.



lf=log_file

The file where error messages are logged.



24.3.3.2. Filters



APSfilter is implemented as executable scripts. Installation configures/etc/printcap automatically. Multiple queues may be

defined to give the user access to specific printer capabilities.



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

Magicfilter is a binary program; installation does not automatically create print queues.



24.3.3.3. Remote queues and Samba printers



Printing on a remote system or network printer is done through a local queue. /etc/printcap for the local queue looks

something like this:

rlp:\

:sd=/var/spool/lpd/rlp:\

:rm=lphost:\

:rp=rlp:\

:mx#0:\

:sh:\

:if=/usr/local/bin/magicfilter

:



Printing to Windows printers is similar and uses thesmbprint filter:

winpr:\

:sd=/var/spool/lpd/winpr:\

:mx#0:\

:sh:\

:if=/usr/bin/smbprint:



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



24.4. Documentation (Topic 1.108)



24.4.1. Objective 1: Use and Manage Local System Documentation



24.4.1.1. Text and paging



In the context of Linux systems, plain text means files or streams of both printable characters and control characters, using a

standard encoding scheme such as ASCII.

Differentiating text from nontext isn't obvious, but the file command examines a file given as its argument and offers a

response that indicates the file type.

A pager is a program intended to offer a quick and simple interface for viewing text files, one screen at a time.

more is a popular pager available on most Unix systems.

less is a full-featured text pager, which emulatesmore and offers significant advantages. Commonless commands are listed in

Table 24-1.



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

×