WWWsmith: Installation and Configuration of FreeBSD

Here's how to set up a web server using another freely available operating system, FreeBSD, a high performance, mature, UNIX-like system.

FreeBSD is a popular (and free) Unix-like operating system, available from the Internet and on CD-ROM (chiefly from Walnut Creek CD-ROM). In this respect, it shares much with Linux, which is admittedly more popular and better documented.

Unlike Linux, FreeBSD is (as the name implies) derived from the popular BSD variant of Unix; many features considered standard with Unix these days originated at the University of California, Berkeley. These features include (among others) networking and long file names; the networking code, in particular, is mature and high performance. (One of the busiest sites on the Internet is http://wcarchive.cdrom.com/, aka ftp://ftp.cdrom.com/ aka ftp://ftp.freebsd.org/ aka http://www.freebsd.org/; it runs FreeBSD and pumps out data at an average of more than 2.5MB per second, every second of every day.)

In this article, I will describe the process of installing FreeBSD on a LAN, and configuring it to work as a web server, all using free software. Although Unix is not traditionally a user-friendly operating system, FreeBSD does have a usable installation process (provided you read the documentation and have a rough idea what you are doing) and requires very little maintenance.

Before installing FreeBSD, you need to be prepared. First, you need to know how you will choose to install the system: via CD-ROM, NFS or FTP. CD-ROM installs are the easiest and fastest; FTP is the most commonly-used. This requires that the computer you are installing on have access to the Internet (either via LAN or PPP/SLIP).

Hardware Requirements

FreeBSD needs at least an 80386-level processor, with at least 4MB of RAM and about 150MB of disk space. Note that FreeBSD currently requires at least 5MB of RAM for installation—but can get by with 4MB post-install. Most popular disk controllers are supported, including (E)IDE and several SCSI controllers. The machine I am using is a 33MHz 80486, with 16MB of RAM and a 202MB IDE drive. It also has an UltraStor 34f VLB SCSI controller with a CD-ROM drive attached, and a Novell NE2000+ Ethernet card, configured at IRQ 5 and 0x280.

For PCI systems, almost any DEC 21x40 and 21x41-based Ethernet card will suffice, and both the Adaptec and NCR SCSI controllers are well-supported. The NCR is considerably cheaper and is well-suited to low-load systems. There is some debate as to whether the new versions of Adaptec's SCSI cards are worth the money for high-end systems, due to recent changes Adaptec has made. There is also new support for DPT SCSI cards, including their RAID controller, which may be desirable in some circumstances.

Some IDE CD-ROM drives, and proprietary CD-ROM interfaces, are also supported. The support for those is not as good as for the SCSI. This is true because while a SCSI driver may be quite complex, the command set is very standard, which is not yet the case for IDE CD-ROM drives.

You will also need a boot floppy. The boot image is available at ftp://ftp.freebsd.org/pub/FreeBSD/<release>/floppies/boot.flp and on the CD-ROM as /floppies/boot.flp. The release I used was 3.0-970522-SNAP. If you are creating the boot floppy under a Unix-like system, you would use dd to create the image. For example, under FreeBSD, type:

dd if=boot.flp of=/dev/rfd0a bs=18k

A similar command is used on other Unix systems. If you are creating the floppy under MS-DOS, you will need the rawrite.exe file, which is located in .../tools/rawrite.exe on both the FTP site and CD-ROM. Create the floppy by typing:

 ..     ools\rawrite boot.flp a:
I installed the 3.0-SNAP release, which is available on CD-ROM; it is essentially a development snapshot, and hence isn't as stable or mature as the other releases.

Preparing to Install

Before beginning the installation, at least read the release notes. The recommended files to read are INSTALL.TXT, README.TXT and RELNOTES.TXT, all in the release's root directory.

Write down hardware information, such as the disk geometry (heads, sectors, and cylinders)—although this is not truly necessary, it can be useful. Also the configuration of any ISA cards, such as SCSI and Ethernet. Last, since the machine is going to be on a LAN, you should write down the host name, domain name, IP address, default router IP address and name server (DNS) IP address; this will save you a lot of frantic searching later. Note that if you are doing an FTP or NFS install, you need the same information.

Beginning Installation

Installation is begun in the same way as any other equivalent system: put the boot floppy or CD-ROM in the drive. Press enter at the Boot: prompt; if you don't type anything, it will time out and boot automatically.

First a scrollable menu is presented to let you decide whether or not to configure the kernel. You can choose to skip the configuration step, or you can enter either a visual or line-oriented configuration program. (I recommend the visual mode, of course.)

The kernel configuration process allows you to disable or reconfigure most device drivers; this is invaluable if you have a device card that is configured slightly different from what FreeBSD has been told to expect. Some devices require destructive probes (meaning that probing for one may confuse or disable another device); if you know which devices are not in your system and disable all of those, probes will be less of a concern. Please note that PCI devices are not, currently, configurable—since they are configured on the fly, there is no conflict, and do not need to be re-configured or deleted.

In my case, I disabled all of the mass-storage devices that I did not have, including the Adaptec 154x driver and the second Western Digital controller. The Western Digital driver, wdc, controls (E)IDE, ESDI, MFM and RLL hard disk drives. The probe sequence for one of these controllers takes a considerable amount of time, so disabling the second one, _wdc1_, speeds up the boot process measurably.

The visual configuration process is fairly self-explanatory and takes only a few seconds to go through. However, it is not, in most cases, truly necessary. An example of when it would be necessary: if my Ethernet card had not been configured at IRQ 5, I/O port 0x280, memory address 0x0d8000, I would need to either reconfigure the card or change what the FreeBSD kernel expected. If you accidently delete a driver, you can reconfigure it by switching to the “Inactive Drivers” section by pressing tab and pressing enter to re-enable it.

After you've finished the kernel configuration, press Q, answer the question that appears and watch the system boot. On a slow system, you can watch the kernel messages being issued and ensure that all of the desired devices have been found. Or, you can press the scroll-lock key when they begin to scroll, and when the kernel is done probing, you will be able to scroll the display up and down using the arrow keys and page up/page down.

You will now be presented with a text menu (in color, if you are on a color CGA or VGA monitor). (See Figure 1.)

Figure 1. The Initial Install Menu