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.
Post-install Configuration

As mentioned above, I always configure my kernels to trim away any unneeded devices. This is similar to what was done during the visual configuration process but is done by compiling the kernel, it results in a smaller kernel, requiring less memory.

The FreeBSD Handbook describes this process in detail. The Handbook is available on the FreeBSD web page, at http://www.freebsd.org/ and is also installed in /usr/share/doc/, in HTML. In simplest terms, you do the following commands:

cd /sys/i386/conf
cp GENERIC <machine name>
vi <machine name> #edit the file and exit vi
config <machine name>
cd ../../compile/<machine name>
make depend all
cp kernel /kernel

The complicated part is in the editing of the configuration file. After dealing with the visual configuration utility, the configuration file should not be all that complicated. (It is documented in the Handbook.) You can use the dmesg command to see which devices were found and which were not. By default, the installation leaves a copy of the generic kernel in /kernel.GENERIC; you can boot this, or any other kernel, by typing the name of the kernel at the Boot: prompt.

In addition to removing or configuring devices, system parameters can also be configured this way. One such parameter, maxusers, controls how much memory the kernel allocates to certain resources—the maximum number of processes, open files, and time events are all calculated based on maxusers. Another parameter that may need to be changed is MAXMEM—due to BIOS limitations, FreeBSD only recognizes up to 64MB of RAM by default (or 16MB on some very old systems), and MAXMEM (specified in KB) tells it to use more.

For example, on a machine with 256MB of RAM, which is expected to have a heavy load, the following lines in the configuration file might be used:

maxusers        100
options         MAXMEM="(256*1024)"   # 256MB

Once again, after editing the appropriate configuration file, run config and then make.

Making the Web Server Useful

The Apache package installs the configuration files into /usr/local/etc/apache, and the default configuration files have a document root of /usr/local/www/data. By creating an index.html file in that directory, the web server is now up.

For me, the machine was completely installed, configured and acting as a web server on my LAN in about two hours. Most of that time was spent waiting for the kernel to recompile; it took 90 minutes on this machine (it takes about six and a half minutes on my 133MHz Pentium)—and the system was working as a web server during that period.


I have installed FreeBSD several times. The process is fairly painless, largely intuitive and very quick when done from a CD-ROM. My main objection is that it lacks a help option for many of the dialog boxes or menus; this can make it difficult to know what to do if you are new to Unix. However, ignoring that, the install went smoothly and required no knowledge of Apache configuration or installation on my part. If I hadn't chosen to reconfigure the kernel, I would have had a fully-functioning web server within about 30 minutes of beginning installation.


Sean Fagan has been a BSD contributor for many years. He lives in San Jose with a psychotic cat who insisted on being mentioned in this article. He can be reached at sef@kithrup.com.


White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState