# Installing the Software

In this section we'll describe how to prepare your system for installing Slackware, and finally how to go about installing it.

### Repartitioning

On most systems, the hard drive is already dedicated to partitions for MS-DOS, OS/2, and so on. You need to resize these partitions in order to make space for Linux.

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 create 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 on either primary or logical partitions.

The problem with resizing partitions is that there is no way to do it (easily) without deleting the data on those partitions. Therefore, you will need to make a full backup of your system before repartitioning. In order to resize a partition, we simply delete the partition(s), and re-create them with smaller sizes.

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, either `/dev/hdb` or `/dev/sdb`, when creating Linux partitions. This is described in detail below.

NOTE: There is a non-destructive disk repartitioner available for MS-DOS, called FIPS. Look on `sunsite.unc.edu` in the directory `/pub/Linux/system/Install`. 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.

If you're not using FIPS, however, 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 need to 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.

Use of MS-DOS `FDISK` should be self-explanatory. You'll need to make a full backup of your system, and have a bootable MS-DOS floppy with utilities such as `FDISK.EXE` and `FORMAT.COM` installed (the original MS-DOS installation disks are the best thing to use for this). Booting from the floppy, you run `FDISK` on your hard drive, and use the menu options to delete your current MS-DOS partition, and then re-create it with a smaller size. You can then re-install the MS-DOS software 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.

### Creating partitions for Linux

After repartitioning your drive, you need to create partitions for Linux. Linux requires at least one partition, for the root filesystem, which will hold the Linux software itself. You may wish to use additional partitions for other filesystems, as discussed below. In addition, most users set aside a swap partition, to be used as virtual RAM on your machine. If you have 4 megabytes of RAM or less, a swap partition is required to install the software. It is strongly recommended that you have a swap partition anyway, unless you have 16 megabytes or more of physical RAM.

In order to create your Linux partitions, first boot the Slackware bootdisk. After the system boots, you will see the message:

> `

>     Please remove the boot kernel disk from your floppy drive,
>     insert a disk to be loaded into the ramdisk, and press
>     [enter] to continue.

> `

At this point you should remove the bootdisk from the drive and insert the rootdisk. Then press `enter` to go on.

The rootdisk will be loaded into memory, and you should be presented with a login prompt. Login as ```root`''.

> `

>     darkstar login: root
>     #

> `

Note to IBM PS/1, ValuePoint, and ThinkPad Users: If you use an IBM PS/1, ValuePoint, or ThinkPad machine, the system will not recognize your hard drive when you boot the Slackware bootdisk. This is because these machines do not store drive geometry information in the CMOS (as they should) and you have to specify the geometry by hand when booting. (Later you can get around this by installing the LILO software, which allows you to boot Linux from the hard drive.)

You must use a bootdisk other than ```bare`'' for this to work. I suggest using `scsi.gz`. While booting the bootdisk, hold down the left `shift` key. You will be presented with a boot menu which will describe how to specify your hard drive geometry (that is, the number of cylinders, heads, and sectors per track) for your drive using the `hd` boot option. You can get information on your drive geometry from your hard drive manual or by running MS-DOS `FDISK`.

### Using `fdisk`

To create partitions, you'll use the Linux `fdisk` program. After logging in as root, run the command

> `fdisk drive`

where drive is the name of the drive that you wish to create Linux partitions on. Hard drive device names are:

- `/dev/hda` First IDE drive
- `/dev/hdb` Second IDE drive
- `/dev/sda` First SCSI drive
- `/dev/sdb` Second SCSI drive

and so on. For example, to create Linux partitions on the first SCSI drive in your system, use the command

> `fdisk /dev/sda`

If you use `fdisk` without an argument, it will assume `/dev/hda`.

To create Linux partitions on the second drive on your system, simply specify either `/dev/hdb` or `/dev/sdb` when running `fdisk`.

Use of `fdisk` is simple. The command ```p`'' displays your current partition table. ```n`'' creates a new partition, and ```d`'' deletes a partition.

To Linux, partitions are given a name based on the drive which they belong to. For example, the first partition on `/dev/hda` is `/dev/hda1`, the second is `/dev/hda2`, and so on.

NOTE: You should not create or delete partitions for operating systems other than Linux with Linux `fdisk`. 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.

Here's an example of using `fdisk`. Here, we have a single MS-DOS partition using 61693 blocks on the drive, and the rest of the drive is free for Linux. (Under Linux, one block is 1024 bytes. Therefore, 61693 blocks is about 61 megabytes.) We will create two Linux partitions: one for swap, and one for the root filesystem.

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

    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):

Next, we use the ```n`'' command to create a new partition. 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

A primary partition is simply one of the 4 partitions on your drive. An extended partition allows you to create multiple logical partitions within it; this allows you to go over the four-partition limit on the drive. In most cases, you should only use primary partitions unless you need more than 4 partitions on a drive.

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

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

As you can see, if we use the notation ```+80M`'', it specifies a partition 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 an old restriction that Linux filesystems could only be 64 megs in size. However, with newer filesystem types, that is no longer the case... partitions can now be up to 4 terabytes in size.

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

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

    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

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

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

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

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

After quitting `fdisk`, the system may tell you to reboot to make sure that the changes took effect. In general there is no reason to reboot after using `fdisk`---the version of `fdisk` on the Slackware distribution is smart enough to update the partitions without rebooting.

### Preparing the swap space

If you have 4 megabytes or RAM or less in your machine, you will need to create a swap partition (using `fdisk`) and format it (using `mkswap`) before you can install the software.

If you have more than 4 megabytes of RAM, you should only create a swap partition (if you want to use one)---the Slackware installation procedure will take care of formatting and enabling the swap partition. So, if you have more than 4 megs of RAM, you can skip this section and go on to the section ``Installing the Software''.

If you get any ```out of memory`'' errors during the installation procedure you should create a swap partition and enable it as described here.

To prepare the swap space for use, we use the `mkswap` command. It takes the form:

> `mkswap -c partition size`

where partition is the partition name, such as `/dev/hda3`, and size is the size of the partition in blocks.

For example, if you created a swap partition on `/dev/hda3` of size 10336 blocks, use the command

> `mkswap -c /dev/hda3 10336`

The `-c` option tells mkswap to check for bad blocks on the partition when preparing the swap space. If you see any ```read_intr`'' error messages during the mkswap operation, this means that bad blocks were found (and flagged). So you can ignore these errors.

To enable swapping on the new device, use the command

> `swapon partition`

For example, for our swap space on `/dev/hda3`, we use

> `swapon /dev/hda3`

We're now swapping with about 10 megabytes more virtual memory.

You should execute `mkswap` and `swapon` for each swap partition that you created (if you decided to create more than one).

### Installing the software

Installing the Slackware release is very simple; it's almost automatic. You use the `setup` command, which guides you through a series of menus which allow you to specify the means of installation, the partitions to use, and so forth. Almost everything is automatic.

Here, we're not going to document many of the specifics of using `setup`, because it changes from time to time. `setup` is very self-explanatory; it contains its own documentation. Just to give you an idea of what it's like, however, we'll describe what most installations are like using `setup`.

Before you begin, be sure that you have a high-density MS-DOS formatted floppy on hand. You will use this floppy to create a Linux boot diskette.

After running `fdisk` (and, perhaps, `mkswap` and `swapon` if you have 4 megs of RAM or less), issue the command

> `# setup`

This will present you with a colourful menu with various options such as ``Addswap'' (to set up your swap space), ``Source'' (to specify the source of the software to install, such as floppy or hard drive), ``Target'' (to specify where to install the software), and so on.

In general, you should go through the menu commands in the following order:

1. Addswap. If you created a swap partition (using `fdisk`), use the `addswap` menu option to tell the system about it. This option will present you with a list of possible swap partitions; just type in the name of the swap partition(s) that you wish to use (such as `/dev/hda3`). The system will then ask you if you want to format the swap partition, which you should do unless you already ran `mkswap` and `swapon` on it. That is, you should format the swap partition unless you already formatted and enabled it by hand as described in the previous section.
2. Source. This menu option lets you specify the source for the software to install. You can select several means of installation, such as from floppy or from hard drive. If you are installing from floppies, the system will ask you which floppy drive to use. If you are installing from hard drive, the system will ask you what partition the files are stored on, and what directory they are in. For example, if you are installing from an MS-DOS partition on your hard drive, and the Slackware files are under the directory `C:\SLACKWAR`, you should enter the name of the MS-DOS partition (such as `/dev/hda1`) and the name of the directory (such as `/slackwar`). Note that you should use forward slashes (`/`), not backslashes (`\`), in the directory name. There are other means of installation, such as CD-ROM. These should be self-explanatory as well.
3. Target. This menu item lets you specify what partition(s) to install the software on. The system will display a list of possible partitions. First you will be asked to enter the name of the root partition, such as `/dev/hda2`. You will be asked if you want to format the partition; unless you are installing on a partition previously formatted for Linux you should do so. You should use the Second Extended Filesystem (`ext2fs`) type for the partition. You will also be given a chance to use additional partitions for different parts of the directory tree. For example, if you created a separate partition for the `/usr` filesystem, you should enter the name of that partition and the directory that it corresponds to (`/usr`) when asked.
4. Disksets. This option allows you to specify the disksets you wish to install. Use the arrow keys to scroll through the list; pressing the spacebar selects or deselects a set. Press `return` when you're done selecting disk sets. You may wish to only install a minimal system at this time. That's fine. Only the `A` diskset is required. After you have installed the software you may run `setup` to install other disksets.
5. Install. After setting up all of the parameters above, you're ready to install the software. First the system will ask you what type of prompting to use; you should use the ``normal'' prompting method (unless you're an expert and have modified the installation tagfiles in some way). The system will simply go through each disk set and install the software. For each software package, a dialog box will be displayed describing the software. Software packages that are required will be installed automatically. For optional software packages you will be given the option of either installing or not installing the package. (If you don't wish to install a certain package now, you can always use `setup` on your system to install it later). While the software is installing, watch out for error messages that may be displayed. The most common error that you're likely to run into is ```device full`'', which means that you have run out of space on your Linux partitions. Unfortunately, the Slackware installation procedure is not quite smart enough to detect this, and will attempt to continue installing the software regardless. If you get any kind of error messages during the installation procedure, you may wish to break out of the installation program (using `Ctrl-C`) to record them. The only solution for the ```device full`'' problem is to re-create your Linux partitions with different sizes, or attempt to reinstall the software without several of the optional software packages.

### After installation

After installation is complete, and if all goes well, you will be given the option of creating a ``standard boot disk'', which you can use to boot your newly-installed Linux system. For this you will need a blank, high-density MS-DOS formatted diskette of the type that you boot with on your system. Simply insert the disk when prompted and a boot diskette will be created.

You will also be given the chance to install LILO on your hard drive. LILO (which stands for LInux LOader) is a program that will allow you to boot Linux (as well as other operating systems, such as MS-DOS) from your hard drive. If you wish to do this, just select the appropriate menu option and follow the prompts.

If you are using OS/2's Boot Manager, the menu will include an option for configuring LILO for use with the Boot Manager, so that you can boot Linux from it.

Note that this automated LILO installation procedure is not foolproof; there are situations in which this can fail. Be sure that you have a way to boot MS-DOS, Linux, and other operating systems from floppy before you attempt to install LILO. If the LILO installation fails you will be able to boot your system from floppy and correct the problem.

More information on configuring LILO is given below.

The postinstallation procedure will also take you through several menu items allowing you to configure your system. This includes specifying your modem and mouse device, as well as your time zone. Just follow the menu options.

### Booting your new system

If everything went as planned, you should be able to boot your Linux boot floppy (not the Slackware installation floppy, but the floppy created after installing the software). Or, if you installed LILO, you should be able to boot from the hard drive. After booting, login as `root`. Congratulations! You have your very own Linux system.

If you are booting using LILO, try holding down `shift` or `control` during boot. This will present you with a boot prompt; press `tab` to see a list of options. In this way you can boot Linux, MS-DOS, or whatever directly from LILO.

After booting your system and logging in as root, one of the first things you should do is create an account for yourself. The `adduser` command may be used for this purpose. For example,

> `

>     # adduser
>     Login to add (^C to quit): ebersol
>     Full Name: Norbert Ebersol
>     GID [100]: 100
>     UID [501]: 501
>     Home Directory [/home/ebersol]: /home/ebersol
>     Shell [/bin/bash]: /bin/bash
>     Password [ebersol]: new.password

>     Information for new user [ebersol]:
>     Home directory: [/home/ebersol]  Shell: [/bin/bash]
>     Password: [new.password]  UID: [502] GID:[100]
>     Is this correct? [y/n]: y

> `

`adduser` will prompt you for various parameters, such as the username, full name, GID (group ID), UID (user ID), and so on. For the most part you can use the defaults. If you're unfamiliar with creating users on a UNIX system, I strongly suggest getting a book on UNIX systems administration. It will help you greatly in setting up and using your new system.

You can now login as the new user. You can use the keys `Alt-F1` through `Alt-F8` to switch between virtual consoles, which will allow you to login multiple times from the console. The `passwd` command can be used to set the passwords on your new accounts; you should set a password for `root` and any new users that you create.

Also, the hostname of your machine is set at boot time in the file `/etc/rc.d/rc.M`. You should edit this file (as `root`) to change the hostname of the machine. You should edit the lines in this file which run the commands `hostname` or `hostname_notcp`. (The default hostname is `darkstar`.) You may also wish to edit the `domainname` commands in this file, if you are on a TCP/IP network.

Obviously, there are many more things to setup and configure. A good book on UNIX systems administration should help. (I suggest Essential Systems Administration from O'Reilly and Associates.) You will pick these things up as time goes by. You should read various other Linux HOWTOs, such as the NET-2-HOWTO and Printing-HOWTO, for information on other configuration tasks.

After that, the system is all yours... have fun!