- 3 -

Installing Linux

by Kamran Husain

IN THIS CHAPTER


This chapter deals with installing Slackware 96 on your PC. We will work with the Slackware release on the CD-ROM at the back of the book for the installation for this book. Depending on the type of PC you have, the installation process can be very easy (simple IDE disks, no network) or very hard (multiple drives, operating systems, and so on). In either case, be prepared to spend some time during the installation process.


CAUTION: Read this entire chapter to the end before you start the installation process. If you have not already read Chapter 1, "Introduction to Linux," and Chapter 2, "Types of Linux," now would be a good time to skim through them. It is important enough for me to reiterate: You must read this entire chapter all the way to the end before you start the Linux installation. Reading all the way through will let you know what to expect. It is not possible to backtrack during a Linux installation; you must start all over if you make a mistake. So spend the time now to read about what you are getting yourself into.

Types of Installation

Two methods of installing Linux are covered in this chapter: using VIEW.EXE and using RAWRITE.EXE. The VIEW.EXE procedure can further offer two choices: a floppy-based installation and floppy-less installation. All methods are easy to use; the choice is up to you. You need a DOS, UNIX, or Windows system to be able to initially read the contents of the Slackware CD-ROM for the installation process.

The tools required for VIEW.EXE installation processes are two blank DOS-formatted floppy disks. The VIEW.EXE program can be found on commercial Slackware sets available from Walnut Creek. (Visit their Web site at http://www.cdrom.com.) The information provided about the VIEW.EXE program also applies to the RAWRITE method.

If you are installing Linux on a system with which you will want to boot into Linux or MS-DOS using some sort of boot loader, you should consider using the floppy-less installation procedure. If you are installing on a system that will not have MS-DOS, consider using the floppy-based installation process. In most cases, though, users will want to install Linux on the same computer that runs their MS-DOS software.


TIP: As you start to install Linux on your machine, set aside some time when you will not be distracted. You will be making some major decisions on disk space, partitioning, and so on, and it will probably be a good idea to have some time to think. In other words, walk the dog before you start.

The basic tool for navigating the installation process is the VIEW.EXE program in the root directory for the commercial Slackware 96 CD-ROM from Walnut Creek. You can use the arrow keys to move around the selections presented on-screen and use the Enter key to select items on a screen. When you select a directory, the VIEW program switches to a directory. When you select a file, the VIEW program either runs the program or displays its contents. The Escape (Esc) key backs up directory trees or menu selections.


NOTE: The VIEW.EXE program does not run correctly under Windows 95. Don't run the VIEW.EXE program from within an MS-DOS window. If you are in Windows 95, reboot the machine in MS-DOS mode before proceeding with the Linux installation. During the boot process in Windows 95, you can press the F8 key to halt the boot process and use the menu to select the boot method. Choose the command-line interface method of booting into Windows 95 for this installation process.

NOTE: You don't need to be running MS-DOS to install Slackware. Running MS-DOS makes it easier, however, to create the boot and root floppies. If you are not running MS-DOS on your system, you can use someone else's MS-DOS system to create the floppies and then install.

Floppy-Less Installation of Slackware

Floppy-less installation of Slackware is not recommended. Run the VIEW.EXE program in MS-DOS, and select the kernels directory. From the list presented in the menu, select the kernel that best fits your type of machine. It's probably better to select the kernel with the closest and fewest features just to be sure you will be able to boot correctly.

After you have selected the kernel, you have two choices: either install Linux onto a Linux-only partition or use an existing MS-DOS partition for installing Linux files. The MS-DOS installation option lets you share a directory tree on a Linux system with an MS-DOS system file tree. The advantage is that the files in the Linux directory tree are accessible from within MS-DOS, and vice versa. The disadvantage is that the performance of such a file system is very slow.

When you have selected either root system (Linux or MS-DOS), the VIEW.EXE program attempts to load Linux. If the load completes successfully, you are presented with a login prompt. It's really that simple. However, should anything go wrong, other than the obvious disk full message, you should use floppies to install Linux instead of trying to debug the procedure.

Floppy-Based Installation of Slackware

For this installation procedure, you need two blank formatted floppy disks. One disk will be used as a boot disk and the other as a root disk. (If you have only 4MB of RAM, you might require a third blank formatted disk. Keep one on hand just in case you are asked to insert a RAMDISK during the installation process.)

Start the VIEW.EXE program. Switch to the bootdsks.144 directory if you have a 1.44MB floppy drive in A. Switch to the bootdisk.12 directory if you have a 1.2MB floppy drive in A. In the boot disk directories, you can choose either the ide.bat or the scsi.bat directory. Choose the path that describes your system: ide.bat if you have IDE drives and scsi.bat if you have a SCSI system.


CAUTION: Your boot sequence in the CMOS on your PC must be A: first, then C:. Otherwise, you will not be able to boot up from floppy disks.

After you are in a directory, select the boot disk that best describes your system from the list presented in the VIEW.EXE program. The files whose names end in .i are boot disks for IDE systems, and those whose names end in .s are boot disks for SCSI systems. Select the boot disk that best describes your CD-ROM and other related hardware. Be sure to select the boot disk that contains the CD-ROM drive on your machine even if the correct Ethernet or other device is not supported in it. You can always rebuild the kernel later. For the moment, just ensure that your Slackware CD-ROM is readable by the kernel that you will be booting.

When you have made your selection, the VIEW.EXE program asks you to insert a floppy disk in drive A. Label this floppy as the boot floppy, insert this floppy in drive A, and press Enter. Be patient; the file transfer takes a few minutes.

After the boot image has been written to disk, the VIEW.EXE program asks you to create a root disk.

A root image is a binary representation of a small root file system that also happens to reside on a floppy, just like the boot image. You need the root file system to start the installation process for Slackware.

The 1.2MB installation disks have the 12 string in their names rather than 144. For example, the tty image for the 1.2MB floppy disks is called tty12. Table 3.1 lists the root images for the 1.44MB floppies.

Table 3.1. Root images for 1.44MB drives.
Filename Description
COLOR.GZ A root install disk that uses the new full-screen color-install program. Be patient as you use this installation.
TEXT.GZ A root install disk for text-based installations. No fancy graphics, just a dumb terminal version of the install program.
UMSDOS.GZ A version of color.gz used to install UMSDOS, a file system that enables you to install Linux into a directory on an existing MS-DOS partition. Not as fast as ext2, but you don't have to repartition your drive either.
RESCUE Utilities to attempt to recover from an incomplete installation.
TAPE An experimental disk for installation from tape.
PCMCIA For laptop installation with PCMCIA cards from an NFS mounted drive.

The COLOR.GZ version of the install system is the preferred disk in almost all cases. Use the COLOR.GZ image if you can. It does have some known "features" though:


TIP: The floppies must have no bad blocks on them. Be sure you're using brand-new, preformatted, error-free floppies.

Making the Root and Boot Disks Without VIEW.EXE

You can make the root and boot disks without the VIEW.EXE program. This is the way to make floppies using the CD-ROM at the back of this book. The boot images that are available for 1.44MB floppies on the CD-ROM included with this book can be found in the bootdsks.144 directory. For 1.2MB (5[dieresis]-inch) floppy disks, comparable boot images exist in the bootdsks.12 directory. Several boot images are provided in this directory because of the diversity of various Linux device drivers. You have to choose which one best fits your system from those files in the installation directories. Check the bootdsks.144 or bootdsks.12 directories for the listed entries in the WHICH.ONE file.

Look in the INSTALL directory of the CD-ROM. You will see two programs there. Make sure that the PATH environment variable is set to include these programs:

Use the RAWRITE.EXE program to write the boot and root disk images to the floppies. For example, if you're using the color144.gz boot disk, issue these commands:

D:\> cd install

D:\INSTALL> rawrite

RaWrite 1.3 - Write disk file to raw floppy diskette

Enter source file name: d:\bootdsks.144\scsi

Enter destination drive: a

Please insert a formatted diskette into drive A: and press -Enter- : <Enter>

Writing image to drive A:  Press ^C to abort.

Track: 33  Head: 0  Sector: 10

Done.

Answer the prompts for the name of the file to read (such as BARE) and the drive (such as A) to which to write it. RAWRITE copies the file, block-by-block, directly to the floppy.

Use RAWRITE for the root disk image (such as COLOR) for the next floppy. Here's a sample run:

D:\> cd rootdsks.144

D:\ROOTDSKS> copy color.gz c:\

         1 file(s) copied

D:\ROOTDSKS> c:

C:\> d:\install\gzip -d color.gz

C:\> d:\install\rawrite

Enter source file name: color

Enter destination drive: a

Please insert a formatted diskette into drive A: and press -Enter- : <Enter>

Writing image to drive A:  Press ^C to abort.

Track: 79  Head: 1  Sector: 16

Creating Boot and Root Floppies on a UNIX System

You don't need to use GZIP.EXE and RAWRITE.EXE under UNIX to create the boot and root floppies. You can use the gzip and dd commands on a UNIX system instead. For this, you need a UNIX workstation with a floppy drive. For example, on a UNIX workstation with a 1.44MB floppy drive on device /dev/fd0H1440, you can use the following command:

% dd if=bare of=/dev/fd0H1440 obs=18k

The dd command writes the file bare to the floppy disk. The obs parameter is required to specify the output block size argument.

Preparing the Hard Disk

Depending on the type of root system you selected, you must either use an existing MS-DOS partition (for UMSDOS root) or create partitions for Linux. If you are using UMSDOS, skip to the next section. For other Linux installations, you need to create at least two partitions: one for swap space (used as virtual memory) and another for your "root file system" (that is, the actual Linux operating system software and your files). The root file system and your data don't have to reside in one partition. You can make additional partitions for your own data and user files. For example, instead of having just one partition contain both the Linux operating system and data, you can have two separate partitions, one for user files and data, and the other for the Linux operating system. (This will give you a total of three partitions if you count the swap space.) It's best to start with one partition that will contain both the data and the operating system for the moment because this is a simple procedure.

If you are an experienced UNIX user, you might want to keep the /home directory tree on a separate disk or partition. The /home directory is where users' data is kept in Linux. By keeping /home on a separate partition, you can even reformat your partitions used for Linux (during a major update, for example) and not affect your working directories. The only caveat is that you have to remember to have Linux mount the /home partition when it boots.

Before you partition your hard drive, check to see whether you have any space on it that's not already partitioned. Chances are that you have used it up already. Run the MS-DOS FDISK program to delete the partition and re-create a smaller partition. Of course, in so doing, you will lose everything on that DOS partition that you just sliced up. Back up the files first and reinstall them after you've re-created and reformatted the partition. For example, if you have a 800MB drive used entirely for DOS, you might want to slice it into two 400MB portions: one for Linux and one for DOS.


CAUTION: When you delete a partition, you will lose all the data on that partition. So be careful how you resize your partitions. Always make a backup of your directory tree before modifying the hard disk partition table.

For dual boot systems that also use the hard drive to boot MS-DOS, you must allocate the first partition of your hard drive for MS-DOS. This step is necessary if you do not decide to use the Linux Loader (LILO) boot loader for your hard drive. LILO is a configurable Linux utility you can use to specify which partition to use in booting a machine. More details of LILO are covered in Chapter 4, "Booting Linux."

Setting Aside Space for a Swap Partition

A swap partition is used as virtual memory for Linux. If you have 8MB of memory on your machine and use a 16MB swap partition, programs in Linux will be able to utilize 24MB of virtual memory. The extra memory is slow because it's off a hard drive. Programs that chew up a lot of memory, however, are able to run, even if slowly, on a Linux system with less than ideal real memory.

I strongly suggest that you use a swap partition even if you have more than 16MB of RAM. If you have 4MB of RAM or less, a swap partition is required to install the software.

The size of your swap partition depends on how much virtual memory you need. It's often suggested that you have at least 16MB of virtual memory total. Therefore, if you have 8MB of physical RAM, you might want to create at least an 8MB swap partition (or 16MB if you follow the "twice as much RAM" rule of thumb). The maximum size for a swap partition was 128MB at the time of writing this book.

Resizing MS-DOS Partitions

The MS-DOS version of FDISK is more reliable than the Linux fdisk if you want to access DOS partitions on your machine. You should take the steps to resize MS-DOS partitions with MS-DOS FDISK:

1. Make a full backup of any current software.

2.
Verify the integrity of the backup. You want to make sure that you can read your
archived data later.

3.
Create an MS-DOS bootable floppy, using a command such as FORMAT /S A:, which puts the MS-DOS system files on a new floppy.

4.
Copy the files FDISK.EXE and FORMAT.COM to this floppy, as well as any other utilities you need (including, for example, your restore program, editors, and such).

5.
Boot the PC using the MS-DOS system floppy you just created. Run FDISK (MS-DOS only).

6.
Use the FDISK menu options to delete the partitions you want to resize.

7.
Use the MS-DOS FDISK menu options to create newer, smaller MS-DOS partitions. Do not create or assign disk space for partitions you intend to use for Linux. You will create and set the type for the Linux partitions later in the Linux installation process.

8.
Exit FDISK.

9.
Reformat the new MS-DOS partitions with the MS-DOS FORMAT command. Do not format partitions that are designated for Linux.

10.
Restore the MS-DOS original files from backup.

NOTE: A utility called FIPS, an FDISK clone for MS-DOS, can nondestructively resize your partitions. You can find it on sunsite.unc.edu, in /pub/Linux/system/Install. It is a compressed tar file, so you need to uncompress and untar it before transferring it to DOS. Having said this, I should warn you that it's safer for you to back up your DOS partition than to risk it with any utility.

CAUTION: Running FDISK will destroy all data on these partitions. If you are using multiple operating systems on the same hard disk, be sure to back up all data before starting to repartition. The fdisk commands used by different operating systems can conflict in such a way that entire partitions might disappear or become inaccessible, even if you use the command correctly.

Note that MS-DOS FDISK also offers the option of creating a logical DOS drive. A logical DOS drive is space on a logical partition on your hard drive. You can install Linux on an extended partition. So if you're currently using a logical DOS drive and want to install Linux in its place, delete the logical drive with MS-DOS FDISK. Then you can create a logical drive for use with Linux in its place.


TIP: The mechanism used to repartition for OS/2 and other operating systems is similar. See the documentation for those operating systems for details.

Booting the System for Installation

Now that you have prepared your hard drive and created your boot and root disks, you can boot and install Linux on your machine. Place the first boot disk in drive A of your target PC, and reset the machine.

You see a flurry of messages and other information pass by while the system boots. Look for this message:

"Welcome to the Slackware Linux .... Bootkernel disk!"

After booting the kernel, you are prompted to enter the Slackware root disk:

VFS: Insert root floppy and press ENTER:

At this point, you should remove the boot disk from the drive and insert the root disk. Then press Enter to go on.


CAUTION: Do not remove any floppy disk unless you are explicitly asked to do so via a prompt. If you remove the floppy while the system has it mounted, the system will crash and require a reboot.

You should be presented with a login prompt. Log in as root:

slackware login: root

#

If you do not know how to log in, don't worry. Just type root at the prompt (login) and press Enter, and you are presented with a hash mark (#). This is your root login prompt. You issue commands to the Linux kernel at this prompt.

Using Linux fdisk

After the system is up, you must assign the partitions you set aside in the previous steps for use with Linux. Basically, you will set up the partitions with fdisk and then run the setup command to install the software on this machine.

From the # prompt, run the fdisk command in Linux. Note that the Linux fdisk is not the same FDISK program under MS-DOS, and you should know about its commands before you press the wrong keys!

The Linux fdisk program is interactive, and you have to type one-letter commands for all actions. The m (menu) command presents you with a list of the available options. Following is a list of command options for the fdisk program:
d Deletes a partition from the table
l Lists all known partition types for fdisk
n Creates a new partition in the current drive
p Displays your current partition table entries
q Quits without saving any changes
t Changes the partition type code
u Changes display and entry units
v Verifies the partition table
w Writes all changes and exits
x
Starts Expert mode (used only for bit manipulation of sectors and so forth)
In Linux, partitions are given a name based on the drive they belong to. Drives and partitions on drives are named in Linux by the following convention: h for IDE hard drive, a for the first drive, b for the second drive, and s for SCSI drives. Up to four partitions numbered from 1 to 4 are allowed per drive. So /dev/hdb1 is the first partition on the second IDE drive, /dev/sdb is for the first SCSI drive, /dev/hda is the first drive itself, and /dev/hda2 is the second partition on the first IDE drive. If you have any logical partitions, they are numbered starting with /dev/hda5, /dev/hda6, and so on.

You run the fdisk command like this:

# fdisk

The fdisk program starts and presents you with the following prompt:

pop:/sbin# fdisk

Using /dev/hda as default device!

The number of cylinders for this disk is set to 2100.

This is larger than 1024, and may cause problems with:

1) software that runs at boot time (e.g., LILO)

2) booting and partitioning software form other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):

Note that the default drive in this case is the first drive, /dev/hda.

You can specify the drive name to the fdisk command at the command line to use a different drive. For example, the command

fdisk /dev/hdb

starts fdisk using the information on the second IDE drive.

The fdisk program works one drive at a time, so you have to run fdisk once for each drive. Linux partitions do not have to be on the same physical drive. You might want to create your root file system partition on /dev/hda3 and your swap partition on /dev/hdb2, for example.


CAUTION: Linux's fdisk and the FDISK from MS-DOS are suited for their own respective file system. It's best not to create or delete partitions for operating systems other than Linux with Linux fdisk. Similarly, don't create or delete Linux partitions with MS-DOS's version of FDISK.

NOTE: An extended partition does not equal an extended file system. An extended partition acts as a container for logical partitions. With this container, you can have more than four partitions on a hard drive. Extended partitions cannot hold data on their own. You must create logical partitions on the extended partition to hold data. On the other hand, an extended file system is a Linux file system that resides on a logical partition.

A Sample Run

Let's start with an example using my hard disk as the starting point for use with fdisk. My hard drive is about 540MB. I want to use 63MB for DOS, exactly 16MB for swap space, and the rest for Linux. Keep in mind that the numbers you see on your screen are completely different from those in this book because it's very unlikely that you will choose the same setup I have listed here.

First, use the p command to display the current partition table. As you can see here, /dev/hda1 (the first partition on /dev/hda) is a DOS partition of 63,000 blocks on my machine:

Command (m for help):   p

  Disk /dev/hda: 16 heads, 63 sectors, 1024 cylinders

  Units = cylinders of 1008 * 512 bytes

   Device Boot  Begin   Start     End  Blocks   Id  System

/dev/hda1   *       2       2     126   63000    6  DOS 16-bit >=32M

  Command (m for help):

This output shows the begin and end cylinder numbers on the hard drive, the number of blocks used, and the type of the block. I know from my hard drive's documentation that it has 1,024 cylinders, and that information is echoed on the screen from fdisk.

From the preceding listing, I see that I am using 126 cylinders for my DOS partition. For some unexplained reason, cylinder 1 is not used. (It was a mistake when I installed DOS the nth time while writing this book, so I have to live with it.)

I determine the number of cylinders I will use for the swap space as 16,000 / 1,024, or about 15,624 blocks. This is not an exact science, so you can just guess and still be in the ballpark. I am going to use 30 cylinders for my swap space. I decide arbitrarily to place this on cylinders 994 through 1,024. In retrospect, this was not a good idea because I would almost always place the swap space in the lower-numbered sectors. The seek time is supposedly faster for lower-numbered cylinders...a myth maybe?

Anyhow, this leaves me with the cylinders from 127 to 993 for Linux. I will now create a new partition using the n command. The Linux root partition is going to be 463MB in size.

I am asked whether I want to create an extended or a primary partition. In most cases, you want to use primary partitions, unless you need more than four partitions on a drive. I will choose the p option to make this a primary partition. Then I am asked for the starting cylinder and the size of the partition:

Partition number (1-4): 2

First cylinder (127-1024): 127

Last cylinder or +size or +sizeM or +sizeK (128-1024): +993M

The value for the first cylinder should be one greater than the value of the last cylinder for the previous partition. In this case, /dev/hda1 ended on cylinder 126, so the new partition starts at cylinder 127. The number +993M specifies a partition of 993MB. Be sure to use the M for specifying megabytes. K is used to specify kilobytes, and nothing is used for bytes. For example, +993K would 993KB, and +993 would specify just 993 bytes for the partition.

After you have created the partition, you have to set its type. Press the t key on the command option to set the type of partition:

Command (m for help): t

Partition number (1-4): 2

Hex code (L to list): L

The L response to the hex code command lists several partition types:

Command (m for help): L

 0  Empty            9  AIX bootable    75  PC/IX           b7  BSDI fs

 1  DOS 12-bit FAT   a  OS/2 Boot Manag 80  Old MINIX       b8  BSDI swap

 2  XENIX root      40  Venix 80286     81  Linux/MINIX     c7  Syrinx

 3  XENIX usr       51  Novell?         82  Linux swap      db  CP/M

 4  DOS 16-bit <32M 52  Microport       83  Linux native    e1  DOS access

 5  Extended        63  GNU HURD        93  Amoeba          e3  DOS R/O

 6  DOS 16-bit >=32 64  Novell Netware  94  Amoeba BBT      f2  DOS secondary

 7  OS/2 HPFS       65  Novell Netware  a5  BSD/386         ff  BBT

 8  AIX

Command (m for help):t

Partition number (1-4): 2

Hex code (L to list): 83

You should use the Linux native selection, 83, for the partition you will be storing your Linux data on. Onward, ho! To create the partition space, I need a 16MB swap partition, which I will place in /dev/hda3. Actually, the setup program that we will run shortly will let you create this from a menu as well. While we are here, let's just go ahead and create it and enable it with the menu later. (The command to enable swap space manually is mkswap. In my humble opinion, you should use the menu version for enabling swap space.) The procedure is the same as for the data partition, except that we will choose type 82 for the Linux partition type:

Command (m for help): n

Command action

    e   extended

    p   primary partition (1-4)

p

Partition number (1-4): 3

First cylinder (994-1024):  994

Last cylinder or +size or +sizeM or +sizeK (994-1024): 1024

Command (m for help): t

Partition number (1-4): 3

Hex code (L to list): 82

Because this a swap partition, choose the type Linux swap, 82.

This is what my hard drive's partition table looks like:

Command (m for help):   p

  Disk /dev/hda: 16 heads, 63 sectors, 1024 cylinders

  Units = cylinders of 1008 * 512 bytes

   Device Boot  Begin   Start     End  Blocks   Id  System

/dev/hda1   *       2       2     126   63000    6  DOS 16-bit >=32M

/dev/hda2   *     127     127     993  436968   82  Linux swap

/dev/hda3   *     994     994    1024   15624   83  Linux native

If you are following along with your own hard drive with me, stop! The numbers you see on-screen will most certainly be different than those shown here. Be sure to write down on paper your own information corresponding to the information shown here, especially the size of each partition in blocks. You will need this partition and block information later.

Wait! You are not done yet.

These changes have been made only to a copy in memory of the on-disk partition table. You now have to write this new table with its changes to disk. Save these changes to disk and quit with the w command. Use the q command to quit fdisk without saving changes.

Press Ctrl-Alt-Delete to reset the machine. While it's rebooting, swap floppies to ensure that the boot disk is in drive A. You really do not have to reboot after running fdisk during the installation process, but it will remove any possible inconsistencies between the tables in memory and those on disk. Play it safe and reboot. In normal operation, such as running fdisk from a running Linux system, you should reboot just to be safe.


WARNING: If you see any error messages at this point about "sectors greater than 1024," you should check to see whether you have the right type of hard drive in your CMOS. The warning comes with older controller cards that cannot boot Linux off a partition that is on a cylinder greater than 1023. The error is not harmful, however, because you can boot into Linux and install away on a partition located on a sector that is on cylinder 1023 (or less). For more information, consult the Linux documentation at
http://sunsite.unc.edu/mdw/HOWTO/mini/Large-Disk

Installing Linux Files

You have created the partitions for the drive and are now ready to install the file system and software for Linux.

Installing the Slackware release is simple when compared to what you have just been through. You use the setup command, which guides you through a series of menus with which you can specify the means of installation, the partitions to use, and so forth.

Now issue the following command:

# setup

You see a menu with the following options. You can navigate the menu with the arrow keys on your keyboard. Use the spacebar or Enter key to select the option that the highlighted cursor is on.


CAUTION: The setup program is not very forgiving of incorrectly typed keys. Read every screen carefully, and be sure of what you are doing when you select any option other than the default. Most of the defaults on the screen are probably what you want anyway. Do not use the spacebar or Esc key as a cancel button in the setup program's menu. These are interpreted as the Enter key.

CAUTION: Pressing the Cancel button displayed on-screen while you are installing a package does not bail you out of the entire installation process. In fact, it only cancels the installation of the package whose dialog box you see on-screen. If you mistakenly decide not to install a package, you can always install it later. If you install a package you did not want (for example, the Ethernet drivers for a card you do not have), you can uninstall it later, too. So don't worry.

You should follow the sequence of menu items in the order in which they are displayed. Do not venture into the QUICK and MAKE TAGS menu options. The defaults work in almost all cases.

If you have not created the swap space earlier, the ADDSWAP selection presents a menu to let you create such a partition. If a swap partition already exists, as in the previous exercise, the ADDSWAP option asks whether you want to enable this swap partition. If the setup program is being run from a boot disk (as it was the first time), you should enable the swap partition. In the future when you run setup from a running Linux system, do not enable the swap partition, because it will be enabled every time you boot up.

The SOURCE and TARGET options specify the source of installable packages and the partition to install these items on. If your CD-ROM is not the correct one, this is when you will find out. This is a bit late in the process, but that's how it works, folks. If you get errors about not being able to mount the CD-ROM, you have to start over with a different CD-ROM driver.

The installation program lets you select the packages to install from the DISK SET items. The A set is required for Linux to even run. The AP set offers the features you probably will not be able to live without. You probably want to install the X and D sets for the X Window and documentation on Linux. There is no hard and fast rule about the other packages that are present on the CD-ROM. You can always run setup later as root from the /sbin directory to install any disk sets you did not install earlier.

After the software is installed (the process will take a while), you are presented with the CONFIGURE menu item. The configuration is pretty straightforward. Select the correct hardware, time, and network address from the menu items.

You also can modify the LILO parameters to allow booting from the hard disk. When you are running setup, if you choose the LILO option, you can use the existing lilo.conf file by choosing the RECYCLE option. For the moment, you should start with a new LILO header. Type the appropriate device names of the partitions you want to boot from, and be sure to select the option to write all the changes to disk.

After the configuration is done, you can quit the setup menu. Now is the time to reboot the system. Press Ctrl-Alt-Delete to perform the shutdown command. (It's safe to do so here.) The kernel should reboot. After the machine starts booting, remove the root floppy disk from drive A.

Linux should now boot straight from the hard drive from the partition you specified for LILO. After a flurry of messages quite similar to the ones you saw with the boot disk, you should see a login prompt. Log in as root and change the password with the passwd command. You are asked to enter the password twice to ensure that any mistyped errors are avoided.

Congratulations. You are now running Linux on your machine.

Creating the File System

Even though the installation program, setup, will create and install a file system for you, at times you will want to prepare other partitions for use with Linux. For example, you might want to store important files in a different partition.

You can also create a file system for Linux manually by using the following commands:

The partition is the name of the partition to make the file system on. The size of the partition is taken from the fdisk table entries. Be sure to give the size in Linux blocks (1024 bytes each), not sectors. This might be the problem if Linux mke2fs doesn't accept the size you give the device although when you double-check the size with fdisk, it shows that the size is correct. Also, make sure that you have the right partition; partitions are numbered /dev/hda1, /dev/hda2, and so on (and /dev/hdb1, /dev/hdb2 for the second hard drive). Don't use /dev/hda or /dev/hdb because they correspond to entire disks rather than single partitions.

These commands will create an unformatted file system for you. The setup program will let you format this new file system.

In almost all cases, you will want to use the second extended file system because it's the fastest and most reliable one of the four file systems listed previously for Linux.

You must do two very important things immediately after installing Linux. One is to create an account for yourself, and the other is to ensure that your new Linux machine does not conflict with other machines if you are on a network.

Dont Run As Root

After you boot your shining new Linux system and log in as root, one of the first things you should do is create an account for yourself. In most cases, you will want to use Linux while logged in as a normal user and not as root. Use the root login only for system-related and administrative tasks that require root privilege. You are less likely to damage your Linux file system if you are not running as root all the time.

The adduser command can be used for this purpose. For example, to add myself to the system, I used the following commands:

HostName:~# adduser

Adding a new user.  The username should not exceed 8 characters

in length, or you may run into problems later.

Enter login name for new account (^C to quit): kamran

Editing information for new user [kamran]

Full Name: Kamran Husain

GID [100]: <Enter>

Group `users', GID 100

First unused id is 501

UID [501]: <Enter>

Home Directory [/home/kamran]: <Enter>

Shell [/bin/bash]: <Enter>

Password [kamran]: helpme12   [beg] NOTE: [end]The password doesn't appear on-screen as you type.

Information for new user [kamran]:

Home directory: [/home/kamran] Shell: [/bin/bash]

uid: [502] gid:[100]

Is this correct? [y/N]: y

Adding login [kamran] and making directory [/home/kamran]

Adding the files from the /etc/skel directory:

./.kermrc -> /home/kamran/./.kermrc

./.less -> /home/kamran/./.less

./.lessrc -> /home/kamran/./.lessrc

./.term -> /home/kamran/./.term

./.term/termrc -> /home/kamran/./.term/termrc

Just use the defaults presented to you by adduser when you are answering the prompts.

Changing Your Hostname If Youre on a Network

This step is required only if you are connected to a network. Even if you are on a standalone machine, it's a good idea to change the hostname for the machine. The default hostname of your machine is set to an obscure name at boot time in the file /etc/rc.d/rc.M. If you are connected to a network, you should edit this file (as root) to something that does not clash with other machines on this system. Also, make sure that the entries in the /etc/hosts files do not clash with any other machines on your network. After you edit this file, run the hostname command to have the changes take effect. This is the time to edit the domain name commands to ensure your machine's presence on a TCP/IP network. See Chapter 43, "Networking," for details.

Obviously, you can set up and configure many more things for your network. A good book on UNIX systems administration should help. (I suggest UNIX Unleashed, from Sams Publishing, ISBN 0-672-30402-3.) Let's wait, however, until we get to the system administration chapter.

Multiple Login Sessions with Virtual Consoles

Linux, like some other versions of UNIX, provides access to virtual consoles (VC) so that you can have more than one login session from your console at a time. In X Window, you can use multiple windows to start different sessions. When faced with text-based screens, you can use virtual consoles.

Linux starts with six or eight virtual consoles (VCs). You boot into the first virtual console, VC0, when the machine starts. You can select any VC by pressing the Alt key with a function key from F1 to F6. For example, pressing Alt-F2 presents the login: prompt again. You're looking at the second VC. To switch back to the first VC, press Alt-F1. On a newly installed Linux system, you can access the first six VCs by using Alt-F1 through Alt-F6. By using VCs, you can have several login sessions at one time on the same Linux machine.


TIP: In fact, you can use VCs 1 and 2 while you are installing the software! Try it.

Powering Down

Linux is a multitasking system: it has to process several items "at the same time." Some of the processes that are run by the kernel are invisible to you. These processes are called background processes, or daemons. When you arbitrarily kill the power to a UNIX machine, you might be killing the computer in the middle of a daemon's operation.

Obviously, the solution is to ask for a graceful ending to a UNIX session. This is where the shutdown command comes in. After installation, you can find shutdown in the /sbin directory. This is the syntax for the shutdown command:

# /sbin/shutdown [-hr]  [time]

Because you are the only user, you usually will give the command to shut down the system immediately:

# /sbin/shutdown -h now

The -h option requests that the system be halted. To reboot the system, use the -r option:

# /sbin/shutdown -r now

The -r option requests shutdown to halt the system and then restart it. You would normally use this option if you made some changes to the UNIX system that would require a lot of daemons, system parameters, or both to be changed.


CAUTION: The Ctrl-Alt-Delete combination also invokes the shutdown command. I have received some messages from Linux users, however, who say that the three-key combination hung their system up instead of calling shutdown. In one case, the file system was corrupted. Play it safe--use the shutdown command directly.

CAUTION: Never, ever shut down a Linux system without using the shutdown command. Not using this command could place your file system at great risk of being corrupted. You have to be logged in as root to use the shutdown command.

A Final Word About Installing Linux

You should now have enough of the basics to get Linux installed on your system. Unfortunately, it's impossible to cover all the ways you can install Linux. Simply too many versions of Linux and even more versions of PC hardware exist. It is simpler and more coherent to cover the specific instructions for a single release of Linux, such as the one found on the CD-ROM.

The basic concepts in this chapter hold regardless of which Linux you wind up with. All releases require you to run fdisk, and all of them include some kind of installation menu similar to the setup program. If you choose to use a release of Linux other than Slackware, the READMEs and installation instructions that come with that release should be easy to understand in the context of the material presented here.

If you want a more complete discussion of Linux installation (rather than the "quick" examples given here), read the online book Linux Installation & Getting Started via FTP from the sunsite.unc.edu site in the directory /pub/Linux/docs/LDP. The Web site for this discussion can also be found on http://sunsite.unc.edu/pub/Linux/docs/LDP/INDEX.html.

Summary

In this chapter, I covered how to install Linux through the following topics:

Keep in mind that no single document can cover all aspects of installing Linux. You will find several ways to do the same thing in Linux. Also, this is your system--do with it as you please!