Section 2.7. Install Linux


[Page 35 (continued)]

2.7. Install Linux

As I mentioned at the beginning of this chapter, since you are free to install any distribution of Linux you wish, it isn't possible to provide an exact list of steps you'll need to install your specific distribution of Linux. Although they may do it differently, every distribution's installation program performs more or less the same set of tasks to get Linux and the GNU utilities installed on your computer.

2.7.1. Get the Documentation for Your Distribution

The first thing you should do is get installation instructions for your Linux distribution. Most CD-ROMs have either text files or HTML files (suitable for viewing with a web browser). The names and locations of these files may vary, but look for files or directories containing the following text:

  • doc or docu directory containing documentation files

  • README generally a file that you should read first

  • HOWTO often contains installation steps

  • release_notes Distribution release notes sometimes contain the installation instructions

  • HTML or htm web page files are generally documentation of some kind

  • FAQ frequently asked questions

  • install notes about installation or a directory containing notes

For example, Debian documentation can be found on the CD-ROM in the install/doc directory, Slackware provides a nice install manual on the first source CD-ROM as well as a text Slackware-HOWTO file on the boot CD, and Mandrake provides an installation manual called install.htm on the CD-ROM. You may also find installation notes on the web sites of the various distribution sponsors.

2.7.2. Boot

The easiest way to get started is to boot Linux from the CD-ROM. Unless your PC is very old, this should be supported. If it is not, you may be able to change the boot settings to look at the CD-ROM drive in your system's BIOS setup program. Linux recognizes most modern CD-ROM drives. If you cannot boot the CD-ROM, you will need to boot with a boot floppy.

2.7.3. Partition Disks

As we saw previously, this is the dangerous step where you can damage any data that is already on your computer. In case you've missed it thus far, I cannot stress strongly enough how important it is that you make a backup copy of all data on the system that you care about before you attempt to repartition a disk. This is your final warning.


[Page 36]

When running a partitioning tool, whether a graphical tool, fdisk or cfdisk, you will refer to disk partitions by their device names. These are names of special files in the /dev directory that identify each physical device. These special files are discussed in more detail in Chapter 13, "Linux Internals" For now, the types of names you're likely to encounter are:

  • /dev/fd0 first floppy disk drive

  • /dev/fd1 second floppy disk drive

  • /dev/hda first IDE hard drive

  • /dev/hdb second IDE hard drive

  • /dev/sda first SCSI hard drive

  • /dev/sdb second SCSI hard drive

Note that while nearly all systems have a /dev/fd0 (floppy drive), you may see some or none of the other names, depending on the disk drives on your system. Also note that links from /dev/fd0 to the actual floppy device are set up at install time. If you install on a laptop when a removable floppy drive is not present, these links will likely not be set up properly. If you later install your floppy drive and Linux isn't able to access it as /dev/fd0, try other device names in the IDE sequence (e.g., /dev/hdc worked for me). If your CD-ROM drive is an IDE device, it should also be accessible as one of the "hd" devices. One of the hardware browser/management tools can help you identify disk drive devices (e.g., Fedora's Hardware Browser hwbrowser or Mandrake's Harddrake tool).

Each of the hard drives that are divided into multiple partitions will also have device names for each partition. For example, the first partition on /dev/hda is called /dev/hda1, the second partition is called /dev/hda2, and so on.

As you create partitions and assign them to parts of your Linux file system, be sure to keep notes about which partition/device contains which file system. If you create more than a couple of partitions it can quickly get confusing, and if you haven't written it down you won't remember it later!

Also remember that some disk partitioning tools don't show you the difference between primary and extended partitions, you just go from /dev/hda2 to /dev/hda5 (this is because /dev/hda4 was created as an extended partition). Mandrake's Disk Drake tool creates extended partitions as necessary without asking you. Fedora's Disk Druid allows you to "force" a partition to be primary, but will choose for you if you don't specify it.

All distributions of Linux include fdisk and cfdisk, tools to create disk partitions. Most distribution providers have created their own disk partitioning tools and no longer use fdisk and cfdisk. Some of the more "bare bones" distributions (e.g., Debian and Slackware) still rely on cfdisk (although a new Debian installation tool is in the works). fdisk is a purely command-line oriented tool while cfdisk is a full-screen tool with good help information available within the program.

Whatever partitioning tool you use, the general process is to define the partitions and assign a mount point (or set it as a swap partition) and then write the partition table out to disk. Until you write the partition table to the disk, you have not changed data on the disk. Once you update the partition table, data in partitions that are no longer defined is lost (the data is still on the disk, but now there is no way to access it) because the new partition table is in effect.


[Page 37]

Part of the partitioning process is also to reformat the partitions. This is not necessary if a partition was not changed and it had been formatted previously. However, it is usually a good idea to let the system reformat everything to be sure about what you're getting. Unless you know your disk is in good shape, I would also recommend letting it do the bad-block check during the format (it takes longer, but it could save you headaches later if the disk has any bad-blocks).

2.7.4. Resize a Windows Partition

If you plan to dual-boot your Linux system with Windows, you may need to shrink the size of the Windows partition in order to have enough free space in which to install Linux. The first thing you want to do is boot Windows and run SCANDISK or CHKDSK to make sure the Windows file system has no errors. Then you should run DEFRAG to defragment the disk and move all of your data to the front part of the disk. The details of this vary a bit between different versions of Windows. Consult the DEFRAG report to determine which are the last disk blocks used by Windows. This will be the limit to how much you can shrink your Windows partition, and you should leave at least an extra 2025% free space so you'll have some room for new files when you run Windows.

Once you have determined the correct new size for your Windows partition, you must shrink the Windows partition so that you can create the Linux partition(s) in the freed space. An old program called FIPS could resize (and shrink) a FAT or FAT32 file system, commonly used in Windows 95/98 and Windows ME. If your Windows system uses the FAT file system format, you might find a copy of FIPS in your Linux distribution (e.g., Mandrake and TurboLinux provide it in the "dostools" directory, Debian puts it in the "tools" directory).

Windows XP provides no tools to shrink its NTFS file system (it has some disk management tools but they can only expand a file system). One alternative is to purchase one of a number of commercial partitioning tools. One such tool with a fine reputation for ease of use and reliability is Symantec's PartitionMagic.

Some Linux distributions (e.g., Mandrake, SuSE) have very good disk partitioning utilities that can also shrink NTFS partitions. However you choose to shrink an existing Windows partition, BE VERY CAREFUL and only proceed through steps you completely understand. If you are not sure, ask someone who has done it before. There is no "undo" if you overwrite a disk partition that contained data you wanted!

2.7.5. System Setup

After the disk partitions have been created, the installation will begin. This is all part of the same process in most distributions. In a more simple process like Debian, after you run cfdisk, the next utility to run is setup.

In the system setup part of installation, you will set things like:

  • language

  • keyboard, mouse, and monitor

  • time and time zone


  • [Page 38]
  • security settings

  • printer

  • network

  • optional software components/packages

  • root password

  • set up a new account for one or more users

Linux uses Coordinated Universal Time (UTC), which is (for our purposes) equivalent to Greenwich Mean Time (GMT), to represent the time to the machine. When time is displayed by an application, it uses calls that look up time-zone information and display the time appropriately. In this way, users on a machine working from different time zones can still have their local time displayed properly, but the internal representation of time is still in UTC/GMT.

This can be a problem if you dual-boot with Windows, because Windows stores the local time internally. When you set the time on Linux, however, it asks if the time is local or UTC, so you can select local.

Some distributions allow you to specify a security setting that will install or configure security functions, like firewalls, automatically.

2.7.6. The Boot Loader

During the installation process, you will have the option to install (or not install) a boot loader. LILO is the standard boot loader for Linux, but some distributions include GRUB and install it by default (e.g., Fedora and SuSE).

The LILO boot loader consists of a lilo command utility that writes the boot code into the boot device listed in /etc/lilo.conf. This file also contains all the information about the various operating systems and boot parameters. After editing the configuration file, run lilo to install a new boot loader.

GRUB provides more capability, but with that comes more options and a more sophisticated interface. GRUB includes a command shell called grub that can modify boot information and write the new boat loader out to disk.

A Windows PC contains boot code in the MBR that will boot Windows. During Linux installation, you can overwrite this code with LILO or GRUB code to boot Linux. Boot loaders usually preserve the Windows boot information and create a boot loader that will list Windows as one of the boot options. But it is safer to only write boot loader code into the MBR if you do not plan to boot Windows anymore (i.e., if you're installing Linux in place of Windows), because once you overwrite the MBR, the original Windows boot code will be gone. You can rewrite the MBR from the Windows Recovery Console in Windows XP (or with FDISK in earlier versions), but if you have trouble booting Windows again, this won't help you. Even though boot loaders can install themselves in such a way that they can still let you boot Windows, I would recommend that you write your boot loader to a floppy disk instead and leave your Windows boot code alone. If you do choose to rewrite your MBR, be sure Windows shows up in the list of boot options before you allow the installation procedure to write it to the disk.




Linux for Programmers and Users
Linux for Programmers and Users
ISBN: 0131857487
EAN: 2147483647
Year: 2007
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net