Whether it be a production grade server or a home computer, as long as it is connected to the outside world, running a firewall is unavoidable. GNU/Linux comes with its own firewall called iptables (netfilter). And there are a number of front-ends available such as Firestarter which make maintaining a firewall childs play especially on the desktop. In the past, I have published articles explaining how to setup a firewall in GNU/Linux.
Dru Lavigne, an instructor and FreeBSD advocate has written an excellent tutorial explaining how to setup and use Firewall Builder - an object oriented GUI and a collection of policy compilers for various firewalls including pf (packet filter) the firewall used in FreeBSD. The tutorial takes the readers through setting up (installing) firewall builder software in FreeBSD to creating a firewall ruleset to controlling the firewall and lastly fine tuning the rules.