You've installed FreeBSD, and it works fine, of course. If you are as seriously committed to using it as your desktop as I am, you'll want to get the most out it. Let's go hardcore! The key with FreeBSD is optimization -- tweaking the compile process so the resulting binary code runs as efficiently as possible.
So you've got some decent hardware. Optimization has always been fairly easy with FreeBSD, but recent changes in version 6.x have made it even better. Here's the concept: You use FreeBSD on the desktop or laptop. Set aside the time upfront to invest in the system, and the return over the next year or so will likely make you glad you did. Starting with around 500Mhz CPUs, the difference is noticeable. For CPUs above 1Ghz, the difference is often quite surprising.
This article assumes you have some sort of broadband access. Without, this procedure would require about two weeks, even if you have the time to nurse the system through the inevitable dropped connections. As it is, this can take up to three days with a fast connection. Also, you'll need to note much of this depends on having at least 1Ghz of CPU speed, and a half-gig of RAM. Lesser machines take much longer. More robust machines take less, and a large CPU cache makes a major difference. Also, unless you have tons of work files, 20GB of harddrive is plenty, and a 40GB will be huge. However, a faster harddrive will make the system faster, for obvious reasons.
Having installed FreeBSD at least two-dozen times, I tend to glance only rarely at my notes on the walkthrough. The steps haven't changed much since the 4.x release series. You may need a more thorough review. However, given the goal of optimization, this will be rather different. We will install only the core system, rebuild and optimize that, then add the other userland packages from the latest sources. When we are through, the entire OS and all binaries will be optimized.
Again, get it set in your mind this takes awhile. Once you begin adding the userland packages, there will be frequent occasions when you'll need to select options for a given item. This cannot be done unattended.
Up through the point of partitioning the disk and creating the file system, there's nothing new. However, when the prompt comes up asking you to select a "distribution" (pre-selected package collection), only take the bare minimum for building the core system. You want #4, "Developer" without X. Since I was working from the installation CD, I chose that source. After the congratulation message, you'll need to configure your Internet connection. You'll need this very soon.
When the message asks about ethernet or slip/ppp, choose "yes." The
next window lists the various interfaces the installer thinks it can
address. If you have an ethernet controller, much depends on the chipset
and how it connects to your hardware. There are several dozen drivers
already included in the FreeBSD kernel. Mine offered to use the
rl0 (that's RL-zero), because my system has an
onboard RealTek 8100 series chipset. If you don't see an option that
describes the chipset for yours, you'll need to spend some time with
Google, and I recommend you use keywords which include
freebsd and the brand and model of your ethernet chipset.
It is possible you can load the driver manually later, or you may need
to compile in a special driver. While this is relatively painless for
most things, it's beyond the scope of this article. I highly recommend
you join a forum where there are plenty of experience BSD users.
You'll need to know what your ISP requires from you to connect. At a minimum you'll need to know whether to engage DHCP. For something like AT&T Yahoo DSL, that may be all you need (although FreeBSD does support PPPoE if your modem does not handle the authentication process for you.). When the form pops up for the host information, most of it will be filled in correctly under DHCP. You'll need to give your machine a name. I suggest a simple four or five letter nickname in this pattern:
If you have a fixed IP address and a legitimate host name, use that
instead. For the next few questions, I said "yes" only to the use of
SSH. This makes it easier to transfer files between machines on the same
local network (hint:
man scp). Most everything else should
be "no." Eventually you'll work your way to the option of adding
pre-built packages from the CD. We need only three:
bash: I won't apologize for choosing the most user-friendly shell. If you become curious, read up on the others and try them out. Most desktop users prefer
cvsup-without-gui: This will allow you to download core system update code and update your ports tree.
pico: This is one of the simplest editors on the commandline, far simpler than anything else easily available in this situation.
Tell the installer you are finished and be ready to swap disks
around. If you find you are missing disk 2, or it is unreadable, you can
come back to this later. In fact, once you've done your first reboot,
you can do it anytime using the command /stand/sysinstall,
then changing your install source to FTP, as long as you know the exact
FTP address you want to use. Once you have
running, take time to read the listed options, and you should be able to
find that option, plus the option for adding packages. In my case, the
installer couldn't read the
You'll see how I got it later.
In fact, the only thing left is adding your user account and setting
the root password. Once you've done that, the installer asks if you wish
to revisit any last install options. Select "yes" and you'll be back at
sysinstall main window. When I changed to FTP install
source, in the blank line for FTP directory, I decided to use:
because for a single package, it shouldn't make too much difference
whether you use a mirror close to you. Pay attention to the prompts, and
realize you can always go back to the main
window and keep trying it over until you get it right. You can find more
Optimizing and Building the Core
Your first boot should stop at the point of starting the SSH daemon
by asking you to type random characters on the screen. Be sure you don't
hit the key sequence
CTRL-C nor the
Lock in the process, as they can ruin the whole thing. Just use
the main letter and number keys and hit
ENTER when you have
at least one line of random junk. The system will then create your SSH
keys and come back to the login prompt.
Login as root. Keep in mind, at this stage we do everything from the
console. First, let's configure
make.conf. We'll copy the
generic system default and modify it.
cp /usr/share/examples/etc/make.conf /etc/
pico -w /etc/make.conf
pico editor will allow us to add compile-time
options for the system in general. The basic standard C and C++
libraries allow for CPU optimizations. With each new generation, the
processor manufacturer adds new command sets to make the processor more
efficient and powerful. You'll notice in the top of the
make.conf file, we have a list of processors for which
there are command-set optimizations in the libraries. Mine is a
Pentium4, so I set the first CPU line like this:
CPUTYPE=pentium4. If the list of choices offered confuse
you, consider choosing simply
i686 (unless you have an
ancient 586 or AMD K5). Bench testing indicates the greatest improvement
begins there, and anything fancier is only a small increment faster.
However, if you know what you've got for sure, there's no harm taking it
to the max. Also note, things in FreeBSD have advanced to the point
where the general prohibition against optimization level 2 in the
CFLAGS is no longer applicable. So I made that one like
CFLAGS= -O2 -pipe. There are other possibilities, but
you'll need more expert guidance for your purposes.
Now we need to update our source and ports tree. This is adequately covered elsewhere. The only difference is, since we have no GUI, we use the cvsup command provided in the cvsup files:
cvsup -g -L 2 stable-supfile
for the system core, and similar for the
You should see displayed on the console a detailed report of what is
being dowloaded. When finished, you'll see a
successfully, and the command prompt will return. Next, you'll
need to navigate to the kernel configuration file and make some changes.
That is also covered in the system
update tutorial. Make sure you don't get too zealous in deleting
options in the kernel configuration. I once removed the
driver and couldn't mount any USB storage devices. You can find details
I'll only outline here the steps to rebuilding the core system:
Upon rebooting, everything you have so far will be optimized. Next, we add uesrland stuff.
Don't be afraid to keep all that code in the
directory until the next system update. Should you ever damage or
corrupt part of your core system, it's a simply matter to run
installworld again and fix things. However, be sure to delete all
that stuff before your next system update.
Adding the Desktop
Because we updated our ports tree, we can be comfortable we are getting the latest and greatest for FreeBSD. You can choose any desktop you want. For this exercise, I chose KDE, which is a common choice for home and small business users. Building KDE from source and optimizing can easily halve the time and resources required during daily use. Because the ports tree handles dependencies for us, we need not worry too much about all the niggling details. The shortest path is this:
make install && make clean
However, that adds components I won't use. The path I chose is probably not the shortest, but the one with which I'm most comfortable. I went through the ports tree and ran the build and install scripts for the following:
If you watch, you'll notice in the process you'll get some of the X.org packages built automatically as dependencies, and all of it will be optimized. However, to actully have a GUI on your machine, you'll need to add the following manually:
- dri (if your graphics chipset is capable of 3D rendering)
Other packages you might consider, based on your desktop use habits:
Notice many of these will also pull in various dependencies. The last significant item is an office suite. While OpenOffice is the standard, it really does take a long time to build, and requires a huge amount of temporary space on the harddrive. With the 1.x series it was 4GB; 2.x requires about 9GB. The build process is also prone to errors, so only try it if you really need it. Note it was just recently ported fully to the AMD64 architecture. Given my choice of the KDE environment, my own preference is KOffice. The latest version is quite useful. Once you have your templates made, it's quite easy and will open most files made with OpenOffice 2. If you prefer GNOME, consider the AbiWord/Gnumeric pair. On much older machines, you may need to look elsewhere, such as using Ted as a word processor, and oleo or the commandline spreadsheet sc.
Once you've finished building all your chosen packages, you will have
spent at least two days most likely, and it's time to run the last
configurations. Setting up the X.org server is covered
elsewhere. However, you can't do any of this from
sysinstall any more. It's simplest, in my opinion, to run
/usr/X11R6/bin/xorgcfg -textmode and follow the
instructions on the screen. Also, don't forget to configure
It's simplest to test the configuration while still logged in as
root. First, type
cd by itself to return you to root's home
directory. There, create a file that starts KDE automatically:
Type in this line:
exec /usr/local/bin/startkde, then
ENTER because configuration files in BSD must have one
blank line at the bottom. Save and close. Then try the command
startx and see what happens. If it fails and you have no
idea what to do, see your friends on a BSD forum, or you can contact me
and I might be able to help.
Ed Hurst is Associate Editor of Open for Business. Ed operates a computer ministry in Oklahoma City. He loves computers, runs FreeBSD and GNU/Linux and reads all sorts of things. You can reach Ed at firstname.lastname@example.org.