esr@thyrsus.com
Copyright © 2000 by Eric S. Raymond
Revision History | ||
---|---|---|
Revision 5.7 | 2002-07-06 | Revised by: esr |
New translations. | ||
Revision 5.6 | 2002-01-04 | Revised by: esr |
Minor corrections. | ||
Revision 5.6 | 2001-09-06 | Revised by: esr |
Added a Translation section. | ||
Revision 5.5 | 2001-07-11 | Revised by: esr |
PnP cards are no longer a problem. | ||
Revision 5.4 | 2001-06-14 | Revised by: esr |
Added link to Post-installation HOWTO. | ||
Revision 5.3 | 2001-03-9 | Revised by: esr |
Fixes for various links. | ||
Revision 5.2 | 2001-02-22 | Revised by: esr |
LDP Styleguide markup fixes. | ||
Revision 5.1 | 2001-01-29 | Revised by: esr |
Minor corrections for the post-2.1 world. | ||
Revision 5.0 | 2000-07-21 | Revised by: esr |
First DocBook version. |
If you are new to Linux, there are several sources of basic information about the system. The best place to find these is at the at Linux Documentation Project home page. You can find the latest version of this document there.
You should probably start by browsing the resources under General Linux Information; the Linux INFO-SHEET and the Linux META-FAQ. The `Linux Frequently Asked Questions' document contains many common questions (and answers!) about Linux -- it is a ``must read'' for new users.
The Linux Documentation Project is writing a set of manuals and books about Linux, all of which are freely distributable on the net and available from the LDP home page.
The book ``Linux Installation and Getting Started'' is a complete guide to getting and installing Linux, as well as how to use the system once you've installed it. It contains a complete tutorial to using and running the system, and much more information than is contained here. You can browse it, or download a copy, from the LDP home page.
Finally, there is a rather technical Guide to x86 Bootstrapping. This document is NetBSD- rather than Linux-oriented, but contains useful material on disk configuration and boot managers for multi-OS setups.
Please do not email me asking for installation help. Even if I had the time to handle such requests, troubleshooting by mail is much less efficient than asking help from your local Linux user's group. You can find worldwide contact information for Linux user groups on the LDP site.
You can also view the latest version of this on the World Wide Web via the URL http://www.linuxdoc.org/HOWTO/Installation-HOWTO.html.
If you have questions or comments about this document, please feel free to mail Eric S. Raymond, at <esr@thyrsus.com>. I welcome any 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 to solve hardware problems encountered during installation. Consult Linux Installation and Getting Started, bug your vendor, or consult the Linux newsgroup comp.os.linux.setup. This HOWTO is intended to be rapid, painless guide to normal installation -- a separate HOWTO on hardware problems and diagnosis is in preparation.
Before you can install Linux, you'll need to be sure your machine is Linux-capable, and choose a Linux to install. The Linux Pre-installation checklist may help you organize configuration data before you begin.
What kind of system is needed to run Linux? This is a good question; the actual hardware requirements for the system change periodically. The Linux Hardware-HOWTO, gives a (more or less) complete listing of hardware supported by Linux. The Linux INFO-SHEET, provides another list.
For the Intel versions, a hardware configuration that looks like the following is required:
Any 80386, 80486, Pentium or Pentium II processor will do. Non-Intel clones of the 80386 and up will generally work. You do not need a math coprocessor, although it is nice to have one.
The ISA, EISA, VESA Local Bus and PCI bus architectures are supported. The MCA bus architecture (found on IBM PS/2 machines) has been minimally supported since 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 software require 4. The more memory you have, the happier you'll be. I suggest an absolute minimum of 16 megabytes if you're planning to use X-Windows; 64 is better.
Of course, you'll need a hard drive and an AT-standard drive controller. All MFM, RLL, and IDE drives and controllers should work. Many SCSI drives and adaptors are supported as well; the Linux SCSI-HOWTO contains more information on SCSI. If you are assembling a system from scratch to run Linux, the small additional cost of SCSI is well worth it for the extra performance and reliability it brings.
You'll want a CD-ROM drive; effectively all Linux distributions are now CD-ROM based. If your machine 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 boot floppy.
If your CD-ROM is ATAPI, SCSI, or true IDE you should have no problem making it work (but watch for cheap drives advertising "IDE" interfaces that 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 floppy won't be able to see it -- and an inaccessible CD-ROM is a installation show-stopper. Also, CD-ROMs that attach to your parallel port won't work at all. If you're in doubt, consult the Linux CD-ROM HOWTO for a list and details of supported hardware.
If your CD-ROM isn't in your machine's boot sequence, you will need a 3.5" floppy drive. While 5.25" floppies are supported under Linux, they are little-enough used that you should not count on disk images necessarily fitting on them. (A stripped-down Linux can actually run on a single floppy, but that's only useful for installation and certain troubleshooting tasks.)
You also need an MDA, Hercules, CGA, EGA, VGA, or Super VGA video card and monitor. In general, if your video card and monitor work under MS-DOS or Windows then they should work under Linux. However, if you wish to run the X window system, there are other restrictions on the supported video hardware. The Linux XFree86-HOWTO, contains more information about running X and its requirements.
If you're running on a box that uses one of the Motorola 68K processors (including Amiga, Atari, or VMEbus machines), see the Linux/m68k FAQ for information on minimum requirements and the state of the port. The FAQ now says m68k Linux is as stable and usable as the Intel versions.
Linux distributions are available both via anonymous FTP and via mail order on diskette, tape, and CD-ROM. There are many checklists and comparative reviews of Linux distributions out there. The Linux Weekly News site, in addition to being an excellent general source of news and information, carries a weekly 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 long downloads off the Internet or a BBS onto their DOS machines, followed by an elaborate procedure which transferred the downloads onto multiple floppy disks. One of these disks would then be booted and used to install the other dozen. With luck (and no media failures) you'd finish your installation many hours later with a working Linux. Or maybe not.
While this path is still possible (and you can download any one of several distributions from Metalab), there are now much less strenuous ways. The easiest is to buy one of the high-quality commercial Linux distributions distributed on CD-ROM, such as Red Hat, Debian, Linux Pro, or WGS. These are typically available for less than $50 at your local bookstore or computer shop, and will save you many hours of aggravation.
You can also buy anthology CD-ROMs such as the InfoMagic Linux Developer's Resource set. These typically include several Linux distributions and a recent dump of major Linux archive sites, such as metalab or tsx-11.
In the remainder of this HOWTO we will focus on the steps needed to install from an anthology CD-ROM, or one of the lower-end commercial Linuxes that doesn't include a printed installation manual. If your Linux includes a paper manual some of this HOWTO may provide useful background, but you should consult the manual for detailed installation instructions.
Then insert the installation CD-ROM. Reboot. You're started.
Is any of your peripheral hardware designed with neither configuration jumpers nor non-volatile configuration memory? If so, it may require boot-time initialization via an MS-DOS utility to start up, and may not be easily accessible from Linux. CD-ROMs, sound cards, Ethernet cards and low-end tape drives can have this problem. If so, you may be able to work around this with an argument to the boot prompt; see theLinux Boot Prompt HOWTO for details).
Some other operating systems will allow a bus mouse to share an IRQ with other devices. Linux doesn't support this; in fact, trying it may lock up your machine. If you are using a bus mouse, see the Linux Bus Mouse HOWTO, for details.
If possible, get the telephone number of an experienced Linux user you can call in case of emergency. Nine times out of ten you won't need it, but it's comforting to have.
Budget time for installation. That will be about one hour on a bare system or one being converted to all-Linux operation. Or up to three hours for a dual-boot system (they have a much higher incidence of false starts and hangups).
(This step is only needed if you can't boot from a CD-ROM.)
More detailed information on making bootdisks, see the Linux Bootdisk HOWTO.
Your first step will be to select a boot-disk image to fit your hardware. 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 help you pick a correct one, or (b) there's an index file nearby describing each image.
Next, you must create floppies from the bootdisk image you selected, and optionally from the rescue disk images. This is where the MS-DOS program RAWRITE.EXE comes into play.
Next, you must have two or three high-density MS-DOS formatted floppies. (They must be of the same type; that is, if your boot floppy drive is a 3.5" drive, both floppies must be high-density 3.5" disks.) You will use RAWRITE.EXE to write the bootdisk 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 floppy to 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 as COLOR144). When you're done, you'll have two floppies: one containing the boot disk, the other containing the root disk. Note that these two floppies will 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, of course.) 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. If you have problems the man page for dd(1) may be be instructive.
Be sure that you're using brand-new, error-free floppies. The floppies must have no bad blocks on them.
Note that you do not need to be running Linux or MS-DOS in order to install Linux. However, running Linux or MS-DOS makes it easier to create the boot and root floppies from your CD-ROM. If you don't have an operating system on your machine, you can use someone else's Linux or MS-DOS just to create the floppies, and install from there.
Even if they are not directly applicable to your system, they will help you understand the issues involved.
![]() | Some Linuxes will install to a directory on your MS-DOS partition. (This is different than installing from an MS-DOS partition.) Instead, you use the ``UMSDOS filesystem'', which allows you to treat a directory of your MS-DOS partition as a Linux filesystem. In this way, you don't have to repartition your drive. |
I only suggest using this method if your drive already has four partitions (the maximum supported by DOS) and repartitioning would be more trouble than it's worth (it slows down your Linux due to filename translation overhead). Or, if you want to try out Linux before repartitioning, this is a good way to do so. But in most cases you should re-partition, as described here. If you do plan to use UMSDOS, you are on your own -- it is not documented in detail here. From now on, we assume that you are NOT using UMSDOS, and that you will be repartitioning.
A partition is just a section of the hard drive set aside for a particular operating system to use. If you only have MS-DOS installed, your hard drive probably has just one partition, entirely for MS-DOS. To use Linux, however, you'll need to repartition the drive, so that 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 your drive. 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 directly on an extended partition---it is used only as a container for logical partitions. Data is stored only on either primary or logical partitions.
To put this another way, most people use only primary partitions. However, if you need more than four partitions on a drive, you create an extended partition. Logical partitions are then created on top of the extended partition, and there you have it---more than four partitions per drive.
Note that you can easily install Linux on the second drive on your system (known as D: to MS-DOS). You simply specify the appropriate device name when creating Linux partitions. This is described in detail below.
Back to repartitioning your drive. It used to be that there was no way to resize partitions without destroying the data on them. Nowadays there are partitioning utilities that can resize non-destructively; they know about the 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 it needs to be in order for a resize to work properly. It's still suggested that you make a full backup before using one of these, in case of program or human error.
Under Linux GNU parted allows you to create, destroy, resize and copy partitions. It supports ext2, FAT16, and FAT32 filesystems, Linux swap devices; it also knows about MS-DOS disk labels. Parted is useful for creating space for new operating systems, reorganising disk usage, copying data between hard disks, and disk imaging. It is relatively new code, but is reported to work well and not trash data.
There is a non-destructive disk repartitioner available for MS-DOS, called FIPS. With FIPS, a disk optimizer (such as Norton Speed Disk), and a little bit of luck, you should be able to resize MS-DOS partitions without destroying the data on them.
The older method of resizing a partition, if you don't have one of these resizing partition editors available, is to delete the partition(s), and re-create them with smaller sizes. If you use this method, you absolutely must make a backup in order to save any of your data.
The classic way to modify partitions is with the program FDISK. For example, let's say that you have an 80 meg hard drive, dedicated to MS-DOS. You'd like to split it in half---40 megs for MS-DOS and 40 megs for Linux. In order to do this, you run FDISK 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 format the new partition and reinstall your MS-DOS software from backups. 40 megabytes of the drive is left empty. Later, you create Linux partitions on the unused portion of the drive.
In short, you should do the following to resize MS-DOS partitions with FDISK:
Make a full backup of your system.
Create an MS-DOS bootable floppy, using a command such as
FORMAT /S A: |
Boot the MS-DOS system floppy.
Run FDISK, possibly specifying the drive to modify (such as C: or D:).
Use the FDISK menu options to delete the partitions which you wish to resize. This will destroy all data on the affected partitions.
Use the FDISK menu options to re-create those partitions, with smaller sizes.
Exit FDISK and re-format the new partitions with the FORMAT command.
Restore the original files from backup.
Note that MS-DOS FDISK will give you an option to create a ``logical DOS drive''. A logical DOS drive is just a logical partition on your hard drive. You can install Linux on a logical partition, but you don't want to create that logical partition with MS-DOS fdisk. So, if you're currently using a logical DOS drive, and want to install Linux in its place, you should delete 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 operating systems for details.
You can find more on the theory of swap space layout and disk partitioning 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 partitions between Linux and Windows 95 in a dual-boot system. For details, see the Linux Swap Space Mini-HOWTO.
Gotcha #1: If you have an EIDE drive with a partition that goes above 504MB, your BIOS may not allow you to boot to a Linux installed there. So keep your root partition below 504MB. This shouldn't be a problem for SCSI drive controllers, which normally have their own drive BIOS 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.
SCSI: 0 hosts |
linux <parameters...> |
linux hd=683,16,32 |
linux tmc8xx=0xca000,5 |
st0x=memaddr,irq Specify address and IRQ for BIOS-less Seagate ST02 controller.
t128=memaddr,irq Specify address and IRQ for BIOS-less Trantor T128B controller.
ncr5380=port,irq,dma Specify port, IRQ, and DMA channel for generic NCR5380 controller.
cfdisk /dev/sda |
If you use fdisk or cfdisk without an argument, it will assume /dev/hda.
![]() | You should not create or delete partitions for operating systems other than Linux with Linux fdisk or cfdisk. That is, don't create or delete MS-DOS partitions with this version of fdisk; use MS-DOS's version of FDISK instead. If you try to create MS-DOS partitions with Linux fdisk, chances are MS-DOS will not recognize the partition and not boot correctly. |
Command (m for help): p Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders Units = cylinders of 608 * 512 bytes Device Boot Begin Start End Blocks Id System /dev/hda1 * 1 1 203 61693 6 DOS 16-bit >=32M Command (m for help): |
Command (m for help): n Command action e extended p primary partition (1-4) p |
Partition number (1-4): 2 First cylinder (204-683): 204 Last cylinder or +size or +sizeM or +sizeK (204-683): +80M |
Warning: Linux cannot currently use 33090 sectors of this partition |
Next, we create our 10 megabyte swap partition, /dev/hda3.
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (474-683): 474 Last cylinder or +size or +sizeM or +sizeK (474-683): +10M |
Command (m for help): p Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders Units = cylinders of 608 * 512 bytes Device Boot Begin Start End Blocks Id System /dev/hda1 * 1 1 203 61693 6 DOS 16-bit >=32M /dev/hda2 204 204 473 82080 83 Linux native /dev/hda3 474 474 507 10336 83 Linux native |
Command (m for help): t Partition number (1-4): 3 Hex code (type L to list codes): 82 |
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 |
You may be given the option of installing LILO on your hard drive. Unless you're running OS/2, answer `yes'. OS/2 has special requirements; see Custom LILO Configuration below.
Installing LILO as your primary loader makes a separate boot diskette unnecessary; instead, you can tell LILO at each boot time which OS to boot.
The GNU/Linux post-install procedures has some good suggestions about things you can do just after installation to minimize problems later on.
LILO is a boot loader, which can be used to select either Linux, MS-DOS, or some other operating system at boot time. Chances are your distribution automatically configured LILO for you during the installation phase (unless you're using OS/2, this is what you should have done). If so, you can skip the rest of this section.
If you installed LILO as the primary boot loader, it will handle the first-stage booting process for all operating systems on your drive. This works well if MS-DOS is the only other operating system that you have installed. However, you might be running OS/2, which has its own Boot Manager. In this case, you want OS/2's Boot Manager to be the primary boot loader, and use LILO just to boot Linux (as the secondary boot loader).
An important gotcha for people using EIDE systems: due to a BIOS limitation, your boot sectors for any OS have to live on one of the first 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 the file /etc/lilo.conf. Below we present an example of a LILO 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 this install = /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-DOS other = /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 will install LILO on your drive. Note that you must rerun /sbin/lilo anytime that you recompile your kernel in order to point the boot loader at it properly (something that you don't need 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 when booting the bootdisk.
You can now reboot your system from the hard drive. By default LILO will 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 to select another operating system, hold down shift or ctrl while the system boots; you should see a prompt such as
Boot: |
Here, enter either the name of the operating system to boot (given by the label line in the configuration file; in this case, either linux or msdos), or press tab to get a list.
Now let's say that you want to use LILO as the secondary boot loader; if you want to boot Linux from OS/2's Boot Manager, for example. In order to boot a Linux partition from OS/2 Boot Manager, unfortunately, you must create the partition using OS/2's FDISK (not Linux's), and format the partition as FAT or HPFS, 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 only want to install LILO on your Linux root filesystem (in the above example, /dev/hda2). In this case, your LILO config file should look something like:
boot = /dev/hda2 install = /boot/boot.b compact image = /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 partition to Boot Manager. This mechanism should work for boot loaders used by other operating systems as well.