Installing Linux via NFS

by Greg Hankins

One of the easiest and quickest ways to install Linux is over a network, using NFS (Network File System). All you need is a machine that has the full Linux distribution available for NFS mounting. In this article, I'll describe in detail how to install Linux via NFS using the Slackware 2.1.0 distribution, although the concept of installing operating systems over the network is by no means specific to Linux or Slackware.

The first step in the installation process is to make sure that the filesystem containing the distribution is available for mounting on your soon-to-be Linux box. Talk to your sysadmins and ask them nicely to export the filesystem for you to mount. You'll also need to get an IP address for your Linux machine. Your sysadmin can help you with this, too. While you're gathering information, find out your netmask, gateway address, the IP address of the machine containing the distribution, and what the path to the distribution directory is. Write these down; you'll need all this information later.

Next, you'll need to make a boot disk and a root-install disk to boot Linux on your PC. Since we want to install via NFS, it's rather important that we choose a boot disk with networking drivers. The boot disks can be found in the bootdsks.144 or bootdsks.12 directory in the slackware distribution. Choose the directory according to the size floppy disk drive you have: the “144” directories are for 3.5" floppies, and the “12” directories are for 5.25" floppies. If you are using IDE disk drives, use the net boot disk. If you are using SCSI disk drives, use the scsinet boot disk. Root-install disks can be found in the rootdsks directory. The color disk uses a full-screen color install program and is very nice. This is the one I used when I wrote this article. Alternatively, you can use the tty disk. It uses text based install scripts. Installation using the umsds disk should also be possible, in the unlikely event you need to keep DOS around.

All boot and root disks are described in more detail in README files in each of the disk directories, if you'd like to know more about them. Once you've decided on your boot and root-install disk, you need to format two floppies and copy one image onto each of them. Please read the INSTALL.TXT file, section 3.4.2.1, in the top-level slackware directory, for exact instructions on how to do this. In fact, you should probably print this file out, since you'll need it to help you repartition your hard drive later on. While you're making floppies, go ahead and format a spare one. This will be needed later on to make a bootable floppy for emergencies.

Grab the three floppies and go over to your PC. Make sure that you are actually plugged into a network. Then, insert the boot floppy and power up your machine. You should see the letters LILO appear on your screen. This means that the LInux LOader is loading Linux. After some whirring, you will be prompted for extra parameters to boot your system with at the boot: prompt. You probably don't need to type anything here since you are installing a new system. Just hit <return>. You'll see Linux announce that it's loading the ramdisk, and various device drivers will initialize. This may take a couple of minutes. When the system asks you to switch disks, remove your boot floppy, and insert your root-install floppy. Don't forget to hit <return>. Linux will then load a root filesystem into memory. When the system has finished loading, you'll see a message containing important information (which you should read), and then a slackware login: prompt. At this point, you can login as the superuser root; no password is needed.

Once the system is running, the first thing to do is repartition your hard drive. Using the fdisk program, create some Linux partitions and a swap partition. See section 4.1 in INSTALL.TXT which you printed out earlier, if you need help doing this. Write down the partitions you created! You'll need to know the partition names later on. If you have less than 4MB of RAM, you'll need to activate your swap partition now. Follow the instructions in /etc/issue if you don't know how to do this. If you have more than 4MB of RAM, you can activate your swap partition from within the setup program.

Now, run the setup program. Unless you have already activated your swap partition, choose the ADDSWAP option from the menu. setup will detect your swap partition, and ask you if you want to activate it. Answer “yes” and also answer “yes” when asked if you want to use mkswap and if you want to activate the swap partition. Then, setup will setup your swap partition for you.

We'll continue the installation by creating our TARGET partitions. You can continue on to this step from the ADDSWAP option, or choose it from the top-level install menu. Again, setup will identify appropriate partitions for you to use as Linux filesystems. Looking at your list of partitions you created, figure out which partition you are going to use for your root Linux partition. Enter this partition at the prompt. You'll be asked to choose a type of Linux filesystem to use. Most people use the ext2 (Linux Second Extended Filesystem). If you are a beginning Linuxer, this is a good choice for you. Having decided which filesystem you want to use, you need to format the partition. Choose the Check option from the menu to do this. If you have more than one partition setup for Linux, repeat the process for all your partitions. When you're done, type a q to finish the TARGET section.

So far so good. You can now continue to the SOURCE option, or choose it from the top-level menu if you're not going in sequence. Select option 3 “Install via NFS”. The warning message you'll see next sounds intimidating, but don't worry—it's not that bad. Gather your courage and your list of networking information and continue.

At the prompt, enter the IP address assigned for your PC. Next, enter your netmask. If you have a gateway (i.e., the NFS server is not on the same subnet as your PC), enter it; if not, answer “no”. Enter the IP address of the machine that has the Slackware distribution. Last, enter the pathname to the distribution. The setup program will put you into text mode and try to configure the networking. You should see something similar to this:

 Configuring ethernet card...
 Configuring our gateway...
 Mounting NFS...
 Current mount table:
 /dev/fd0 on / type minix (rw)
 none on /proc type proc (rw)
 /dev/hda1 on /mnt type ext2 (rw)
 111.112.113.114:/slackware on /var/adm/mount type nfs
 (rw,addr=111.112.113.114)

If you don't see an error occur in the network setup, you can continue. If there is an error, go back and try again. Make sure you enter the correct network information.

That was the hard part. Now, continue on to the DISK SETS section, or choose it from the top-level menu. Section 3.1 of INSTALL.TXT has good instructions on how to choose disk sets. Aren't you glad you printed it out? After selecting which software you want to install, continue on to the INSTALL section, or choose it from the top-level menu. Go through the installation process—this is lengthy, but not nearly as lengthy as installing using floppies. We know this from experience!

Linux is now installed on your PC. Take a break and rejoice. You're nearly done. The only thing left to do, before you go tearing into your new system, is CONFIGURE a few more things on your Linux system. Continue on, or choose this option from the top-level menu. The first thing to do, is make a backup bootable floppy disk. Insert the other disk you formatted earlier and hit “OK”. The next step in the configuration makes links for your modem and mouse devices. I do not recommend making the modem link, because it can mess up serial communications programs later on. But if using /dev/modem is easier for you, then let setup make the link. The same goes for the mouse link. If you have a CD-ROM, you can configure the CD-ROM device at the next prompt. The last installation step is to configure LILO, the Linux Loader. Choose the appropriate options for the type of operating systems you have on your hard disk. LILO can load several other operating systems (term used loosely here) in addition to Linux. The LILO configuration depends on your setup, but the menus are very self-explanatory.

That's it. You're really done now. Exit setup. You will be dropped back to the # prompt. All you have to do now, is eject the floppy disk from your disk drive and type reboot. If you did not install LILO, put your boot floppy in the floppy drive. If you're not an experienced Unix hacker, a good thing to read next is Installation and Getting Started by Matt Welsh. It can be found on sunsite.unc.edu:/pub/Linux/docs/LDP and in many bookstores around the country.

Happy Linuxing.

Greg Hankins (greg.hankins@cc.gatech.edu) is an aspiring young sysadmin at Georgia Tech's College of Computing. In his spare time, he also maintains the Linux Serial-HOWTO. He's been on the Linux bandwagon for nearly two years.

Load Disqus comments