home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeRunning LinuxSearch this book

Chapter 3. Installation and Initial Configuration

At this point, you should have your Linux distribution and have disk space set aside for Linux. In this chapter, we present a general overview of the installation process. Each distribution has its own installation instructions, but armed with the concepts presented here, you should be able to feel your way through any installation. Appendix A, "Sources of Linux Information", lists sources of information for installation instructions and other help, if you're at a total loss.

Different Linux distributions store files in different locations, which can make it hard to describe how to administer Linux. For instance, the same files may be found on Red Hat, SuSE, and Debian systems, but they may be under the /etc directory on one system and the /sbin directory under another. Gradually, the vendors are standardizing the set of locations listed in a document called the Filesystem Hierarchy Standard, but in this book we'll just try to deal with lagging discrepancies by listing the locations of the most important files in the version of each major distribution that we checked.

3.1. Installing the Linux Software

After resizing your existing partitions to make space for Linux, you are ready to install the software. Here is a brief overview of the procedure:

  1. Boot the Linux installation media.

  2. Run fdisk under Linux to create Linux partitions.

  3. Run mke2fs and mkswap to create Linux filesystems and swap space.

  4. Install the Linux software and configure it.

  5. Finally, either install the LILO boot loader on your hard drive, or create a boot floppy in order to boot your new Linux system.

As we have said, one (or more) of these steps may be automated for you by the installation procedure, depending on the distribution of Linux you are using. Please consult your distribution's documentation for specific instructions.

3.1.1. Booting Linux

The first step is to boot the Linux installation media. In most cases, this is either a boot floppy, which contains a small Linux system or a bootable CD-ROM. Upon booting the floppy or the CD-ROM, you are presented with an installation menu of some kind that leads you through the steps of installing the software. On other distributions, you are presented with a login prompt when booting this floppy. Here, you usually log in as root or install to begin the installation process.

The documentation that comes with your particular distribution will explain what is necessary to boot Linux from the installation media.

Most distributions of Linux use a boot floppy that allows you to enter hardware parameters at a boot prompt to force hardware detection of various devices. For example, if your SCSI controller is not detected when booting the floppy, you will need to reboot and specify the hardware parameters (such as I/O address and IRQ) at the boot prompt. Likewise, IBM PS/1, ThinkPad, and ValuePoint machines do not store drive geometry in the CMOS, so you must specify it at boot time.

The boot prompt is often displayed automatically when booting the boot floppy or CD-ROM. This is the case for the Red Hat distribution. With distributions that do not show the prompt by default, you need to hold down the Shift or Control key or press the Scroll Lock key while booting the floppy or CD-ROM if you want to enter something at the boot prompt. If successful, you should see the prompt:

boot:
and possibly other messages. What you are seeing here is a boot prompt presented by
LILO (the LInux LOader), a program used to boot the Linux operating system and specify hardware-detection parameters at boot time. After you have installed Linux, you may wish to install LILO on your hard drive, which allows you to select between Linux and other operating systems (such as MS-DOS) when the system is booted.

At this point you have several options. You can press the Enter key to simply boot Linux from the floppy with no special parameters. (You should try this first, and if installation seems to go well, you're all set.) Or, just wait until the installation proceeds, today's distributions set a timeout for the boot prompt, and when you do not enter anything for some time, they just continue booting. Otherwise, you may have to specify hardware-detection parameters at this boot prompt, to force the system to properly identify the hardware installed in your system.

If you don't want to try any hardware-detection parameters now, just press Enter at the boot prompt. Watch the messages as the system boots. If you have an SCSI controller, for example, you should see a listing of the SCSI hosts detected. If you see the message:

SCSI: 0 hosts

then your SCSI controller was not detected, and you will have to use the hardware detection procedure we'll describe in a moment.

Most new distributions often follow a different path of choosing hardware. They come with a minimal kernel on the boot disk and then load so-called kernel modules from either a second floppy disk or a CD-ROM. In this case, you will probably be dropped into some menu where you can select additional modules to be probed. Even specifying modules is largely automated: you just ask the installation program to probe for SCSI adapters and see whether yours is found. The same goes for Ethernet cards and other devices that are needed for the installation process. Devices that are not needed during the installation, such as sound boards, are unlikely to be detected at this point of the installation. You will probably be given the option to configure them later.

If the automated hardware detection procedures do not work for you (which normally is the case only if you have very old, very new or very unusual hardware), you will have to help Linux a bit by forcing hardware detection.

To force hardware detection, you must enter the appropriate parameters at the boot prompt, using the following syntax:

linux parameters

There are many such parameters, some of which are listed below. We don't expect you to understand what all of these parameters mean or are used for; rather, you should be able to determine which of these hardware options corresponds to your own system. For example, if you have an AHA152x-based SCSI controller, and you know that under MS-DOS you must configure the board for a particular I/O address and IRQ, you can use the corresponding option (aha152x=) here. In fact, many of these boot options are simply unnecessary for initial installation. We are presenting a more comprehensive list here, in one place, as you may find them useful later on.

One other piece of advice: write down and remember the boot options you use to get your system running. After you have installed Linux, you'll need to use the same boot options in order for your hardware to be properly detected each time you boot. If you install the LILO loader on your hard drive, you can configure it to automatically use a certain set of boot options so you won't have to type them each time.

no387

Disables the 80387 math coprocessor; circumvents some buggy coprocessors when used in protected mode.

no-hlt

Disables use of the HLT instruction; used to place the CPU into a low-power state when the system is idle. Some early 486DX-100 chips have a problem using this instruction.

root=device

Specifies the device to use as the root filesystem when booting the system. For initial installation this should not be used; after installaton of the system you can use this to override the default location of your Linux root filesystem.

ro

Mounts the root filesystem in a read-only state; used for system maintenance.

lock

Saves the boot parameters for the future so that you do not have to enter them each time you are booting the system.

rw

Mounts the root filesystem in a read-write state; used for system maintenance.

debug

Forces the kernel to print verbose debugging messages to the console as the system runs.

ramdisk=kilobytes

Tells the system to reserve the given number of kilobytes for a ramdisk. This is often used by installation boot floppies that load an entire filesystem image into memory. You don't want to use this option for initial installation, but if you want to experiment with ramdisks at a later date, this is the option to use.

mem=size

The system BIOS in most PCs only reports up to 64 MB of installed RAM; Linux uses this information to determine the amount of installed memory. If you have more than 64 MB and use an older kernel, you may need to use this parameter to allow the rest of system memory to be used. The size parameter can be a number with k or M appended; for example, mem=96M would specify a system with 96 MB of RAM installed. Note that if you tell the system it has more memory than is actually installed, Bad Things will eventually happen.

hd=cylinders,heads,sectors

Specifies the hard drive geometry for IDE and standard ST-506 drives (not SCSI drives). Required for systems such as the IBM PS/1, ValuePoint, and ThinkPad. For example, if your drive has 683 cylinders, 16 heads, and 32 sectors per track, use:

ramdisk hd=683,16,32
This option can also be used as hda=, hdb=, hdc=, or hdd= to specify the geometry for a particular IDE drive. Note that use of the hd= option may be necessary if you are using a large IDE drive (over 1024 cylinders). If Linux has problems recognizing the geometry of your drive (you'll know when you try to partition the disk for Linux), try using this option.

max_scsi_luns=num

If num is 1, the system won't probe for SCSI devices that have a Logical Unit Number (LUN) other than zero. This parameter is required for some poorly designed SCSI devices that lock up when probed at non-zero LUNs. Note that this does not have anything to do with the SCSI device ID; LUNs allow the addressing of multiple logical units or subdevices within a single SCSI device, such as a disk drive.

aha152x=iobase,irq,scsi-id,reconnect,parity

Specifies parameters for Adaptec AHA151x, AHA152x, AIC6260, AIC6230, and SB16-SCSI interfaces. iobase must be specified in hexadecimal, as in 0x340. All arguments except iobase are optional.

aha1542=iobase

Specifies the I/O base, in hex, for Adaptec AHA154x SCSI interfaces.

aic7xxx=extended,no-reset

Specifies parameters for Adaptec AHA274x, AHA284x, and AIC7xxx SCSI interfaces. A non-zero value for extended indicates that extended translation for large disks is enabled. If no-reset is non-zero, the driver will not reset the SCSI bus when configuring the adapter at boot time.

buslogic=iobase

Specifies the I/O base, in hex, for Buslogic SCSI interfaces.

tmc8xx=mem-base,irq

Specifies the base of the memory-mapped I/O region (in hex) and IRQ for Future Domain TMC-8xx and TMC-950 SCSI interfaces.

pas16=iobase,irq

Specifies the I/O base (in hex) and IRQ for Pro Audio Spectrum SCSI interfaces.

st0x=mem-base,irq

Specifies the base of the memory-mapped I/O region (in hex) and IRQ for Seagate ST-0x SCSI interfaces.

t128=mem-base,irq

Specifies the base of the memory-mapped I/O region (in hex) and IRQ for Trantor T128 SCSI interfaces.

aztcd=iobase

Specifies the I/O base (in hex) for Aztech CD-ROM interfaces.

cdu31a=iobase,irq,pas

Specifies the I/O base (in hex) and IRQ for CDU-31A and CDU-33A Sony CD-ROM interfaces. These options are used on some Pro Audio Spectrum sound cards, as well as boards from Sony. The irq and pas parameters are optional. If irq is 0, interrupts are not supported (as is the case with some boards). The only valid value for the pas option is PAS, indicating that a Pro Audio Spectrum card is being used.

soncd535=iobase,irq

Specifies the I/O base (in hex) and IRQ (optional) for Sony CDU-535 interfaces.

gscd=iobase

Specifies I/O base (in hex) for GoldStar CD-ROM interfaces.

mcd=iobase,irq

Specifies the I/O base (in hex) and IRQ (optional) for Mitsumi standard CD-ROM interfaces.

optcd=iobase

Specifies the I/O base (in hex) for Optics Storage Interface CD-ROM interfaces.

cm206=iobase,irq

Specifies the I/O base (in hex) and IRQ for Philips CM206 CD-ROM interfaces.

sjcd=iobase,irq,dma

Specifies the I/O base (in hex), IRQ, and DMA channel for Sanyo CD-ROM interfaces. The irq and dma parameters are optional.

sbpcd=iobase,type

Specifies the I/O base in hex for SoundBlaster Pro and compatible CD-ROM interfaces. The type parameter must be SoundBlaster, LaserMate, or SPEA, based on what type of board you have. Note that this option specifies parameters only for the CD-ROM interface, not for the sound hardware on the board.

ether=irq,iobase,parameters…

Specifies the IRQ and I/O base for Ethernet cards. If you are having problems detecting your Ethernet card and wish to use it for installation (e.g., via FTP or NFS), check out the Linux Ethernet HOWTO that describes the various boot options for Ethernet cards in much detail. There are too many to detail here.

floppy=thinkpad

Tells the floppy driver that you have a ThinkPad; necessary for floppy access on ThinkPad systems.

floppy=0,thinkpad

Tells the floppy driver that you do not have a ThinkPad, in case it's confused.

bmouse=irq

Specifies IRQ for busmouse[16] interface.

[16]A busmouse is a mouse attached to the system bus, instead of a serial port or a PS/2-style mouse port.

msmouse=irq

Specifies IRQ for Microsoft busmouse interface.

Quite a few other options are available; the previous options should be those that are generally necessary for normal use of your system. (For example, we have left out the many parameters available for sound card drivers; we urge you to read the appropriate HOWTO documents if you have a life-threatening situation involving use of your sound card.)

For each of these, you must enter linux followed by the parameters you wish to use.

If you have questions about these boot-time options, read the Linux Bootprompt HOWTO, Linux SCSI HOWTO, and Linux CD-ROM HOWTO. These three documents should be available on any Linux FTP site (as well as most Linux CD-ROMs) and describe the LILO boot arguments in more detail.

3.1.2. Drives and Partitions Under Linux

Many distributions require you to create Linux partitions by hand using the fdisk program. Others may automatically create partitions for you. Either way, you should know the following information about Linux partitions and device names. (This information applies only to Intel and Alpha systems; other systems like PowerPC, SPARC, and m68k do not have logical and extended partitions.)

Drives and partitions under Linux are given different names from their counterparts under other operating systems. Under MS-DOS, floppy drives are referred to as A: and B:, while hard drive partitions are named C:, D:, and so on. Under Linux, the naming convention is quite different.

Device drivers, found in the directory /dev, are used to communicate with devices on your system (such as hard drives, mice, and so on). For example, if you have a mouse on your system, you might access it through the driver /dev/mouse. Floppy drives, hard drives, and individual partitions are all given individual device drivers of their own. Don't worry about the device-driver interface for now; it is important only to understand how the various devices are named in order to use them. The section "Section 6.3, "Device Files"" in Chapter 6, "Managing Filesystems, Swap, and Devices", talks more about devices.

Table 3-1 lists the names of these various device drivers where multiple names can be created with increasing numbers (0, 1, etc.). One or two are shown in the table as examples.

Table 3-1. Linux Partition Names

Device Name
First floppy (A:) /dev/fd0
Second floppy (B:) /dev/fd1
First hard drive (entire drive) /dev/hda
First hard drive, primary partition 1 /dev/hda1
First hard drive, primary partition 2 /dev/hda2
First hard drive, primary partition 3 /dev/hda3
First hard drive, primary partition 4 /dev/hda4
First hard drive, logical partition 1 /dev/hda5
First hard drive, logical partition 2 /dev/hda6
...
Second hard drive (entire drive) /dev/hdb
Second hard drive, primary partition 1 /dev/hdb1
...
First SCSI hard drive (entire drive) /dev/sda
First SCSI hard drive, primary partition 1 /dev/sda1
...
Second SCSI hard drive (entire drive) /dev/sdb
Second SCSI hard drive, primary partition 1 /dev/sdb1
...
First SCSI CD-ROM drive /dev/scd0
Second SCSI CD-ROM drive /dev/scd1
...

First generic SCSI device (like scanners, CDR writers, etc.).
Note that newer systems use numbers instead of letters
(i.e., /dev/sg0 instead of /dev/sga).

/dev/sga
Second generic SCSI device /dev/sgb
...

A few notes about this table: /dev/fd0 corresponds to the first floppy drive (A: under MS-DOS), and /dev/fd1 corresponds to the second floppy (B:).

Also, SCSI hard drives are named differently from other drives. IDE, MFM, and RLL drives are accessed through the devices /dev/hda, /dev/hdb, and so on. The individual partitions on the drive /dev/hda are /dev/hda1, /dev/hda2, and so on. However, SCSI drives are named /dev/sda, /dev/sdb, and so on, with partition names such as /dev/sda1 and /dev/sda2.

Most systems, of course, do not have four primary partitions. But the names /dev/hda1 through /dev/hda4 are still reserved for these partitions; they cannot be used to name logical partitions.

Here's an example. Let's say you have a single IDE hard drive, with three primary partitions. The first two are set aside for MS-DOS, and the third is an extended partition that contains two logical partitions, both for use by Linux. The devices referring to these partitions would be:

Device Name
First MS-DOS partition (C:) /dev/hda1
Second MS-DOS partition (D:) /dev/hda2
Extended partition /dev/hda3
First Linux logical partition /dev/hda5
Second Linux logical partition /dev/hda6

Note that /dev/hda4 is skipped; it corresponds to the fourth primary partition, which we don't have in this example. Logical partitions are named consecutively starting with /dev/hda5.

3.1.3. Creating Linux Partitions

Now you are ready to create Linux partitions with the fdisk command. In general, you need to create at least one partition for the Linux software itself and another partition for swap space.

Here we are describing the basic text-mode usage of fdisk which should be available with all distributions. Many distributions nowadays provide a more user-friendly interface to fdisk. While those are usually not as flexible as plain fdisk, they can help you make the right choices more easily. Whatever tool you use, this section is helpful for understanding the underlying concepts. The tools all do more or less the same things in the end; some simply have more sugar-coating than others. You can also make use of the information presented here for fixing or checking something that you suspect didn't go right with the graphical tool.

After booting the installation media, run fdisk by typing:

fdisk drive
where drive is the Linux device name of the drive to which you plan to add partitions (see
Table 3-1). For instance, if you want to run fdisk on the first SCSI disk in your system, use the command:
# fdisk /dev/sda
/dev/hda (the first IDE drive) is the default if you don't specify one.

If you are creating Linux partitions on more than one drive, run fdisk once for each drive:

# fdisk /dev/hda 

Command (m for help):

Here fdisk is waiting for a command; you can type m to get a list of options:

Command (m for help): m 
Command action 
   a   toggle a bootable flag 
   d   delete a partition 
   l   list known partition types 
   m   print this menu 
   n   add a new partition 
   p   print the partition table 
   q   quit without saving changes 
   t   change a partition's system id 
   u   change display/entry units 
   v   verify the partition table 
   w   write table to disk and exit 
   x   extra functionality (experts only) 

Command (m for help):
The n command is used to create a new partition. Most other options you won't need to worry about. To quit fdisk without saving any changes, use the q command. To quit fdisk and write the changes to the partition table to disk, use the w command. This is worth repeating: So long as you quit with q without writing, you can mess around as much as you want with fdisk without risking harm to your data. Only when you type w, you can cause potential disaster to your data if you do something wrong.

The first thing you should do is display your current partition table and write the information down for later reference. Use the p command to see the information. It is a good idea to copy the information to your notebook after each change you have made to the partition table. If, for some reason, your partition table is damaged, you will not access any data on your hard disk any longer, even though the data itself is still there. But by using your notes, you might be able to restore the partition table and get your data back in many cases by running fdisk again and deleting and recreating the partitions with the parameters you previously wrote down. Don't forget to save the restored partition table when you are done.

Here is an example of a printed partition table:

Command (m for help): p 

Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders 
Units = cylinders of 608 * 512 bytes 
   Device Boot  Begin   Start     End  Blocks   Id  System 
/dev/hda1   *       1       1     203   61693    6  DOS 16-bit >=32M 

Command (m for help):
In this example, we have a single MS-DOS partition on /dev/hda1, which is 61693 blocks (about 60 MB).[17] This partition starts at cylinder number 1 and ends on cylinder 203. We have a total of 683 cylinders in this disk; so there are 480 cylinders left to create Linux partitions on.

[17]A block, under Linux, is 1024 bytes.

To create a new partition, use the n command. In this example, we'll create two primary partitions (/dev/hda2 and /dev/hda3 ) for Linux:

Command (m for help): n 
Command action 
  e   extended 
  p   primary partition (1-4)  
  p
Here, fdisk is asking which type of the partition to create: extended or primary. In our example, we're creating only primary partitions, so we choose p:
Partition number (1-4):
fdisk will then ask for the number of the partition to create; since partition 1 is already used, our first Linux partition will be number 2:
Partition number (1-4): 2
First cylinder (204-683):
Now, we enter the starting cylinder number of the partition. Since cylinders 204 through 683 are unused, we'll use the first available one (numbered 204). There's no reason to leave empty space between partitions:
First cylinder (204-683): 204 
Last cylinder or +size or +sizeM or +sizeK (204-683):
fdisk is asking for the size of the partition we want to create. We can either specify an ending cylinder number, or a size in bytes, kilobytes, or megabytes. Since we want our partition to be 80 MB in size, we specify +80M. When specifying a partition size in this way, fdisk will round the actual partition size to the nearest number of cylinders:
Last cylinder or +size or +sizeM or +sizeK (204-683): +80M 

Warning: Linux cannot currently use 33090 sectors of this partition
If you see a warning message such as this, it can be ignored. fdisk prints the warning because it's an older program and dates back before the time that Linux partitions were allowed to be larger than 64 MB.

Now we're ready to create our second Linux partition. For sake of demonstration, we'll create it with a size of 10 MB:

Command (m for help): n 
Command action 
   e   extended 
   p   primary partition (1-4) 
p 
Partition number (1-4): 3 
First cylinder (474-683): 474 
Last cylinder or +size or +sizeM or +sizeK (474-683): +10M

At last, we'll display the partition table. Again, write down all of this information--especially the block sizes of your new partitions. You'll need to know the sizes of the partitions when creating filesystems. Also, verify that none of your partitions overlap:

Command (m for help): p

Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders 
Units = cylinders of 608 * 512 bytes 
   Device Boot  Begin   Start     End  Blocks   Id  System 
/dev/hda1   *       1       1     203   61693    6  DOS 16-bit >=32M 
/dev/hda2         204     204     473   82080   83  Linux native 
/dev/hda3         474     474     507   10336   83  Linux native
As you can see, /dev/hda2 is now a partition of size 82080 blocks (which corresponds to about 80 MB), and /dev/hda3 is 10336 blocks (about 10 MB).

Note that most distributions require you to use the t command in fdisk to change the type of the swap partition to "Linux swap," which is numbered 82. You can use the L command to print a list of known partition type codes, and then use the t command to set the type of the swap partition to that which corresponds to "Linux swap."

This way the installation software will be able to automatically find your swap partitions based on type. If the installation software doesn't seem to recognize your swap partition, you might want to rerun fdisk and use the t command on the partition in question.

In the previous example, the remaining cylinders on the disk (numbered 508 to 683) are unused. You may wish to leave unused space on the disk, in case you wish to create additional partitions later.

Finally, we use the w command to write the changes to disk and exit fdisk:

Command (m for help): w
#

Keep in mind that none of the changes you make while running fdisk take effect until you give the w command, so you can toy with different configurations and save them when you're done. Also, if you want to quit fdisk at any time without saving the changes, use the q command. Remember that you shouldn't modify partitions for operating systems other than Linux with the Linux fdisk program.

You may not be able to boot Linux from a partition using cylinders numbered over 1023. Therefore, you should try to create your Linux root partition within the sub-1024 cylinder range which is almost always possible (e.g., by creating a small root partition in the sub-1024 cylinder range). If for some reason, you cannot or do not want to do this, you can simply boot Linux from floppy.

Some Linux distributions require you to reboot the system after running fdisk to allow the changes to the partition table to take effect before installing the software. Newer versions of fdisk automatically update the partition information in the kernel, so rebooting isn't necessary. To be on the safe side, after running fdisk you should reboot the installation media before proceeding.

3.1.4. Creating Swap Space

If you are planning to use a swap partition for virtual RAM, you're ready to prepare it.[18] In the section "Section 6.2, "Managing Swap Space"" in Chapter 6, "Managing Filesystems, Swap, and Devices", we discuss the preparation of a swap file, in case you don't want to use an individual partition.

[18]Again, some distributions of Linux prepare the swap space for you automatically, or via an installation menu option.

Many distributions require you to create and activate swap space before installing the software. If you have a small amount of physical RAM, the installation procedure may not be successful unless you have some amount of swap space enabled.

The command used to prepare a swap partition is mkswap, and it takes the following form:

mkswap -c partition size
where partition is the name of the swap partition, and size is the size of the partition in blocks.[19] For example, if your swap partition is /dev/hda3 and is 10336 blocks in size, use the command:
# mkswap -c /dev/hda3 10336
The -c option tells mkswap to check for bad blocks on the partition when creating the swap space. Bad blocks are spots on the magnetic media that do not hold the data correctly. This occurs only rarely with today's hard disks, but if it does, and you do not know about it, it can cause you endless trouble. Always use the -c option to have mkswap check for bad blocks. It will exclude these from being used automatically.

[19]This is the size as reported by fdisk, using the p menu option. Again, a block under Linux is 1024 bytes.

If you are using multiple swap partitions, you need to execute the appropriate mkswap command for each partition.

After formatting the swap space, you need to enable it for use by the system. Usually, the system automatically enables swap space at boot time. However, because you have not yet installed the Linux software, you need to enable it by hand.

The command to enable swap space is swapon, and it takes the following form:

swapon partition
After the mkswap command shown, we use the following command to enable the swap space on /dev/hda3:
# swapon /dev/hda3

3.1.5. Creating the Filesystems

Before you can use your Linux partitions to store files, you must create filesystems on them. Creating a filesystem is analogous to formatting a partition under MS-DOS or other operating systems. We discussed filesystems briefly in the section "Section 2.2.3, "Linux Partition Requirements"" in Chapter 2, "Preparing to Install Linux".

There are several types of filesystems available for Linux. Each filesystem type has its own format and set of characteristics (such as filename length, maximum file size, and so on). Linux also supports several "third-party" filesystem types, such as the MS-DOS filesystem.

The most commonly used filesystem type is the Second Extended Filesystem, or ext2fs. The ext2fs is one of the most efficient and flexible filesystems; it allows filenames of up to 256 characters and filesystem sizes of up to 4 terabytes. In the section "Section 6.1.1, "Filesystem Types"" in Chapter 6, "Managing Filesystems, Swap, and Devices", we discuss the various filesystem types available for Linux. Initially, however, we suggest you use the ext2fs filesystem.

To create an ext2fs filesystem, use the command:


mke2fs -c partition size
where partition is the name of the partition, and size is the size of the partition in blocks. For example, to create an 82080-block filesystem on /dev/hda2, use the command:
# mke2fs -c /dev/hda2 82080

If you're using multiple filesystems for Linux, you need to use the appropriate mke2fs command for each filesystem.

If you have encountered any problems at this point, see the section "Section 3.3, "Running Into Trouble"" later in this chapter.

3.1.6. Installing the Software

Finally, you are ready to install the software on your system. Every distribution has a different mechanism for doing this. Many distributions have a self-contained program that steps you through the installation. On other distributions, you have to mount your filesystems in a certain subdirectory (such as /mnt) and copy the software to them by hand. On CD-ROM distributions, you may be given the option to install a portion of the software on your hard drive and leave most of the software on the CD-ROM. This is often called a "live filesystem." Such a live filesystem is convenient for trying out Linux before you make a commitment to install everything on your disk.

Some distributions offer several different ways to install the software. For example, you may be able to install the software directly from an MS-DOS partition on your hard drive instead of from floppies. Or you may be able to install over a TCP/IP network via FTP or NFS. See your distribution's documentation for details.

For example, the Slackware distribution requires you to do the following:

  1. Create partitions with fdisk.

  2. Optionally create swap space with mkswap and swapon (if you have 16 MB or less of RAM).

  3. Run the setup program to install the software. setup leads you through a self-explanatory menu system.

The exact method used to install the Linux software differs greatly with each distribution.

You might be overwhelmed by the choice of software to install. Modern Linux distributions can easily contain a thousand or more packages spread over several CD-ROMs. There are basically three methods for selecting the software package:

Selection by task

This is the easiest means of selection for beginners. You don't have to think about whether you need a certain package, you just pick whether your Linux computer should act as a workstation, a development machine, or a network router, and the installation program will pick the appropriate packages for you. In all cases, you can then either refine the selection by hand or come back to the installation program later.

Selection of individual packages by series

With this selection mechanism, all the packages are grouped into series like "Networking," "Development," or "Graphics." You can go through all the series and pick the individual packages there. This requires more decisions than if you select it by task, because you still have to decide whether you need it or not, but you can skip an entire series when you are sure that you are not interested in the functions it offers.

Selection of individual packages sorted alphabetically

This method is useful only when you already know which packages you want to install; otherwise you won't see the forest for the trees.

Chosing one selection method does not exclude the use of the others. Most distributions offer two or more of the aforementioned selection mechanisms.

It might still be difficult to decide which package to pick. Good distributions show a short description of each package on screen to make it easier for you to select the correct ones, but if you are still unsure, our advice is this: when in doubt, leave it out! You can always go back and add packages later.

Modern distributions have a very nifty feature, the so-called dependency tracking. Some packages work only when some other packages are installed (e.g., a graphics viewer might need special graphics libraries to import files). With dependency tracking, the installation program can inform you about those dependencies and will let you automatically select the package you want along with all the ones it depends on. Unless you are very sure about what you are doing, you should always accept this offer, or the package might not work afterwards.

Installation programs can help you make your selection and avoid mistakes in other ways. For example, the installation program might refuse to start the installation when you deselect a package that is absolutely crucial for even the most minimal system to boot (like the basic directory structure). Or, it might check for mutual exclusions, such as cases in which you can only have one package or the other, but not both.

Some distributions like SuSE come with a large book that among other things lists all the packages together with short descriptions. It might be a good idea to at least skim those description to see what's in store for you, or you might be surprised when you select the packages and are offered the twenty-fifth text editor.

3.1.7. Creating the Boot Floppy or Installing LILO

Every distribution provides some means of booting your new Linux system after you have installed the software. In many cases, the installation procedure suggests you create a boot floppy, which contains a Linux kernel configured to use your newly created root filesystem. In order to boot Linux, you could boot from this floppy; control is transferred to your hard drive after you boot. On other distributions, this boot floppy is the installation floppy itself.

Many distributions give you the option of installing LILO on your hard drive. LILO is a program that resides on your drive's master boot record. It boots a number of operating systems, including MS-DOS and Linux, and allows you to select which to boot at startup time.

In order for LILO to be installed successfully, it needs to know a good deal of information about your drive configuration: for example, which partitions contain which operating systems, how to boot each operating system, and so on. Many distributions, when installing LILO, attempt to "guess" at the appropriate parameters for your configuration.   Although it's not often, the automated LILO installation provided by some distributions can fail and leave your master boot record in shambles (although it's very doubtful that any damage to the actual data on your hard drive will take place). In particular, if you use OS/2's Boot Manager, you should not install LILO using the automated procedure; there are special instructions for using LILO with the Boot Manager, which will be covered in Chapter 5, "Essential System Management".

In many cases, it is best to use a boot floppy until you have a chance to configure LILO yourself, by hand. If you're feeling exceptionally trustworthy, though, you can go ahead with the automated LILO installation if it is provided with your distribution.

In the section "Section 5.2.2, "Using LILO"" in Chapter 5, "Essential System Management", we'll cover in detail how to configure and install LILO for your particular setup.

If everything goes well, then congratulations! You have just installed Linux on your system. Go have a cup of tea or something; you deserve it.

In case you did run into any trouble, the section "Section 3.3, "Running Into Trouble"," later in this chapter, describes the most common sticking points for Linux installations, and how to get around them.

3.1.8. Additional Installation Procedures

Some distributions of Linux provide a number of additional installation procedures, allowing you to configure various software packages, such as TCP/IP networking, the X Window System, and so on. If you are provided with these configuration options during installation, you may wish to read ahead in this book for more information on how to configure this software. Otherwise, you should put off these installation procedures until you have a complete understanding of how to configure the software.

It's up to you; if all else fails, just go with the flow and see what happens. It's doubtful that anything you do incorrectly now cannot be undone in the future (knock on wood).



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.