Документ взят из кэша поисковой машины. Адрес оригинального документа : http://itpm.msu.su/LDP/LinuxAdministration/linux-admin-made-easy-4.html
Дата изменения: Sun Apr 18 13:35:40 1999
Дата индексирования: Mon Oct 1 21:58:41 2012
Кодировка:
Linux Administration Made Easy: Installation and Hardware Configuration Next Previous Contents

4. Installation and Hardware Configuration

This chapter will detail the procedures needed to install Red Hat 5.2 onto an Intel system. Since much of this information is already well documented in the Red Hat User's Guide (provided as a paper manual in the "Official" boxed sets, as well as available online at http://www.redhat.com/support/docs/rhl/RHL-5.2-Manual/install-guide/manual/), I've skimmed over much of the details. However, there are a few things which I think are lacking in the Red Hat guide, and therefore I will attempt to cover those items in greater detail.

4.1 Creating an Installation Diskette

The first step in getting Red Hat's distribution of Linux onto a system, you need to find a way of starting the installation program. The usual method of doing so is to create an installation disk, although if you are installing from CD-ROM, have a way of booting into DOS, you can run the "ezstart" program from the CD-ROM.

Otherwise, to create an installation diskette, you'll need to copy the ``boot.img'' (which is simply an image of an ext2-formatted Linux boot diskette with an additional installation program) onto a floppy diskette. The ``boot.img'' file can be obtained from the /images directory of the Red Hat CD-ROM disk, or downloaded via FTP from ftp://ftp.redhat.com in the /pub/redhat/redhat-5.2/i386/images directory (assuming you are installing Linux on an Intel box).

You can create the boot diskette either from a DOS or Windows system, or from an existing Linux or Unix system. For your destination diskette, you can use either an unformatted or a pre-formatted (for DOS) diskette -- it makes no difference.

Under DOS: Assuming your CD-ROM is accessible as drive D:, you can type:

d:
cd \images
..\dosutils\rawrite

For the source file, enter ``boot.img''. For the destination file, enter ``a:'' (assuming the diskette you are created is inserted into the A: drive). The ``rawrite'' program will then copy the ``boot.img'' file onto diskette.

Under Linux/Unix: Assuming the ``boot.img'' file is located in the current directory (you may need to mount the CD-ROM under /mnt/cdrom and find the file in /mnt/cdrom/images), you can type:

dd if=boot.img of=/dev/fd0

The ``dd'' utility will copy, as it's input file ("if"), the ``boot.img'' file, onto the output file ("of") /dev/fd0 (assuming your floppy drive is accessible from /dev/fd0).

Unless your Linux or Unix system allows write permissions to the floppy device, you may need to do this command as the superuser. (If you know the root password, type ``su'' to become the superuser, execute the ``dd'' command, and then type ``exit'' to return to normal user status).

With either of the above schemes, you should now have a bootable Red Hat 5.2 installation diskette that you can use to install your new Red Hat Linux system!

4.2 Booting Linux Installation Program

To begin setting up your new Red Hat system, either run the ``ezstart'' program from DOS, or insert the installation diskette in the system's A: drive, and reboot or power-on the system. After a few moments, the Red Hat installation program screen should appear.

In most cases, you can just press <Enter> to begin the installation process, but if you are a more experienced user who knows exactly how your hardware devices should be set up, you can enter ``expert'' for the additional information and prompts this feature provides. (If you do nothing, the default installation procedure will start in about 10 to 15 seconds after the installation screen first appears.)

You will then be asked to choose your language (usually "English") and your keyboard type (even in Canada I choose "US 101-key"), as well as where you are installing from (such as from your CD-ROM or over the network). Red Hat is very flexible in where it can be installed from.

Most likely you will choose ``Local CDROM'' to install from your Red Hat CD-ROM (which should be inserted into your CD-ROM device). However, if your system is not equipped with a CD-ROM device, there are a number of other installation methods you can choose.

If you have another Linux system (or any other operating system that supports NFS file mounting), you can use ``NFS'' to install from an NFS mount. To do this, you'll need to have your CD-ROM mounted in the other system (or otherwise have the Red Hat distribution tree somewhere on the other system -- it is possible to download everything via FTP and then install from your other system's hard drive), make sure you have an entry in your /etc/exports file allowing access by the new system to the appropriate directory (see the "Network File System (NFS) Services" section for details on how to set up and use NFS), and then enter the appropriate details. Here's an example walk-through:

There are other ways of installing Red Hat, such as using a Samba (Windows- style networking) connection, from an existing partition (such as your DOS or Windows 95 partition) on your hard drive, or via FTP. Check the Red Hat users guide for more details on installing using these methods, or just try to struggle through them (the procedures are really not very difficult!)

Once you have chosen your installation source, Red Hat will ask you if you wish to "Install" or "Upgrade" your system. As you are installing a new system, you should choose "Install". (As an aside, I'm a fairly anal person who never upgrades new distribution releases over existing systems -- I guess having suffered through so many problems with Microsoft products I have developed a significant mistrust for upgrading systems as a whole. I prefer to install from scratch, and simply restore from backup my personal/user and local site files.)

The installation program will then ask you if you have a SCSI adapter. If you answer yes, you'll be asked to choose the appropriate driver. In some circumstances, Red Hat will be able to detect your adapter automatically.

Next, you'll be asked to set up your file systems (ie. partition one or more drives for Linux). There are two tools available for setting up these partitions, including the Red Hat-supplied "Disk Druid", and the standard Linux "/fdisk" utility.

Both tools are similar in function, allowing you to specify the partition types and sizes. However, Disk Druid seems to be a bit more "user friendly", and a bit more complete than fdisk. In fact, if you use fdisk to partition your drives, you'll then be presented with the Disk Druid screen for specifying your mount points _anyway_. That being said, as an ex-Slackware user, I personally always use fdisk -- force of habit, I guess! :-)

The next section will detail how and why you should set up your partition information.

4.3 Partitioning Hard Drive(s)

Why partition, anyway? Well, although it is possible to get a perfectly functioning Linux system running on a single-partition system, and, in fact, is a bit easier to configure this way, there are a number of benefits from partitioning one or more of your storage devices into multiple partitions.

While it is true that Linux will operate just fine on a disk with only one large partition defined, there are several advantages to partitioning your disk for at least the four main file systems (root, usr, home, and swap). These include:

First, it may reduce the time required to perform file system checks (both upon bootup and when doing a manual fsck), because these checks can be done in parallel. (By the way, NEVER run an fsck on a mounted file system!!! You will almost certainly regret what happens to it. The exception to this is if the file system is mounted read-only, in which case it is safe to do so.) Also, file system checks are a lot easier to do on a system with multiple partitions. For example, if I knew my /home partition had problems, I could simply unmount it, perform a file system check, and then remount the repaired file system (as opposed to booting my system with a rescue diskette into single-user mode and doing the repairs).

Second, with multiple partitions, you can, if you wish, mount one or more of your partitions as read-only. For example, if you decide that everything in /usr will not be touched even by root, you can mount the /usr partition as read-only.

Finally, the most important benefit that partitioning provides is protection of your file systems. If something should happen to a file system (either through user error or system failure), on a partitioned system you would probably only lose files on a single file system. On a non-partitioned system, you would probably lose them on all file systems.

This little fact can be a big plus. For example, if your root partition is so corrupted you can't boot, you can basically boot from the rescue diskette set, mount your root partition, and copy what you can (or restore from backup; see the "Backup and Restore Procedures" section for details on how files can be backed up and restored), to another partition such as home, and then reboot once again using the emergency boot disk, typing "mount root=/dev/hda3" (assuming the partition containing your temporary root file system is on the third partition of hda) and boot your fully functional Linux box. Then you can run an fsck on your unmounted corrupt root partition.

I have had personal experience in file system catastrophies, and I was very grateful for having had the damage limited due to the use of multiple partitions.

Finally, since Linux allows you to set up other operating system(s) (such as Windows 95/98/NT, BeOS, or what-have-you), and then dual- (or triple-, ...) boot your system, you might wish to set up additional partitions to take advantage of this. Typically, you would want to set up at least one separate partition for each operating system. Linux includes a decent boot loader (called LILO on Intel-based systems, although much the same thing is available as MILO on Alpha, and SILO on Sparc) which allows you to specify which operating system you want to boot at power on, with a time-out default boot of your favorite operating system (probably Linux, right?)

You should partition a disk (or disks) according to your needs. In my experience on Intel, Alpha, and Sparc platforms, for a fairly loaded system (feature-wise), doing a fair amount of tasks (as a desktop system at home, or as an Internet server at work), I have found the following approximation of space works pretty effectively for determining a partition size.

Given:

A given disk of X Mb/Gb          (eg. 2 Gb)
(Or, more than one disk with a combined total of X Mb/Gb)

Calculate:

(swap) about double main RAM     (eg. 64 Mb system gets 128 Mb swap)
/ (root)  about 10% of available (eg. 200 Mb)
/home about 20% of available     (eg. 400 Mb)
/usr any remaining space         (eg. 1272 Mb)

/var (optional -- see below)
/boot (optional -- see below)
/archive (optional -- see below)

Of course, the above amounts are approximate guidelines only. Obviously you are going to want to juggle those percentages around a bit depending on what you are going to use your Linux system for. If you are going to be doing stuff like adding lots of bulky applications such as WordPerfect or Netscape, or perhaps adding Japanese character support, you would probably benefit from a bit more /usr space.

I always seem to have a lot of space available on /home, so if your users aren't doing much (or you have imposed strict quota sizes), or you aren't offering shell accounts and personal web pages, etc., you probably could lower /home space and raise /usr.

Here is a description of the various mount points and file system information, which may give you a better idea of how to best define your partition sizes for your own needs:

As extra drive(s) are added, further partitions can be added to the new drives, mounted at various mount-points as required -- this means a Linux system never needs to worry about running out of space. As an example, if in the future it is clear that sda6 is starting to get filled up, we could add another drive, set a nicely sized partition with a mount-point at /usr/local -- and then transfer all the information from /usr/local over to the new drive. But no system or application component would "break" because Linux would see /usr/local no matter where it was located.

To give you an example of how one might set up partitions, I have used the following partitioning scheme on an Intel system (dual boot, Windows 95 and Linux):

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/hda1  *         1        1      254  1024096+   6  DOS 16-bit >=32M
/dev/hda2          255      255      782  2128896    5  Extended
/dev/hda5          255      255      331   310432+  83  Linux native
/dev/hda6          332      332      636  1229728+  83  Linux native
/dev/hda7          637      637      749   455584+  83  Linux native
/dev/hda8          750      750      782   133024+  82  Linux swap

The first partition, /dev/hda1, is a DOS-formatted file system used to store the alternative operating system (Windows 95). This gives me 1 Gb of space for that operating system.

The second partition, /dev/hda2, is a physical partition (called "extended") that encompasses the remaining space on the drive. It is used only to encapsulate the remaining logical partitions (there can only be 4 physical partitions on a disk; in my case I required more than 4 partitions, therefore I had to use a logical partitioning scheme for the others).

The third through fifth partitions, /dev/hda5, /dev/hda6, and /dev/hda7, are all e2fs-formatted file systems used for the / (root), /usr, and the /home partitions, respectively.

Finally, the sixth partition, /dev/hda8, is used for the swap partition.

For yet another example, this time an Alpha box with two hard drives (sole boot, Linux only), I have chosen the following partitioning scheme:

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sda1            1        1        1     2046    4  DOS 16-bit <32M
/dev/sda2            2        2      168   346859   83  Linux native
/dev/sda3          169      169      231   130851   82  Linux swap
/dev/sda4          232      232     1009  1615906    5  Extended
/dev/sda5          232      232      398   346828   83  Linux native
/dev/sda6          399      399     1009  1269016   83  Linux native
/dev/sdb1            1        1      509  2114355   83  Linux native
/dev/sdb2          510      510     1019  2118540   83  Linux native

The first partition, /dev/sda1, is a DOS-formatted file system used to store the MILO boot loader. The Alpha platform has a slightly different method of booting than an Intel system does, therefore Linux stores its boot information in a FAT partition. This partition only needs to be as large as the smallest possible partition allowed -- in this case, 2Mb.

The second partition, /dev/sda2, is an e2fs-formatted file system used for the / (root) partition.

The third partition, /dev/sda3, is used for the swap partition.

The fourth partition, /dev/sda4, is an "extended" partition (see previous example for details).

The fifth and sixth partitions, /dev/sda5, and /dev/sda6, are e2fs-formatted file systems used for the /home and /usr partitions, respectively.

The seventh partition, /dev/sdb1, is an e2fs-formatted file system used for the /archive partition.

The eighth and final partition, /dev/sdb2, is an e2fs-formatted file system used for the /archive2 partition.

After you finish setting up your partition information, you'll need to write the new partition to disk. After this, the Red Hat installation program reloads the partition table into memory, so you can continue on to the next step of the installation process.

4.4 Setting up Swap Space

Once you've set up your partition information, and have assigned "mount points" (ie. /usr is the mount point for the /usr file system), the installation program will ask you which partition(s) it should used for swap space. Since your swap partitions should already be identified as such (partition ID # 82), you can press <Enter> to begin formatting those partition(s) for swap usage. I recommend you enable the "Check for bad blocks during format" to ensure the partition is free of potentially damaging problems. It does slow down the formatting process substantially but I believe it is worth the tradeoff.

4.5 Choosing Partitions to Format

Now, the installation program will display a list of the partitions you have assigned to Linux, and ask you to select which, if any, of these partitions you want to format as new file systems. Likely, you will want to format all of them, except if you are upgrading your system or perhaps have some information (eg. on /home) that you don't want to lose.

Again, I recommend you enable the "Check for bad blocks during format" option.

4.6 Choosing Desired Packages to Install

Next, you'll be presented with a list of system components and asked to specify which ones should be installed. If you are an experienced Linux user, you can pick and choose according to your needs. If you are new to Linux, you'll likely want to select the bottom option, "Everything".

What I usually do is select the components I know I'll need, and then enable the "Select individual packages" option, which allows me to control the installation in finer detail.

Once you have chosen your desired components, select "Ok" to begin installation. If you have enabled the "Select individual packages", you'll be asked the specify which individual packages should be installed. This is fairly straightforward, and if you are unsure of what a given package is for, you can press the <F1> key for a brief description of what it does.

Don't worry if you make a mistake choosing (or not choosing) a package or two. After all, all the packages are on your CD-ROM (or other source media), so you can use the handy Red Hat RPM tool to make adjustments after your system is up and running (see the "Using the Red Hat Package Manager (RPM)" section for details).

After you have chosen the packages you wish to install, the installation program will now format the partitions you have defined. This may take several minutes, especially for larger partitions or if you've enabled bad block checking, so please don't think your system has frozen during this procedure!

After the format completes, Red Hat Linux will begin installation of the selected packages. This should take between five and fifteen minutes to complete, depending on the speed of your system.

4.7 Hardware Configuration

After package installation, Red Hat will begin configuring the devices on your system. In most cases, except with very new hardware that may not be fully supported by Linux, the installation program does a good job of automatic configuration.

The prompts you will see are very straightforward:

4.8 Booting with LILO

Next, the installation program needs to write a boot loader to your hard drive. The boot loader (LILO on Intel systems) is responsible for booting Linux along with any other operating systems if you have set up your system for multi-boot (see the section on "Multi-boot With Other Operating Systems" for details on this).

The "Lilo Installation" dialog box will ask you to choose where the boot loader image should be written to. You'll likely want to install it on the master boot record of your first drive (usually /dev/hda for IDE, /dev/sda for SCSI).

Once you have selected the location for writing the boot loader, a second dialog box will appear, allowing you to enter extra boot-time configuration parameters. Usually you don't need to enter anything here, but if you have more than 64 Mb of RAM you'll need to enter a special parameter in order to have Linux make use of the extra RAM (otherwise, it will only use the first 64 Mb). For example, if your system has 128 Mb of RAM, you should enter:

append="mem=128M"

If your system has SCSI drives, or you wish to install LILO on a partition with more than 1023 cylinders, it may be necessary to enable the option to "Use linear mode". If it is not, enabling this option shouldn't hurt anything, so it is probably a good idea to do so.

4.9 Multi-boot with Other Operating Systems

Finally, if you've set up your system to multi-boot Linux with other operating system(s), you'll be presented with a third dialog box which lists the available partitions. Here, you can assign names to your other operating systems (which you enter at the "LILO" prompt at boot time to boot your desired operating system. The installation program does assign default names to each bootable partition, so it isn't necessary to change them unless you don't like the defaults.

The default operating system that will boot upon system start up will, of course, be Linux. However, if you wish, you can change the default to any of the other operating systems you have defined.

After installing the boot loader on your hard drive, the installation program should hopefully present you with a "Congratulations" dialog box, indicating that Linux has been successfully installed. Remove the installation floppy diskette (if any), and press <Enter> to reboot your system...into Linux!

Linux will boot, and if all goes well you should see a "login" prompt. From here, you should be able to log in as "root" using whatever password you have assigned during the installation process.

4.10 Downloading and Installing Red Hat Updates

Red Hat has produced some pretty impressive versions of their distribution so far, but seems to have a history of releasing them when they are not quite "ready for prime time". Therefore in order to take full advantage of your Linux system, it is necessary to download and apply updated packages. These packages, also called "rpm files" are applied using the RPM utility (for details on this utility, see the "Using the Red Hat Package Manager (RPM)" section).

This will prove to be one of the more time-consuming parts of getting your Linux system ready (unless you have a stellarly fast Internet connection). However, take the time to do this! You will likely save yourself a lot of grief!

First, download all files from:

ftp://updates.redhat.com/pub/redhat/redhat-5.2/updates/i386

(The above assumes you are using Linux on an Intel box).

You should probably download everything into a single directory, and then you can simply type: ``rpm -Uvh *'' which will upgrade all the packages. If you've downloaded any kernel rpm files, you should probably move them to another directory for now. Upgrading or customizing your kernel is a bit more complicated and needs to be done with great care (see the "Linux Kernel Upgrades" section for details on this). Therefore before you apply the upgrades, you may wish to consider moving all the kernel-*.rpm files out of your temporary upgrade directory.

To apply the upgrades, you can simply run ``rpm'' against all the packages at once (ie. "rpm -Uvh *"), or if you prefer, you can upgrade them one at a time (ie. "rpm -Uvh file_to_upgrade.rpm"). The latter method is for us anal types who wish to ensure that each update is applied correctly without error. :-)

Perhaps you are curious to see if a given package is installed before you attempt to upgrade it. Or perhaps you wish to find out what version of a given package is installed. All this can be done with the RPM utility; see the "Using the Red Hat Package Manager (RPM)" section for details.


Next Previous Contents