FreeBSD is fast and open, and it runs powerful tools and applications. And, yes, the OS is free.
Jordan Hubbard
The free-software world has attracted a growing army of highly talented engineers, many of whom turn out software that rivals or surpasses commercial products. Add to that the increased preoccupation with the Internet, which has led to a resurgence of interest in Unix and its strong networking abilities. These forces have helped produce a market for several free Unix-compatible OSes.
FreeBSD is one of them. We will show how it can be used for everything from providing commercial Internet service to a home-desktop solution, all with relatively inexpensive PC-based equipment.
A Brief History of
FreeBSD
In 1974, an early release of Unix was distributed to the academic community, including the University of California at Berkeley. Students and faculty were quick to see its potential. They distributed a version of Unix called BSD, for Berkeley Standard Distribution. The first release was prepared by Bill Joy (later to gain fame as the author of the
vi
editor and a cofounder of Sun Microsystems). It came out in March 1978.
Under the auspices of the Computer Systems Research Group (CSRG), and funded by a Defense Advanced Research Projects Agency (DARPA) grant to develop networking for the ARPANET (later to grow into the Internet), BSD grew and flourished. The very foundations of modern TCP/IP networking were developed for BSD. The CSRG also added other important innovations: demand-paged virtual memory, job control, the fast file system (with long filenames), and 32-bit addressing.
The BSD releases had a strong influence on the commercial Unix world, as reflected by
Sun's SunOS and Digital Equipment's Ultrix. Unix Systems Laboratories (USL) was quick to bring many features of BSD into its own System V version of Unix.
The CSRG also took what was then an unusual step in releasing two versions -- BSD and BSD Lite. The latter version was BSD with all the AT&T-licensed code removed, making it legal to distribute it freely.
BSD releases from the CSRG ended in 1992, when the group disbanded. However, the spirit of what it tried to accomplish refused to die. Several groups began working where it left off, including the FreeBSD Project, which is composed of volunteers from industry and academia.
In July 1994, some former members of the CSRG came together briefly to release BSD 4.4 Lite, the last chapter in a successful saga. Many features (e.g., stackable file systems, 64-bit file-system sizes, and "portals") were added to 4.4 Lite. The FreeBSD Project was quick to adopt 4.4 Lite with FreeBSD 2.0, released in January.
There have since been two further rel
eases of FreeBSD, 2.0.5 and 2.1. FreeBSD 2.1 represents a significant project milestone in terms of stability and overall systems integration. We will talk a little about using it in real-world applications and about what the future holds for
the FreeBSD Project
.
Installing FreeBSD
The installation of FreeBSD is fairly straightforward. It may nonetheless be useful to give some start-up tips to those who have never installed it before.
FreeBSD offers many kinds of canned installations aimed at beginners, power users, developers, and minimalists. If you don't like one of these canned options, you can create a custom installation of your own from the available pieces.
The equation gets slightly trickier when trying to tailor a FreeBSD machine to a specific application. Are you running a World Wide Web server? What kind of hardware should you get? How much memory do you need for a serious NFS server box? What sorts of Ethernet cards are appropriate f
or an IP router? These are all somewhat difficult questions to answer given that they're so broad, but you can follow some useful rules of thumb.
If you're using FreeBSD in an application where lots of I/O is involved, such as an NFS or Web server, go with SCSI peripherals. SCSI is more expensive than IDE, but for good reason. SCSI drives and controllers are more intelligent, and they off-load a good deal of overhead in transferring data from the CPU.
Don't buy
a no-name motherboard
. What works under DOS may work only because DOS doesn't push the hardware to its limits. FreeBSD will attempt to extract every ounce of performance from your hardware and will probably push it as it's never been pushed before. Motherboards with an inferior cache design or broken DMA invalidation logic do exist in depressingly large numbers. If you own a motherboard (or system) certified for another version of Unix, you're likely to have far less trouble with it. If you're still unsure, ask a loc
al Unix expert.
If you're going for serious packet routing, use Peripheral Component Interconnect (PCI) and PCI Ethernet cards. The latest PCI Ethernet cards based on Digital's DC21040 chip set are impressive and are offered by a number of manufacturers. Furthermore, they are available in both 10- and 100-Mbps (i.e., the DC21140) configurations. Therefore, you can go from warp 1 now to warp 10 later by swapping a card and hooking to the faster hub.
If you intend to support many simultaneous users or FTP sessions, don't skimp on memory. For every 10 users, add 16 MB. Configurations supporting up to several hundred on-line users with a simple 90-MHz Pentium machine are possible, but you need adequate memory for it.
Using FreeBSD for Internet Service Provision
It's no secret that FreeBSD is increasingly popular with Internet service providers (ISPs). One reason for this is the robust TCP/IP networking. A fundamental requirement for any ISP is the ability to route packet
s and provide TCP/IP-based services 24 hours a day, often under some of the most intense loads imaginable.
This means that the OS of choice not only needs to provide robust and reliable service, it also needs to scale well because an ISP's needs often exponentially increase. PCs are actually well suited to this given that they're comparatively cheap and powerful.
Providing Web service requires little more than installing a server and writing some content in Hypertext Markup Language (HTML). There are many good books on writing HTML, so we won't go into any detail here.
There are four popular Web (i.e., HTTPD) servers to choose from: European Laboratory for Particle Physics (CERN), National Center for Supercomputing Applications (NCSA), Apache, and Netscape Commerce server. The Apache server supports a number of advanced features, and it's free. The others will probably work just as well, and if you need encrypted transactions, the Netscape server is your only option.
Configurin
g the X Window System
Starting with a graphics card, a 17-inch (or larger) monitor, and the XFree86 software from the XFree86 Project, it is possible to build a reasonably high-quality graphics workstation for CAD, simulation, or 3-D-modeling purposes. Even with a 15-inch monitor and a 1-MB generic VGA card, X remains comfortable at resolutions of up to 1024 by 768 pixels.
The XFree86 package provided with FreeBSD supports a wide array of PC graphics cards. Because the X server alone is not enough to provide a truly comfortable environment, the packages/x11 category provides precompiled versions of many popular window managers and utility software for everything from viewing QuickTime movies to developing GUI applications.
Configuring one of the X servers for your graphics card is not always an easy task, and a thorough reading of the X documentation is recommended. The
xf86config
utility provided with XFree86 may be of assistance.
Remember to keep it simple when tr
ying to configure the X server -- if you can't achieve your initial target resolution, fall back to 640 by 480 pixels. See if you can get it to work there and then move up gradually. Also, do not start the X server and clients until the server is known to work. Run the X binary by itself, first, and then move on to use the
xinit
or
startx
scripts.
Using FreeBSD as a Software Developer
FreeBSD comes with a rich set of compilers and debugging aids, with support for languages as diverse as Scheme, TCL, or Forth in the packages/lang subtree. Out of the box, FreeBSD supports ANSI C and C++ compilers, as well as FORTRAN 77.
Full source symbolic debugging is provided by the GDB debugger, and utilities such as
xxgdb
and
ddd
even provide a graphical interface for it. The industry-standard
vi
editor is provided, and favorites such as
emacs
and
jove
are readily available add-ons from the packages/editors collection.
Because FreeBSD is based on the same BSD code base that greatly influenced many commercial versions of Unix, porting software to FreeBSD is usually a painless exercise. Many software developers use FreeBSD at home to augment their development environments at work. Where many accounting departments balk at the thought of providing a developer with a $10,000 workstation for home use, a $2000 PC is often easier to justify.
Many other tools of interest to the software developer are provided in the packages/development collection. The software for FreeBSD is provided with a tightly integrated build environment that may be of interest to developers looking for existing models on which to base software-development methodologies.
The Future of the FreeBSD Project
It's difficult to predict the future with any great degree of accuracy where any volunteer project is concerned. But if enthusiasm and drive have anything to do with it, the FreeBSD Project has a bright future indeed. Fa
r from resting on its laurels, the team is looking for fresh challenges. Having split development into two branches, "-stable" (i.e., semifrozen) and "-current" (i.e., in flux), a large number of developers have been freed to concentrate on new solutions without sacrificing stability. Innovative work is being done in the areas of dynamically loadable device drivers, full PC Card support, support for more than one processor, distributed processing, and much more.
There are far more desired projects than there are people to do them, so volunteers are always welcome. Those interested in joining in the development of FreeBSD should send E-mail to hackers@freebsd.org, which is open to all. You can also subscribe to this mailing list, along with a number of others, by sending E-mail to majordomo@freebsd.org and saying "subscribe hackers" in the message body.
Free software has always been a powerful concept, but organized free software has proven considerably more powerful still. As long as there are peo
ple willing to pledge time and energy to keep the organized efforts alive, growth and quality in the free-software world will continue at a rapid pace.
FreeBSD is available via anonymous FTP at
ftp://ftp.FreeBSD.org/pub/FreeBSD
. For a complete list of mirror FTP
sites in 18 countries, send E-mail to info@freebsd.org. FreeBSD is
also available on a two-CD set for $39.95 from Walnut Creek CD-ROM.
Send E-mail to orders@cdrom.com or visit its Web site at
http://www.cdrom.com
.
IF YOU WANT TO DO THIS: YOU SHOULD HAVE THIS:
Basic installation 386 PC, 4 MB
Packet routing PCI Ethernet cards (Digital DC21040- or
DC2114
0-based)
Simultaneous FTP sessions 16 MB for every 10 users
Internet ISP Pentium, SCSI, multiport modems
Jordan Hubbard is a member of the FreeBSD Project. He can be reached on the Internet or BIX at
editors@bix.com
.