David Chaplin-Loebell (dloebell)
Your post inspired me to write out a list of my hard-won FreeBSD
knowledge. I'm no expert, but I've had FreeBSD servers for almost three
years now and I've learned a few things. Hopefully they're useful for
others:
FreeBSD (and the ports collection) use the /usr/local tree more
consistently than other Unixes I've dealt with. For example:
- Config files for locally-installed software live in subdirectories of
/usr/local/etc/ -- there's one subdirectory for each package.
- Similarly, startup files for locally-installed daemons live in
/usr/local/etc/rc.d -- note that many ports will install a ".sample" file
in this directory; only files ending in ".sh" are actually run at
startup.
- Docs for locally installed packages go in /usr/local/share/doc
The nice thing about all this is you rarely have to mess with /etc, and
that's good because /etc files are routinely replaced in system upgrades.
(There's a tool called mergemaster that helps deal with this, but it's a
pain to use, and it's better to simply minimize modifications of files in
/etc).
I know I mentioned cvsup and portupgrade earlier, but I'll reiterate:
every FreeBSD system needs these two tools. There's a good article on
portupgrade here:
http://www.onlamp.com/pub/a/bsd/2001/11/29/Big_Scary_Daemons.html
CVSUP is a bit harder to find a good explanation for. It's easy once you
build a proper config file, but figuring out what to put in that config
file the first time can be a bit confusing. I suggest:
*default host=
cvsup2.FreeBSD.org
*default base=/usr
*default prefix=/usr
*default release=cvs
*default tag=RELENG_4_8
*default delete use-rel-suffix
src-all
ports-all tag=.
This says: get the latest sources in the 4.8-RELEASE tag, and the latest
ports. I prefer to track 4.x-RELEASE on my machines (I'll move to
5.x-RELEASE when the FreeBSD team declares it "production" ready.) Some
admins seem to prefer tracking FreeBSD 4-STABLE, but in my mind this
changes too often to use on production servers. If you prefer to track
-STABLE, simply replace RELENG_4_8 with RELENG_4.
Subscribe to the FreeBSD security alerts mailing list at
http://lists.freebsd.org/mailman/listinfo/freebsd-security-notifications
so you know when you need to upgrade your system.
If you read only one section of the FreeBSD manual, read about how to do
system upgrades. Basically, you cvsup your sources, do a make
buildworld,
make buildkernel, make installkernel, reboot, make installworld,
mergemaster. But of course there are details, and if you're running an
internet server you should know how to do this.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
FreeBSD has many useful options that can be controlled by editing
/etc/rc.conf. In particular, this file is used for enabling and
disabling
built-in subsystems like Sendmail, sshd, nfs, etc.
If you deal with perl, do yourself a favor and install the
/usr/ports/lang/perl5, then type use.perl port. This means that you will
use the version of perl installed from ports, not the version that is
part
of the FreeBSD system. The version installed with the system is
5.005_03,
very outdated, and not easy to upgrade. Do this BEFORE you install any
Perl modules from CPAN.
When possible, install everything from ports. Don't install things by
any
other method unless the port doesn't work or is unavailable. (In
particular, installing perl modules using the CPAN module seems to get me
in trouble whenever I do it. I almost always discover that the module I
needed was available in the FreeBSD ports collection after all).
On a server, I generally want only the command-line version of a tool,
not the X11 version. For example, if you go into the emacs port
directory
and type "make install", it will, by default, build X11 before it builds
emacs, and build an emacs binary with lots of X11 stuff in it that you
don't need. In most ports, you can disable this behavior by typing
make install WITHOUT_X11=1