blog.jj5.net (2003 to 2005)

FreeBSD vs Linux

Mon May 24 02:12:00 UTC+1000 2004

Categories:

So, having never paid much attention to how various open-source stuff is licensed, I was interested to read this explanation from Antony.

Thanks Antony!

John.

--

Hi John,

First things first, let me explain a bit about Redhat/FC and other Linux distros, vs FreeBSD and why I (a) prefer it; (b) would probably
recommend it in preference to FC for what you're doing. My knowledge of Fedora extends to having used the Linux machines in UTS Building 10; I
was a Linux user (Slackware/Stampede) from ~1997-1999, but after a server failure I decided to take up someones advice to try out FreeBSD. Since then I've never looked back.

There's a few major differences between how the (Net|Open|Free) BSD's work. With Linux, everything has its own version. You might have kernel v2.6.1, with bin-utils x.y.z, etc etc etc. The BSD's use a much more tightly integrated system, whereby you have a "release" that contains your kernel and all your essential userland utilities - all those fun commands like 'ifconfig' that you've been learning are part of your basic userland setup. One advantage of this is that there's only one FreeBSD; as such, there's some outstanding documentation available:

    http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html

The handbook referenced above contains an endless source of things covering system administration and many questions such as you asked below (eg. what files specify what starts on startup).

Then you have the licence differences - Linux and its associated tools are published under the GPL, whereas the BSD's use the BSD licence that says "here is the code. do with it as you will, so long as you put this copyright notice in your documentation somewhere". You could put it in a commercial project and not release source (not that that stops you releasing it if you wanted to). It's basically much free-er than the GPL, which IMHO is more of a political statement than anything else.

Redhat has historically been known as a "bloaty" distro, aimed at ease of use; I don't know what disk space FC requires, but a basic install of FreeBSD usually sets me back about 150mb. Software installation works differently too - shy of Gentoo, most Linux distributions favour pre-compiled binaries. Unfortunately, with all the multitude of versions of libraries and software out there, eventually people tend to get bitten by "dependency hell", where the dependencies installed and the software you're trying to install get out of sync, and your whole packaging system goes to hell.

With FreeBSD, it uses a 'ports' collection. Typically, everything gets compiled from source, however you *also* have the option of installing binary packages (so if you're in a rush). The massive advantage you get here is being able to specify what options you do and don't want compiled. Do I want libgd (graphics lib) compiled with GIF LZW support (ie. does the patent on LZW still existing in my country and/or do I want to flaunt the patent)? Installing something like Apache is a case of:

     cd /usr/ports/www/apache13
     make install

It then fetches the source tarball (.tar.gz), applies any patches known to be required to fix security bugs, allow better FreeBSD compatibility, etc. Then it compiles it, installs it under a cleanly defined directory structure (another thing that Linux never had, at least back when I used it) -- all your packages go under /usr/local *where they belong*. /usr/local/bin is general binaries. /usr/local/sbin is super-user binaries. /usr/local/lib are libraries installed by ports.

When you go to install PHP -

     cd /usr/ports/lang/php4
     make install

You get presented with a list of all the various PHP extensions that are available. Go down the list, press space to select the ones you want, then highlight OK and hit Enter. It downloads and compiles all the dependencies for the options you've selected, installs them, then does the same for PHP.

All this alleviates the dependency hell problem, because it ensures the right versions of libraries are installed and uses what is installed already. If you're compiling a database, you can do:

     cd /usr/ports/databases/postgresql7
     make -DWITH_OPTIMIZED_CFLAGS install

and it'll compile it with maximum optimisation levels. For that matter, you can set the default compilation settings for all software that gets built.

The /etc/rc.conf file controls pretty much everything to do with startup; want to run ntp to sync your machines clock on startup? Add 'ntpdate_enable="YES"' to the rc.conf file. Network interface? 'ifconfig_rl0="inet 10.1.2.3 netmask 255.255.255.0"'.

Oh, and if you were worried about specs - I've happily run FreeBSD on as low as a P133 with 32mb RAM. That was my server at home for 3 years :)

If you decide to make try something different, I'm more than happy to help you through the installation and setup process (though I must admit, if my boss can master setting up a basic FreeBSD install, and he's a complete UNIX newbie - Netware 4.11 is more his thing - it isn't that hard :); otherwise, I'll do my best to help with the configuration side of things as best I can :)

Anyway, I'll stop ranting and raving. I admin ~600 FreeBSD servers as part of my job, so I am rather biased! I tend to believe that Linux is great on the desktop, and FreeBSD on (network) servers. Works for Yahoo... :-)


Copyright © 2003-2005 John Elliot