The Linux Installation HOWTOEric Steven Raymond Thyrsus Enterprises
    esr@thyrsus.com
    

Copyright © 2000 by Eric S. Raymond

Revision HistoryRevision 5.72002-07-06Revised by: esrNew translations.Revision 5.62002-01-04Revised by: esrMinor corrections.Revision 5.62001-09-06Revised by: esrAdded a Translation section.Revision 5.52001-07-11Revised by: esrPnP cards are no longer a problem.Revision 5.42001-06-14Revised by: esrAdded link to Post-installation HOWTO.Revision 5.32001-03-9Revised by: esrFixes for various links.Revision 5.22001-02-22Revised by: esrLDP Styleguide markup fixes.Revision 5.12001-01-29Revised by: esrMinor corrections for the post-2.1 world.Revision 5.02000-07-21Revised by: esrFirst DocBook version.

This document describes how to obtain and install Linux software.It is the first document which a new Linux user should read to getstarted.


Table of Contents
1. Introduction
1.1. Purpose of this document
1.2. Translations
1.3. Other sources of information
1.4. New versions of this document
1.5. Feedback and Corrections
2. Recent Changes
3. The Easiest Option: Buy, Don't Build
4. Before You Begin
4.1. Hardware requirements
4.2. Space requirements and coexistence
4.3. Time requirements
4.4. Choosing a Linux distribution
5. Installation Overview
5.1. First Installation Steps: The Easy Way
5.2. First Installation Steps: The Hard Way
5.3. Continuing the Installation
5.4. Basic Parts of an Installation Kit
6. Installation In Detail
6.1. Getting prepared for installation
6.2. Creating the boot and root floppies
6.3. Repartitioning your DOS/Windows drives
6.4. Creating partitions for Linux
6.5. Booting the installation disk
6.6. Installing software packages
6.7. After package installations
7. Booting Your New System
8. After Your First Boot
8.1. Beginning System Administratration
8.2. Custom LILO Configuration
9. Administrivia
9.1. Terms of Use
9.2. Acknowledgements
1. Introduction1.1. Purpose of this document

Linux is a freely-distributable implementation of Unix forinexpensive personal machines (it was developed on 386s, and now supports486, 586, Pentium, PowerPC, Sun Sparc, ARM and DEC Alpha hardware, and eventhe IBM System 390 mainframe!). It supports a wide range of software,including X Windows, Emacs, TCP/IP networking (including SLIP), and manyapplications.

This document assumes that you have heard of and know about Linux,and now want to get it running. It focuses on the Intelbase version, which is the most popular, but much of the adviceapplies on Power PCs, Sparcs and Alphas as well.


1.2. Translations

This document has been translated to Catalan and Slovenian andCzech.


1.3. Other sources of information

If you are new to Linux, there are several sources of basicinformation about the system. The best place to find these is at the atLinux Documentation Project homepage. You can find the latest version of thisdocument there.

You should probably start by browsing the resources under GeneralLinux Information; the LinuxINFO-SHEET and the Linux META-FAQ. The `Linux Frequently AskedQuestions' document contains many common questions (and answers!) aboutLinux -- it is a ``must read'' for new users.

The Linux Documentation Project is writing a set of manuals andbooks about Linux, all of which are freely distributable on thenet and available from the LDP home page.

The book ``Linux Installation and GettingStarted'' is a complete guide to getting and installing Linux,as well as how to use the system once you've installed it. It contains acomplete tutorial to using and running the system, and much moreinformation than is contained here. You can browse it, or download a copy,from the LDP home page.

Finally, there is a rather technical Guideto x86 Bootstrapping. This document is NetBSD- rather thanLinux-oriented, but contains useful material on disk configuration and bootmanagers for multi-OS setups.

Please do not email me asking for installationhelp. Even if I had the time to handle such requests, troubleshooting bymail is much less efficient than asking help from your local Linux user'sgroup. You can find worldwide contact information for Linux user groups onthe LDP site.


1.4. New versions of this document

New versions of the Linux Installation HOWTO will be periodicallyposted to comp.os.linux.help and comp.os.linux.announce and news.answers.They will also be uploaded to various Linux WWW and FTP sites, includingthe LDP home page.

You can also view the latest version of this on the World Wide Webvia the URL http://www.linuxdoc.org/HOWTO/Installation-HOWTO.html.


1.5. Feedback and Corrections

If you have questions or comments about this document, please feelfree to mail Eric S. Raymond, at <esr@thyrsus.com>. I welcomeany suggestions or criticisms. If you find a mistake with this document,please let me know so I can correct it in the next version. Thanks.

Please do not mail me questions about how tosolve hardware problems encountered during installation. ConsultLinux Installation and Getting Started, bug yourvendor, or consult the Linux newsgroup comp.os.linux.setup. This HOWTO isintended to be rapid, painless guide to normalinstallation -- a separate HOWTO on hardware problems and diagnosis is inpreparation.


2. Recent Changes

  • Added the `Buy, Don't Build' section.

  • Added the material on booting from CD-ROM.


3. The Easiest Option: Buy, Don't Build

Linux has now matured enough that there are now system integratorswho will assemble a workstation for you, install and configure aLinux, and do an intensive burn-in to test it before it's shippedto you. If you have more money than time, or you have stringentreliability or performance requirements, these integrators providea valuable service by making sure you won't get hardware that'sflaky or dies two days out of the box.

For those of us without a champagne budget, the rest of thisHOWTO is about how to install Linux yourself.


4. Before You Begin

Before you can install Linux, you'll need to be sure your machine isLinux-capable, and choose a Linux to install. The Linux Pre-installationchecklist may help you organize configuration data before youbegin.


4.1. Hardware requirements

What kind of system is needed to run Linux? This is a good question;the actual hardware requirements for the system change periodically. TheLinux Hardware-HOWTO, givesa (more or less) complete listing of hardware supported by Linux. TheLinux INFO-SHEET, providesanother list.

For the Intel versions, a hardware configuration that looks like thefollowing is required:

Any 80386,80486,Pentium or PentiumII processor will do.Non-Intel clones of the 80386 and up will generally work. You do not need amath coprocessor, although it is nice to have one.

The ISA,EISA, VESA LocalBus andPCI bus architectures aresupported. The MCA busarchitecture (found on IBM PS/2 machines) has been minimally supportedsince the 2.1.x kernels, but may not be ready for prime time yet.

You need at least 4 megabytes of memory in your machine. Technically,Linux will run with only 2 megs, but most installations and softwarerequire 4. The more memory you have, the happier you'll be. I suggest anabsolute minimum of 16 megabytes if you're planning to use X-Windows; 64 isbetter.

Of course, you'll need a hard drive and an AT-standard drivecontroller. All MFM,RLL, andIDE drives and controllersshould work. Many SCSI drives and adaptors are supported as well; theLinux SCSI-HOWTO contains more information on SCSI. If you are assemblinga system from scratch to run Linux, the small additional cost of SCSI iswell worth it for the extra performance and reliability it brings.

You'll want a CD-ROMdrive; effectively all Linux distributions are now CD-ROM based. If yourmachine was built in 1998 or later, you should be able to actually boot your Linux's installer right off the CD-ROM without using a bootfloppy.

If your CD-ROM is ATAPI,SCSI, or trueIDE you should have no problemmaking it work (but watch for cheap drives advertising "IDE" interfacesthat aren't true IDE). If your CD-ROM uses a proprietary interface card,it's possible the installation kernel you're going to boot from floppywon't be able to see it -- and an inaccessible CD-ROM is a installationshow-stopper. Also, CD-ROMs that attach to your parallel port won't workat all. If you're in doubt, consult the Linux CD-ROM HOWTO for a list anddetails of supported hardware.

If your CD-ROM isn't in your machine's boot sequence, you will need a3.5" floppy drive. While 5.25" floppies are supported underLinux, they are little-enough used that you should not count on disk imagesnecessarily fitting on them. (A stripped-down Linux can actually run on asingle floppy, but that's only useful for installation and certaintroubleshooting tasks.)

You also need an MDA,Hercules, CGA,EGA,VGA, or SuperVGA video card andmonitor. In general, if your video card and monitor work under MS-DOS orWindows then they should work under Linux. However, if you wish to run theX window system, there are other restrictions on the supported videohardware. The LinuxXFree86-HOWTO, contains more information about running X and itsrequirements.

If you're running on a box that uses one of the Motorola 68Kprocessors (including Amiga,Atari, orVMEbus machines), see theLinux/m68k FAQfor information on minimum requirements and the state of the port. The FAQnow says m68k Linux is as stable and usable as the Intel versions.


4.2. Space requirements and coexistence

You'll need free space for Linux on your hard drive. The amount ofspace needed depends on how much software you plan to install. Today mostinstallations require somewhere in the ballpark of a gigabyte of space.This includes space for the software, swap space (used as virtualRAM on your machine), and free space for users, and so on.

It's conceivable that you could run a minimal Linux system in 80 megsor less (this used to be common when Linux distributions were smaller), andit's conceivable that you could use two gigabytes or more for all of yourLinux software. The amount varies greatly depending on the amount ofsoftware you install and how much space you require. More about thislater.

Linux will co-exist with other operating systems, such as MS-DOS,Microsoft Windows, or OS/2, on your hard drive. (In fact you can evenaccess MS-DOS files and run some MS-DOS programs from Linux.) In otherwords, when partitioning your drive for Linux, MS-DOS or OS/2 live on theirown partitions, and Linux exists on its own. We'll go into more detailabout such ``dual-boot''systems later.

You do not need to be running MS-DOS, OS/2, orany other operating system to use Linux. Linux is a completelystand-alone operating system and does not rely on other OSs forinstallation and use.

In all, the minimal setup for Linux is not much more than isrequired for most MS-DOS or Windows 3.1 systems sold today (andit's a good deal less than the minimum for Windows 95!). If youhave a 386 or 486 with at least 4 megs of RAM, then you'll be happyrunning Linux. Linux does not require huge amounts of disk space,memory, or processor speed. Matt Welsh, the originator of thisHOWTO, used to run Linux on a 386/16 MHz (the slowest machine youcan get) with 4 megs of RAM, and was quite happy. The more you wantto do, the more memory (and faster processor) you'll need. In ourexperience a 486 with 16 megabytes of RAM running Linux outdoesseveral models of expensive workstations.


4.3. Time requirements

Start to finish, a modern Linux installation from CD-ROM can be expectedto take from ninety minutes to three hours.


4.4. Choosing a Linux distribution

Before you can install Linux, you need to decide on one of the``distributions'' of Linux which are available. There is no single,standard release of the Linux software---there are many suchreleases. Each release has its own documentation and installationinstructions. All distributions pretty much share the same underlyingcodebase, however.

Linux distributions are available both via anonymous FTP and via mailorder on diskette, tape, and CD-ROM. There are many checklists andcomparativereviews of Linux distributions out there. The Linux Weekly News site, in addition tobeing an excellent general source of news and information, carries aweekly report on distributions with pointers to many of them.

In the dim and ancient past when this HOWTO was first written(1992-93), most people got Linux by tortuous means involving longdownloads off the Internet or a BBS onto their DOS machines,followed by an elaborate procedure which transferred the downloadsonto multiple floppy disks. One of these disks would then bebooted and used to install the other dozen. With luck (and nomedia failures) you'd finish your installation many hours laterwith a working Linux. Or maybe not.

While this path is still possible (and you can download any one ofseveral distributions from Metalab),there are now much less strenuous ways. The easiest is to buy one of thehigh-quality commercial Linux distributions distributed on CD-ROM, such asRed Hat, Debian, Linux Pro, or WGS. These are typically available for lessthan $50 at your local bookstore or computer shop, and will save youmany hours of aggravation.

You can also buy anthology CD-ROMs such as the InfoMagic LinuxDeveloper's Resource set. These typically include several Linuxdistributions and a recent dump of major Linux archive sites, suchas metalab or tsx-11.

In the remainder of this HOWTO we will focus on the steps needed toinstall from an anthology CD-ROM, or one of the lower-endcommercial Linuxes that doesn't include a printed installationmanual. If your Linux includes a paper manual some of this HOWTO mayprovide useful background, but you should consult the manual fordetailed installation instructions.


5. Installation Overview

It's wise to collect configuration information on your hardware before installing. Know the vendor and model number of each cardin your machine; collect the IRQs and DMA channel numbers. Youprobably won't need this information -- but if it turns out you do,you'll need it very badly.

If you want to run a "dual-boot" system (Linux and DOS or Windows orboth), rearrange (repartition) your disk to make room for Linux. If you'rewise, you'll back up everything first!.


5.1. First Installation Steps: The Easy Way

If you have an EIDE/ATAPI CDROM (normal these days), check your machine'sBIOS settings to see if it has the capability to boot from CD-ROM. Mostmachines made after mid-1997 can do this.

If yours is among them, change the settings so that the CD-ROM is checkedfirst. This is often in a 'BIOS FEATURES' submenu of the BIOSconfiguration menus.

Then insert the installation CD-ROM. Reboot. You're started.

If you have a SCSI CDROM you can often still boot from it, but it getsa little more motherboard/BIOS dependent. Those who know enough tospend the extra dollars on a SCSI CDROM drive probably know enough tofigure it out.


5.2. First Installation Steps: The Hard Way

  • Make installation floppies.

  • Boot an installation mini-Linux from the floppies in orderto get access to the CD-ROM.


5.3. Continuing the Installation

  • Prepare the Linux filesystems. (If you didn't edit thedisk partition table earlier, you will at this stage.)

  • Install a basic production Linux from theCD-ROM.

  • Boot Linux from the hard drive.

  • (Optional) Install more packages from CD-ROM.


5.4. Basic Parts of an Installation Kit

Here are the basic parts of an installable distribution:

  • The README and FAQ files. These will usually belocated in the top-level directory of your CD-ROM and be readableonce the CD-ROM has been mounted under Linux. (Depending on howthe CD-ROM was generated, they may even be visible underDOS/Windows.) It is a good idea to read these files as soon as youhave access to them, to become aware of important updates orchanges.

  • A number ofbootdisk images (often ina subdirectory). If your CD-ROM is not bootable, one of these is the filethat you will write to a floppy to create the boot disk. You'll selectone of the above bootdisk images, depending on thetype of hardware that you have in your system.

The issue here is that some hardware drivers conflict with eachother in strange ways, and instead of attempting to debug hardwareproblems on your system it's easier to use a boot floppy image withonly the drivers you need enabled. (This will have the nice sideeffect of making your kernel smaller.)

  • A rescue disk image. This is a disk containing a basickernel and tools for disaster recovery in case something trashesthe kernel or boot block of your hard disk.

  • RAWRITE.EXE. This is an MS-DOS program that will writethe contents of a file (such as a bootdisk image) directlyto a floppy, without regard to format.

You only need RAWRITE.EXE if you plan to create your boot androot floppies from an MS-DOS system. If you have access to a UNIXworkstation with a floppy drive instead, you can create thefloppies from there, using the `dd' command, or possibly avendor-provided build script. See the man page for dd(1) and askyour local UNIX gurus for assistance. There's a dd example laterin this document.

  • The CD-ROM itself. The purpose of the boot disk is to getyour machine ready to load the root or installation disks, which inturn are just devices for preparing your hard disk and copyingportions of the CD-ROM to it. If your CD-ROM is bootable, you can bootit and skip right to preparing your disk.


6. Installation In Detail6.1. Getting prepared for installation

Linux makes more effective use of PC hardware than MS-DOS, Windowsor NT, and is accordingly less tolerant of misconfigured hardware.There are a few things you can do before you start that will lessenyour chances of being stopped by this kind of problem.

First, collect any manuals you have on your hardware -- motherboard,video card, monitor, modem, etc. -- and put them within easy reach.

Second, gather detailed information on your hardware configuration.One easy way to do this, if you're running MS-DOS 5.0, or up, is toprint a report from the Microsoft diagnostic utility msd.exe (youcan leave out the TSR, driver, memory-map, environment-strings andOS-version parts). Among other things, this will guarantee youfull and correct information on your video card and mouse type,which will be helpful in configuring X later on.

Third, check your machine for configuration problems withsupported hardware that could cause an un-recoverable lockupduring Linux installation.

  • It is possible for a DOS/Windows system using IDE harddrive(s) and CD ROM to be functional even with the master/slavejumpers on the drives incorrectly set. Linux won't fly this way.If in doubt, check your master-slave jumpers!

  • Is any of your peripheral hardware designed with neitherconfiguration jumpers nor non-volatile configuration memory? Ifso, it may require boot-time initialization via an MS-DOS utilityto start up, and may not be easily accessible from Linux. CD-ROMs,sound cards, Ethernet cards and low-end tape drives can have thisproblem. If so, you may be able to work around this with anargument to the boot prompt; see theLinux Boot Prompt HOWTO fordetails).

  • Some other operating systems will allow a bus mouse to share anIRQ with other devices. Linux doesn't support this; in fact, trying it maylock up your machine. If you are using a bus mouse, see the Linux Bus Mouse HOWTO, fordetails.

If possible, get the telephone number of an experienced Linux useryou can call in case of emergency. Nine times out of ten you won'tneed it, but it's comforting to have.

Budget time for installation. That will be about one hour ona bare system or one being converted to all-Linux operation. Orup to three hours for a dual-boot system (they have a much higherincidence of false starts and hangups).


6.2. Creating the boot and root floppies

(This step is only needed if you can't boot from a CD-ROM.)

Your Linux CD-ROM may come with installation aids that will takeyou through the process of building boot, root, and rescue diskswith interactive prompts. These may be an MS-DOS installationprogram (such as the Red Hat redhat.exe program) or a Unixscript, or both.

If you have such a program and can use it, you should read the restof this subsection for information only. Run the program to doactual installation -- its authors certainly knew more about thespecific distribution than I, and you'll avoid many error-pronehand-entry steps.

More detailed information on making bootdisks, see theLinux Bootdisk HOWTO.

Your first step will be to select a boot-disk image to fit yourhardware. If you must do this by hand, you'll generally find that either(a) the bootdisk images on your CD-ROM are named in a way that will helpyou pick a correct one, or (b) there's an index file nearby describing eachimage.

Next, you must create floppies from the bootdisk image you selected,and optionally from the rescue disk images. This is where the MS-DOSprogram RAWRITE.EXE comes into play.

Next, you must have two or three high-densityMS-DOS formatted floppies. (They must be of the same type; that is, ifyour boot floppy drive is a 3.5" drive, both floppies must behigh-density 3.5" disks.) You will use RAWRITE.EXE to write thebootdisk images to the floppies.

Invoke it with no arguments, like this:

C:\> RAWRITE

Answer the prompts for the name of the file to write and the floppyto write it to (such as A:). RAWRITE will copy the file, block-by-block,directly to the floppy. Also use RAWRITE for the root disk image (such asCOLOR144). When you're done, you'll have two floppies: one containing theboot disk, the other containing the root disk. Note that these two floppieswill no longer be readable by MS-DOS (they are ``Linux format'' floppies,in some sense).

You can use the dd(1) commands on a UNIX system to do the same job.(For this, you will need a UNIX workstation with a floppy drive, ofcourse.) For example, on a Sun workstation with the floppy drive on device/dev/rfd0, you can use the command:

$ dd if=bare of=/dev/rfd0 obs=18k

You must provide the appropriate output block size argument (the `obs'argument) on some workstations (e.g., Suns) or this will fail. Ifyou have problems the man page for dd(1) may be be instructive.

Be sure that you're using brand-new, error-free floppies. Thefloppies must have no bad blocks on them.

Note that you do not need to be running Linux or MS-DOS in order toinstall Linux. However, running Linux or MS-DOS makes it easier tocreate the boot and root floppies from your CD-ROM. If you don'thave an operating system on your machine, you can use someoneelse's Linux or MS-DOS just to create the floppies, and installfrom there.


6.3. Repartitioning your DOS/Windows drives

On most used systems, the hard drive is already dedicated topartitions for MS-DOS, OS/2, and so on. You'll need to resizethese partitions in order to make space for Linux. If you're goingto run a dual-boot system, it's strongly recommended that you readone or more of the following mini-HOWTOS, which describe differentdual-boot configurations.

  • TheDOS-Win95-OS2-Linux mini-HOWTO.

  • The Linux+Win95mini-HOWTO.

  • TheLinux+NT-Loader mini-HOWTO

Even if they are not directly applicable to your system, they willhelp you understand the issues involved.

Some Linuxes will install to a directory on your MS-DOSpartition. (This is different than installing from anMS-DOS partition.) Instead, you use the ``UMSDOS filesystem'', which allowsyou to treat a directory of your MS-DOS partition as a Linux filesystem. Inthis way, you don't have to repartition your drive.

I only suggest using this method if your drive already has fourpartitions (the maximum supported by DOS) and repartitioning wouldbe more trouble than it's worth (it slows down your Linux due tofilename translation overhead). Or, if you want to try out Linuxbefore repartitioning, this is a good way to do so. But in mostcases you should re-partition, as described here. If you do plan touse UMSDOS, you are on your own -- it is not documented in detailhere. From now on, we assume that you are NOT using UMSDOS, andthat you will be repartitioning.

A partition is just a section of the hard driveset aside for a particular operating system to use. If you only have MS-DOSinstalled, your hard drive probably has just one partition, entirely forMS-DOS. To use Linux, however, you'll need to repartition the drive, sothat you have one partition for MS-DOS, and one (or more) for Linux.

Partitions come in three flavors: primary,extended, and logical. Briefly,primary partitions are one of the four main partitions on yourdrive. However, if you wish to have more than four partitions per drive,you need to replace the last primary partition with an extended partition,which can contain many logical partitions. You don't store data directlyon an extended partition---it is used only as a container for logicalpartitions. Data is stored only on either primary or logicalpartitions.

To put this another way, most people use only primary partitions.However, if you need more than four partitions on a drive, youcreate an extended partition. Logical partitions are then createdon top of the extended partition, and there you have it---more thanfour partitions per drive.

Note that you can easily install Linux on the second drive on yoursystem (known as D: to MS-DOS). You simply specify theappropriate device name when creating Linux partitions. This isdescribed in detail below.

Back to repartitioning your drive. It used to be that there was no way toresize partitions without destroying the data on them. Nowadays there arepartitioning utilities that can resize non-destructively; they know aboutthe structure of file systems, can find the free space on a file system,and can move file data around on the partition to move free space where itneeds to be in order for a resize to work properly. It's still suggestedthat you make a full backup before using one of these, in case of programor human error.

Under Linux GNUparted allows you to create, destroy, resize and copy partitions. Itsupports ext2, FAT16, and FAT32 filesystems, Linux swap devices; it alsoknows about MS-DOS disk labels. Parted is useful for creating space for newoperating systems, reorganising disk usage, copying data between harddisks, and disk imaging. It is relatively new code, but is reported towork well and not trash data.

There is a non-destructive disk repartitioner available for MS-DOS,called FIPS. WithFIPS, a disk optimizer (such as Norton Speed Disk), and a little bit ofluck, you should be able to resize MS-DOS partitions without destroying thedata on them.

The older method of resizing a partition, if you don't have one of theseresizing partition editors available, is to delete the partition(s), andre-create them with smaller sizes. If you use this method, you absolutelymust make a backup in order to save any of your data.

The classic way to modify partitions is with the programFDISK. For example, let's say that you have an 80 meghard drive, dedicated to MS-DOS. You'd like to split it in half---40 megsfor MS-DOS and 40 megs for Linux. In order to do this, you runFDISK under MS-DOS, delete the 80 meg MS-DOS partition,and re-create a 40 meg MS-DOS partition in its place. You can then formatthe new partition and reinstall your MS-DOS software from backups. 40megabytes of the drive is left empty. Later, you create Linux partitions onthe unused portion of the drive.

In short, you should do the following to resize MS-DOS partitionswith FDISK:

  • Make a full backup of your system.

  • Create an MS-DOS bootable floppy, using a command such asFORMAT /S A:Copy the files FDISK.EXE andFORMAT.COM to this floppy, as well as any otherutilities that you need. (For example, utilities to recover your systemfrom backup.)

  • Boot the MS-DOS system floppy.

  • Run FDISK, possibly specifying the drive to modify (such asC: or D:).

  • Use the FDISK menu options to delete the partitions whichyou wish to resize. This will destroy all data on the affectedpartitions.

  • Use the FDISK menu options to re-create those partitions,with smaller sizes.

  • Exit FDISK and re-format the new partitions with theFORMAT command.

  • Restore the original files from backup.

  • Note that MS-DOS FDISK will give you an option to createa ``logical DOS drive''. A logical DOS drive is just a logicalpartition on your hard drive. You can install Linux on a logicalpartition, but you don't want to create that logical partitionwith MS-DOS fdisk. So, if you're currently using a logicalDOS drive, and want to install Linux in its place, you shoulddelete the logical drive with MS-DOS FDISK, and (later)create a logical partition for Linux in its place.

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


    6.4. Creating partitions for Linux

    After repartitioning your drive, you need to create partitions forLinux. Before describing how to do that, we'll talk aboutpartitions and filesystems under Linux.


    6.4.1. Partition basics

    Linux requires at least one partition, for the rootfilesystem, which will hold the Linux kernel itself.

    You can think of a filesystem as a partitionformatted for Linux. Filesystems are used to hold files. Every system musthave a root filesystem, at least. However, many users prefer to usemultiple filesystems---one for each major part of the directory tree. Forexample, you may wish to create a separate filesystem to hold all filesunder the /usr directory. (Note that on UNIX systems,forward slashes are used to delimit directories, not backslashes as withMS-DOS.) In this case you have both a root filesystem, and a/usr filesystem.

    Each filesystem requires its own partition. Therefore, if you'reusing both root and /usr filesystems, you'll need tocreate two Linux partitions.

    In addition, most users create a swap partition,which is used for virtual RAM. If you have, say, 4 megabytes of memory onyour machine, and a 10-megabyte swap partition, as far as Linux isconcerned you have 14 megabytes of virtual memory.

    When using swap space, Linux moves unused pages of memory out todisk, allowing you to run more applications at once on your system.However, because swapping is often slow, it's no replacement forreal physical RAM. But applications that require a great deal ofmemory (such as the X window system) often rely on swap space ifyou don't have enough physical RAM.

    Nearly all Linux users employ a swap partition. If you have 4megabytes of RAM or less, a swap partition is required to installthe software. It is strongly recommended that you have a swappartition anyway, unless you have a great amount of physical RAM.

    The size of your swap partition depends on how much virtual memoryyou need. It's often suggested that you have at least 16 megabytesof virtual memory total. Therefore, if you have 8 megs of physicalRAM, you might want to create an 8-megabyte swap partition. Note thatthere are platform-dependent limits on the size of swap partitions;see the Partition-HOWTO if you want to create a swap partition largerthan 1GB.

    You can find more on the theory of swap space layout and diskpartitioning in the Linux Partition mini-HOWTO (http://www.linuxdoc.org/HOWTO/mini/Partition.html).

    Note: it is possible, though a bit tricky, to share swap partitionsbetween Linux and Windows 95 in a dual-boot system. For details, see theLinuxSwap Space Mini-HOWTO.

    Gotcha #1: If you have an EIDE drive with a partition that goesabove 504MB, your BIOS may not allow you to boot to a Linux installedthere. So keep your root partition below 504MB. This shouldn't be aproblem for SCSI drive controllers, which normally have their own driveBIOS firmware. For technical details, see the Large Disk Mini-HOWTO.

    Gotcha #2: Are you mixing IDE and SCSI drives? Then watch out.Your BIOS may not allow you to boot directly to a SCSI drive.


    6.4.2. Sizing partitions

    Besides your root and swap partitions, you'll want to set upone or more partitions to hold your software and home directories.

    While, in theory, you could run everything off a single huge rootpartition, almost nobody does this. Having multiple partitionshas several advantages:

    • It often cuts down the time required for boot-time file-systemchecks.

    • Files can't grow across partition boundaries. Thereforeyou can use partition boundaries as firebreaks against programs(like Usenet news) that want to eat huge amounts of disk, toprevent them from crowding out file space needed by your kerneland the rest of your applications.

    • If you ever develop a bad spot on your disk, formattingand restoring a single partition is less painful than having toredo everything from scratch.

    On today's large disks, a good basic setup is to have a small rootpartition (less than 80 meg), a medium-sized /usr partition (up to300 meg or so) to hold system software, and a /home partitionoccupying the rest of your available space for home directories.

    You can get more elaborate. If you know you're going to runUsenet news, for example, you may want to give it a partitionof its own to control its maximum possible disk usage. Or createa /var partition for mail, news, and temporary files all together. But in today's regime of very cheap, very large hard disks thesecomplications seem less and less necessary for your first Linuxinstallation. For your first time, especially, keep it simple.


    6.5. Booting the installation disk

    The first step is to boot the bootdisk you generated. Normallyyou'll be able to boot hands-off; the boot kernel prompt will fillitself in after 10 seconds. This is how you'll normally boot froman IDE disk.

    What's actually happening here is this: the boot disk provides aminiature operating system which (because the hard drive isn'tprepared) uses a portion of your RAM as a virtual disk (called,logically enough, a `ramdisk').

    The boot disk loads onto the ramdisk a small set of files andinstallation tools which you'll use to prepare your hard drive andinstall a production Linux on it from your CD-ROM.

    (In times past this was a two-stage-process, involving a second diskcalled a `root disk'; this changed when kernel modules were introduced.)

    By giving arguments after the kernel name, you can specify varioushardware parameters, such as your SCSI controller IRQ and address,or drive geometry, before booting the Linux kernel. This may benecessary if Linux does not detect your SCSI controller or harddrive geometry, for example.

    In particular, many BIOS-less SCSI controllers require you tospecify the port address and IRQ at boot time. Likewise, IBM PS/1,ThinkPad, and ValuePoint machines do not store drive geometry inthe CMOS, and you must specify it at boot time. (Later on,you'll be able to configure your production system to supplysuch parameters itself.)

    Watch the messages as the system boots. They will list and describethe hardware your installation Linux detects. In particular, if youhave a SCSI controller, you should see a listing of the SCSI hostsdetected. If you see the message

    SCSI: 0 hosts

    Then your SCSI controller was not detected, and you will have tofigure out how to tell the kernel where it is.

    Also, the system will display information on the drive partitionsand devices detected. If any of this information is incorrect ormissing, you will have to force hardware detection.

    On the other hand, if all goes well and your hardware seems to bedetected, you can skip to the following section, ``Loading theroot disk.''

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

    linux <parameters...>

    There are a number of such parameters available; we list some ofthe most common below. Modern Linux boot disks will often giveyou the option to look at help screen describing kernel parametersbefore you boot.

    • hd=cylinders,heads,sectors Specify the drive geometry.Required for systems such as the IBM PS/1, ValuePoint, and ThinkPad.For example, if your drive has 683 cylinders, 16 heads, and 32 sectorsper track, enterlinux hd=683,16,32

      tmc8xx=memaddr,irq Specify address andIRQ for BIOS-less Future Domain TMC-8xx SCSI controller. Forexample,

      linux tmc8xx=0xca000,5

      Note that the 0x prefix must be used for allvalues given in hex. This is true for all of the followingoptions.

    • st0x=memaddr,irq Specify address andIRQ for BIOS-less Seagate ST02 controller.

    • t128=memaddr,irq Specify address andIRQ for BIOS-less Trantor T128B controller.

    • ncr5380=port,irq,dma Specify port,IRQ, and DMA channel for generic NCR5380 controller.

    • aha152x=port,irq,scsi_id,1 Specifyport, IRQ, and SCSI ID for BIOS-less AIC-6260 controllers. This includesAdaptec 1510, 152x, and Soundblaster-SCSI controllers.

    If you have questions about these boot-time options, please read theLinux SCSI HOWTO, which should be available on anyLinux FTP archive site (or from wherever you obtained this document). TheSCSI HOWTO explains Linux SCSI compatibility in muchmore detail.


    6.5.1. Choosing Console or X installation

    After boot, all current Linuxes run a screen-oriented installationprogram which tries to interactively walk you through these steps, givinglots of help.

    You will probably get the option to try to configure X right awayso the installation program can go graphical. If you choose thisroute, the installation program will quiz you about your mouse andmonitor type before getting to the installation proper. Once youget your production Linux installed, these settings will be savedfor you. You will be able to tune your monitor's performancelater, so at this stage it makes sense to settle for a basic640x480 SVGA mode.

    X isn't necessary for installation, but (assuming you can getpast the mouse and monitor configuration) many people find thegraphical interface easier to use. And you're going to want tobring up X anyway, so trying it early makes some sense.

    Just follow the prompts in the program. It will take you throughthe steps necessary to prepare your disk, create initial useraccounts, and install software packages off the CD-ROM.

    In the following subsections we'll describe some of the trickyareas in the installation sequence as if you were doing themby hand. This should help you understand what the installationprogram is doing, and why.


    6.5.2. Using fdisk and cfdisk

    Your first installation step once the root-disk Linux is bootedwill be to create or edit the partition tables on your disks.Even if you used FDISK to set up partitions earlier, you'llneed to go back to the partition table now and insert someLinux-specific information now.

    To create or edit Linux partitions, we'll use the Linux version ofthe fdisk program, or its screen-oriented siblingcfdisk. Note that the argument to thefdisk needs to be the device corresponding to an entiredisk (e.g. /dev/sda) rather than any of its partitions(such as /dev/sda1).

    Generally the installation program will look for a preexistingpartition table and offer to run fdisk orcfdisk on it for you. Of the two,cfdisk is definitely easier to use, but current versionsof it are also less tolerant of a nonexistent or garbled partitiontable.

    Therefore you may find (especially if you're installing on virginhardware) that you need to start with fdisk to get to astate that cfdisk can deal with. Try runningcfdisk; if it complains, run fdisk.(A good way to proceed if you're building an all-Linux system andcfdisk complains is to use fdisk todelete all the existing partions and then fire up cfdiskto edit the empty table.)

    A few notes apply to both fdisk andcfdisk. Both take an argument which is the name of thedrive that you wish to create Linux partitions on. Hard drive device namesare:

    • /dev/hda First IDE drive

    • /dev/hdb Second IDE drive

    • /dev/sda First SCSI drive

    • /dev/sdb Second SCSI drive

    For example, to create Linux partitions on the first SCSI drive inyour system, you will use (or your installation program mightgenerate from a menu choice) the command:

    cfdisk /dev/sda

    If you use fdisk or cfdiskwithout an argument, it will assume /dev/hda.

    To create Linux partitions on the second drive on your system,simply specify either /dev/hdb (for IDE drives)or /dev/sdb (for SCSI drives)when running fdisk.

    Your Linux partitions don't all have to be on the same drive. Youmight want to create your root filesystem partition on/dev/hda and your swap partition on/dev/hdb, for example. In order to do so just runfdisk or cfdisk once for eachdrive.

    In Linux, partitions are given a name based on the drive which theybelong to. For example, the first partition on the drive/dev/hda is /dev/hda1, the secondis /dev/hda2, and so on. If you have any logicalpartitions, they are numbered starting with /dev/hda5,/dev/hda6 and so on up.

    You should not create or delete partitions for operatingsystems other than Linux with Linux fdisk orcfdisk. That is, don't create or delete MS-DOSpartitions with this version of fdisk; use MS-DOS'sversion of FDISK instead. If you try to create MS-DOSpartitions with Linux fdisk, chances are MS-DOS will notrecognize the partition and not boot correctly.

    Here's an example of using fdisk. Here, we have asingle MS-DOS partition using 61693 blocks on the drive, and the rest ofthe drive is free for Linux. (Under Linux, one block is 1024bytes. Therefore, 61693 blocks is about 61 megabytes.) We will create justtwo partitions in this tutorial example, swap and root. You shouldprobably extend this to four Linux partitions in line with therecommendations above: one for swap, one for the root filesystem, one forsystem software, and a home directory area.

    First, we use the ``p'' command to display thecurrent partition table. As you can see, /dev/hda1(the first partition on /dev/hda) is a DOS partitionof 61693 blocks.

    Command (m for help): pDisk /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 >=32MCommand (m for help):

    Next, we use the ``n'' command to create a newpartition. The Linux root partition will be 80 megs in size.

    Command (m for help): n Command action e extended p primary partition (1-4)p

    Here we're being asked if we want to create an extended orprimary partition. In most cases you want to use primarypartitions, unless you need more than four partitions on adrive. See the section ``Repartitioning'', above, for moreinformation.

    Partition number (1-4): 2First cylinder (204-683): 204Last cylinder or +size or +sizeM or +sizeK (204-683): +80M

    The first cylinder should be the cylinder AFTER where the lastpartition left off. In this case, /dev/hda1 ended oncylinder 203, so we start the new partition at cylinder 204.

    As you can see, if we use the notation ``+80M'', it specifies apartition of 80 megs in size. Likewise, the notation ``+80K'' would specify an 80 kilobyte partition, and ``+80'' would specify just an 80 byte partition.

    Warning: Linux cannot currently use 33090 sectors of this partition

    If you see this warning, you can ignore it. It is left over from anold restriction that Linux filesystems could only be 64 megs insize. However, with newer filesystem types, that is no longer thecase... partitions can now be up to 4 terabytes in size.

    Next, we create our 10 megabyte swap partition,/dev/hda3.

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

    Again, we display the contents of the partition table. Besure to write down the information here, especially the size of each partition in blocks. You need this information later.

    Command (m for help): pDisk /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

    Note that the Linux swap partition (here,/dev/hda3) has type ``Linux native''. We need tochange the type of the swap partition to ``Linux swap'' so that theinstallation program will recognize it as such. In order to do this, usethe fdisk ``t'' command:

    Command (m for help): tPartition number (1-4): 3Hex code (type L to list codes): 82

    If you use ``L'' to list the type codes, you'llfind that 82 is the type corresponding to Linux swap.

    To quit fdisk and save the changes to thepartition table, use the ``w'' command. To quitfdisk WITHOUT saving changes, use the``q'' command.

    After quitting fdisk, the system may tell you toreboot to make sure that the changes took effect. In general there is noreason to reboot after using fdisk---modern versions offdisk and cfdisk are smart enough toupdate the partitions without rebooting.


    6.5.3. Post-partition steps

    After you've edited the partition tables, your installation programshould look at them and offer to enable your swap partition foryou. Tell it yes.

    (This is made a question, rather than done automatically, on the offchance that you're running a dual-boot system and one of yournon-Linux partitions might happen to look like a swap volume.)

    Next the program will ask you to associate Linux filesystem names(such as /, /usr, /var, /tmp, /home, /home2, etc.) with each of thenon-swap partitions you're going to use.

    There is only one hard and fast rule for this. There must be aroot filesystem, named /, and it must be bootable. You can nameyour other Linux partitions anything you like. But there are someconventions about how to name them which will probably simplifyyour life later on.

    Earlier on I recommended a basic three-partition setup including asmall root, a medium-sized system-software partition, and a largehome-directory partition. Traditionally, these would be called /,/usr, and /home. The counterintuitive `/usr' name is a historicalcarryover from the days when (much smaller) Unix systems carriedsystem software and user home directories on a single non-rootpartition. Some software depends on it.

    If you have more than one home-directory area, it's conventionalto name them /home, /home2, /home3, etc. This may come up if youhave two physical disks. On my personal system, for example, thelayout currently looks like this:

    Filesystem 1024-blocks Used Available Capacity Mounted on/dev/sda1 30719 22337 6796 77% //dev/sda3 595663 327608 237284 58% /usr/dev/sda4 1371370 1174 1299336 0% /home/dev/sdb1 1000949 643108 306130 68% /home2

    The second disk (sdb1) isn't really all /home2; the swappartitions on sda and sdb aren't shown in this display.But you can see that /home is the large free area on sdaand /home2 is the user area of sdb.

    If you want to create an partition for scratch, spool, temporary,mail, and news files, call it /var. Otherwise you'll probablywant to create a /usr/var and create a symbolic link named/var that points back to it (the installation program mayoffer to do this for you).


    6.6. Installing software packages

    Once you've gotten past preparing your partitions, the remainder ofthe installation should be almost automatic. Your installationprogram (whether EGA or X-based) will guide you through a series ofmenus which allow you to specify the CD-ROM to install from, thepartitions to use, and so forth.

    Here we're not going to document many of the specifics of thisstage of installation. It's one of the parts that varies mostbetween Linux distributions (vendors traditionally compete to addvalue here), but also the simplest part. And the installationprograms are pretty much self-explanatory, with good on-screenhelp.


    6.7. After package installations

    After installation is complete, and if all goes well, theinstallation program will walk you through a few options for configuring your system before its first boot from hard drive.


    6.7.1. LILO, the LInux LOader

    LILO (which stands for LInux LOader) is a program that will allowyou to boot Linux (as well as other operating systems, such asMS-DOS) from your hard drive.

    You may be given the option of installing LILO on your hard drive.Unless you're running OS/2, answer `yes'. OS/2 has specialrequirements; see Custom LILOConfiguration below.

    Installing LILO as your primary loader makes a separate bootdiskette unnecessary; instead, you can tell LILO at each boot timewhich OS to boot.


    6.7.2. Making a production boot disk (optional)

    You may also be given the chance to create a ``standard bootdisk'', which you can use to boot your newly-installed Linuxsystem. (This is an older and slightly less convenient methodwhich assumes that you will normally boot DOS, but use the bootdisk to start Linux.)

    For this you will need a blank, high-density MS-DOS formatteddiskette of the type that you boot with on your system. Simplyinsert the disk when prompted and a boot diskette will be created.(This is not the same as an installation bootdisk, and you can'tsubstitute one for the other!)


    6.7.3. Miscellaneous system configuration

    The post-installation procedure may also take you through severalmenu items allowing you to configure your system. This includesspecifying your modem and mouse device, as well as your timezone. Follow the menu options.

    It may also prompt you to create user accounts or put a passwordon the root (administration) account. This is not complicatedand you can usually just walk through the screen instructions.


    7. Booting Your New System

    If everything went as planned, you should now be able to boot Linuxfrom the hard drive using LILO. Alternatively, you should be able to bootyour Linux boot floppy (not the original bootdisk floppy, but the floppycreated after installing the software). After booting, login asroot. Congratulations! You have your very own Linuxsystem.

    If you are booting using LILO, try holding downshift or control duringboot. This will present you with a boot prompt; presstab to see a list of options. In this way you can bootLinux, MS-DOS, or whatever directly from LILO.


    8. After Your First Boot

    You should now be looking at the login prompt of a new Linux,just booted from your hard drive. Congratulations!

    The GNU/Linux post-install procedures has some good suggestions about things you can do just after installation to minimize problems later on.


    8.1. Beginning System Administratration

    Depending on how the installation phase went, you may need tocreate accounts, change your hostname, or (re)configure X at thisstage. There are many more things you could set up and configure,including backup devices, SLIP/PPP links to an Internet ServiceProvider, etc.

    A good book on UNIX systems administration should help. (I suggestEssential Systems Administration from O'Reilly andAssociates.) You will pick these things up as time goes by. You shouldread various other Linux HOWTOs, such as theNET-3-HOWTO andPrinting-HOWTO, for information on otherconfiguration tasks.


    8.2. Custom LILO Configuration

    LILO is a boot loader, which can be used to select either Linux,MS-DOS, or some other operating system at boot time. Chances areyour distribution automatically configured LILO for you during theinstallation phase (unless you're using OS/2, this is what youshould have done). If so, you can skip the rest of this section.

    If you installed LILO as the primary bootloader, it will handle the first-stage booting process for all operatingsystems on your drive. This works well if MS-DOS is the only otheroperating system that you have installed. However, you might be runningOS/2, which has its own Boot Manager. In this case, you want OS/2's BootManager to be the primary boot loader, and use LILO just to boot Linux (asthe secondary boot loader).

    An important gotcha for people using EIDE systems: due to a BIOSlimitation, your boot sectors for any OS have to live on one of thefirst two physical disks. Otherwise LILO will hang after writing"LI", no matter where you run it from.

    If you have to configure LILO manually, this will involve editing thefile /etc/lilo.conf. Below we present an example of aLILO configuration file, where the Linux root partition is on/dev/hda2, and MS-DOS is installed on/dev/hdb1 (on the second hard drive).

    # Tell LILO to install itself as the primary boot loader on /dev/hda.boot = /dev/hda# The boot image to install; you probably shouldn't change thisinstall = /boot/boot.b# The stanza for booting Linux. image = /vmlinuz # The kernel is in /vmlinuz label = linux # Give it the name "linux" root = /dev/hda2 # Use /dev/hda2 as the root filesystem vga = ask # Prompt for VGA mode append = "aha152x=0x340,11,7,1" # Add this to the boot options, # for detecting the SCSI controller# The stanza for booting MS-DOSother = /dev/hdb1 # This is the MS-DOS partition label = msdos # Give it the name "msdos" table = /dev/hdb # The partition table for the second drive

    Once you have edited the /etc/lilo.conf file,run /sbin/lilo as root. This willinstall LILO on your drive. Note that you must rerun/sbin/lilo anytime that you recompile your kernel inorder to point the boot loader at it properly (something that you don'tneed to worry about just now, but keep it in mind).

    Note how we use the append option in/etc/lilo.conf to specify boot parameters as we did whenbooting the bootdisk.

    You can now reboot your system from the hard drive. By default LILOwill boot the operating system listed first in the configuration file,which in this case is Linux. In order to bring up a boot menu, in order toselect another operating system, hold down shift orctrl while the system boots; you should see a promptsuch as

    Boot:

    Here, enter either the name of the operating system to boot (given bythe label line in the configuration file; in thiscase, either linux or msdos), orpress tab to get a list.

    Now let's say that you want to use LILO as the secondary bootloader; if you want to boot Linux from OS/2's Boot Manager, forexample. In order to boot a Linux partition from OS/2 BootManager, unfortunately, you must create the partition using OS/2'sFDISK (not Linux's), and format the partition as FAT orHPFS, so that OS/2 knows about it. (That's IBM for you.)

    In order to have LILO boot Linux from OS/2 Boot Manager, you onlywant to install LILO on your Linux root filesystem (in the aboveexample, /dev/hda2). In this case, your LILO config fileshould look something like:

    boot = /dev/hda2install = /boot/boot.bcompactimage = /vmlinuz label = linux root = /dev/hda2 vga = ask

    Note the change in the boot line. After running/sbin/lilo you should be able to add the Linux partitionto Boot Manager. This mechanism should work for boot loaders usedby other operating systems as well.


    9. Administrivia9.1. Terms of Use

    This document is copyright 1998 by Eric S. Raymond. You may use,disseminate, and reproduce it freely, provided you:

    • Do not omit or alter this copyright notice (you may translate it)

    • Do not omit or alter or omit the version number and date.

    • Do not omit or alter the document's pointer to the current WWW version.

    • Clearly mark any condensed, or altered versions as such.

    These restrictions are intended to protect potential readers fromstale or mangled versions. If you think you have a good case foran exception, ask me.


    9.2. Acknowledgements

    My grateful acknowledgement to Matt D. Welsh, who originatedthis HOWTO. I removed much of the Slackware-specific contentand refocused the remainder of the document on CD-ROMinstallation, but a substantial part of the content is still his.

    The 4.1 version was substantially improved by some suggestions fromDavid Shao <dshao@best.com>.