📄 0027-0030.html
字号:
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:LILO</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=03 //-->
<!-- PAGES=0027-0036 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch02/0026-0026.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0031-0036.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-27"><P>Page 27</P></A>
<H3><A NAME="ch03_ 1">
CHAPTER 3
</A></H3>
<H2>
LILO
</H2>
<B>by Bill Ball and Jay Austad
</B>
<H3><A NAME="ch03_ 2">
IN THIS CHAPTER
</A></H3>
<UL>
<LI> Installing and Configuring LILO 28
<LI> Using LOADLIN.EXE to Boot Linux 33
<LI> How to Uninstall LILO 33
</UL>
<A NAME="PAGENUM-28"><P>Page 28</P></A>
<P>Booting Linux requires you to install a program to load the kernel into your computer.
Which program you use depends on the computer you're using: You'll use LILO for
Intel-compatible PCs, MILO for Digital Equipment Corp. Alpha PCs, or SILO for SPARC-compatible
workstations. Because the CD-ROM included with this book contains Red Hat Intel/Linux,
this chapter will focus on LILO, which, according to its author, Werner Almesberger, stands
for Linux Loader.
</P>
<P>This chapter will help you if you chose not to install LILO when you first installed Red
Hat Linux or if you need help in properly starting Linux with certain kernel options. You've
probably already decided how you want to start Linux on your computer, but you should
know that there are other ways to fire up your system.
</P>
<P>Instead of using LILO, you can start Linux from DOS with
LOADLIN.EXE, which is included on your CD-ROM under the
Dosutils directory. I'll discuss LOADLIN.EXE later in this chapter
in the section "Using LOADLIN.EXE to Boot Linux."
</P>
<P>You can also use your computer as a diskless workstation by booting Linux over a network.
A discussion on this subject is beyond the scope of this chapter, but you'll find the details on
how to do this in Robert Nemkin's Diskless-HOWTO, under the
/usr/doc/HOWTO/mini directory after you install Linux.
</P>
<P>Yet another approach is to use a commercial boot loader, such as V Communications,
Inc.'s System Commander, which can come in handy if you need to run other operating
systems such as OS/2, Solaris, or Windows NT on your computer.
</P>
<P>LILO has capabilities similar to commercial solutions, but it's free. For now, I'll assume
that you're going to use LILO to boot in one of three traditional ways. You can use LILO to
start Linux
</P>
<UL>
<LI> From the Master Boot Record (MBR) of your hard drive
<LI> From the superblock of your root Linux partition on your hard drive
<LI> From a floppy disk
</UL>
<P>In the following section, I'll show you a list of LILO's configuration parameters and its <BR>
command-line arguments, and I'll point out some special
features.
</P>
<H3><A NAME="ch03_ 3">
Installing and Configuring LILO
</A></H3>
<P>Although LILO is easy to install by using the
lilo command (located under the /sbin directory), you should first take the time to read its documentation, which you'll find under
/usr/doc. Along with the documentation, you'll also find a shell script called
QuickInst, which can be used to replace an existing LILO installation or for a first-time install. LILO's
documentation contains details of its features and provides important tips and workarounds for
special problems, such as installing boot loaders on very large capacity hard drives or booting
from other operating systems.
</P>
<A NAME="PAGENUM-29"><P>Page 29</P></A>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
WARNING
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Before trying anything with LILO, you should have an emergency boot disk. Having
a system that won't boot is not much fun, and if you don't have a boot disk, you might
think that there is no possible way to get back in and change things. Spending a few minutes
to make yourself a boot disk can save you a big headache down the road.
Whatever happens, don't panic! If you need to rescue your system, see Chapter 4, "System
Startup and Shutdown," for details.
</BLOCKQUOTE></TD></TR>
</TABLE>
<P>If you don't install LILO during your Red Hat install or decide not to use the
QuickInst script, there are two basic steps to install LILO:
</P>
<OL>
<LI> Configure <TT>/etc/lilo.conf.</TT>
<LI> Run <TT>/sbin/lilo</TT> to install LILO and make it active.
</OL>
<P>This discussion describes modifying an existing
lilo.conf file. Before making any changes, do yourself a favor and create a backup of the file either in the same directory or on a separate
disk. Several files are important to LILO and are created during an initial install:
</P>
<UL>
<LI>
<TT>/sbin/lilo</TT>—A map installer; see man lilo for more information
<LI>
<TT>/boot/boot.b</TT>—A boot loader
<LI>
<TT>/boot/map</TT>—A boot map, which contains the location of the kernel
<LI>
<TT>/etc/lilo.conf</TT>—LILO's configuration file
</UL>
<H4><A NAME="ch03_ 4">
Configuring LILO
</A></H4>
<P>Under Linux, your hard drives are abstracted to device files under the
/dev directory. If you have one or more IDE drives, your first hard drive is referred to as
/dev/hda, and your second hard drive is /dev/hdb. SCSI drives are referred to as
/dev/sda and /dev/sdb. When you installed Linux, you most likely partitioned your hard drive. The first partition on your first
drive would be /dev/hda1 or /dev/sda1. Consequently, your second partition would be
/dev/hda2 or /dev/sda2, and so on.
</P>
<P>Before configuring LILO, you should know which partitions have what operating system
on them. You should also know where you want to install LILO. In almost all cases, you will
want to put LILO on the MBR. You shouldn't do this, however, if you run OS/2. OS/2's boot
loader should go on the MBR, and LILO should then be installed on the superblock of the root
partition.
</P>
<P>Before installing LILO, you should know where your Linux partition is, and if you have
other operating systems, you must know where they are located. For example, your Linux
partition might be at /dev/hda1, and your Windows 95 partition might be at
/dev/hda2.
</P>
<A NAME="PAGENUM-30"><P>Page 30</P></A>
<P>If Linux is the only operating system on your computer or if you have Windows 95 or
Windows NT, you will want to install LILO as the MBR of the drive. If you have OS/2 also,
you will want to install LILO on the root partition of your hard drive and use OS/2's boot
loader on the MBR.
</P>
<P>LILO is normally installed after you have partitioned your hard drives and after you have
installed either Linux or other operating systems.
</P>
<P>Armed with your information, you are now ready to edit LILO's configuration
file, /etc/lilo.conf.
</P>
<H4><A NAME="ch03_ 5">
Editing lilo.conf
</A></H4>
<P>Editing lilo.conf is easy. Make sure that you're logged in as root, and load the file into
your favorite editor, making sure to save your changes and to save the file as ASCII text. You'll
edit lilo.conf for a number of reasons:
</P>
<UL>
<LI> You are testing a new kernel and want to be able to boot the same Linux
partition with more than one kernel.
<LI> You want to add password protection to a partition.
<LI> You have a hardware setup that requires you to specify special options, such as
booting a remote filesystem.
<LI> Your kernel is called something other than
/vmlinuz or is in a nonstandard place, such as
/etc.
</UL>
<P>Listing 3.1 shows a sample lilo.conf file.
</P>
<P>Listing 3.1. A sample lilo.conf.
</P>
<!-- CODE //-->
<PRE>
# Start LILO global section
Boot = /dev/hda
Prompt
Vga = normal
Ramdisk = 0
# End LILO global section
image = /vmlinuz
root = /dev/hda3
label = linux
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
other = /dev/hda1
label = dos
table = /dev/hda
</PRE>
<!-- END CODE //-->
<P>You can add the parameters listed in Table 3.1 to your
/etc/lilo.conf file. They could also be given at the boot prompt, but it is much simpler for them to reside in your
/etc/lilo.conf file. Note that only 13 of LILO's 23 different options are listed here. See LILO's
documentation for details.
</P>
<P>Table 3.1. /etc/lilo.conf configuration parameters.
</P>
<P><CENTER>
<a href="../ch02/0026-0026.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0031-0036.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -