FreeBSD install from scratch

A clean install guide

This guide will walk you through the install process for FreeBSD. I used 4.10 to write the original version of this guide, but there have been some significant changes in the 5.x releases, so an update was in order. Basically this will guide you through the process of install the freebsd base, updating the sources, and compiling the kernel and base system.

First off head over and read through the freebsd handbook section on installing. I recommend you follow along with it for the bulk of the install, because it contains a lot of info that would be pointless for me to repeat. Think of my guide as a cheat sheet. Pop in your freebsd cd and boot from it. The system install utility (sysinstall) will startup automatically. If you have issues booting, or having all your hardware detected (such as sata controllers), this is where you’ll need to do some extra work.

Once sysinstall has started, you’ll want to s custom install. First go into the options and Enable DHCP if you are on a network that supports it (hopefully you are). Then go ahead and hit Q to quit. Refer to the bsd handbook for setting up the partitions and disk slices, they explain it much better than I could ever hope to.

When you’re ready to select your distributions, go down to the bottom of the list and select Custom. Select the following packages:

  • base
  • man
  • src (all components)
  • ports

Choose your Media type as CD/DVD, then select Commit. Now go do something else (like go outside, or pay your bills) for awhile while your hard drive gets formatted and bsd is installed.

Done yet? Ok, good. :)

Just a couple things to do before rebooting, so when it asks if you want to set any last options, choose yes. First off, set the root password. Pick something good. I recommend this site for generating random passwords. For a reasonably secure password, be sure to use letters and numbers and make it at least 8 characters long.

Next, Networking. Select Interfaces, and then select your network adapter from the list, say no to IPv6 (unless you actually are on an v6 network), and yes to DCHP (if you have it). DHCP will provide most of the correct settings, otherwise you’re gonna have to fill out all those boxes by yourself. For the hostname, enter whatever you want to call the machine. If things haven’t been going well so far, I suggest littlebitch. Dont worry about the domain, it’s not important unless you actually own a domain that you want to have addres the box.

In Startup Services, you can enable APM if you are running a laptop. Also, if you plan on using any usb devices, it is a good idea to enable the usb daemon.

Finally, you will want to create a user account for yourself. Do this by selecting User Management, Add a new user. The login ID is the username you want, leave group blank. For member groups, enter wheel. The wheel group is kind of like the admin group. For the login shell, you may wish to choose something else, tcsh or bash perhaps. If you haven’t already installed it, bash is unavailable for right now, but /bin/csh or /bin/tcsh will work just fine.

reboot

Now we should get a couple of packages installed to help us update and maintain our new system. You can use the command pkg_add -r packagename to fetch and install the following packages from the internet. You will need to switch to the root account in order to get sudo installed.

Packages to install:

  • sudo - allows you to run commands as root
  • nano - a simple and easy to use text editor
  • portupgrade - makes updating packages fun and easy
  • portsnap - makes updating your ports tree a snap
  • cvsup-without-gui - used for fetching source code
  • portaudit - monitors installed packages for known secutity issues

Update the ports collection

cvsup -h cvsup4.freebsd.org /usr/share/examples/cvsup/ports-supfile

Update the source

cvsup -h cvsup4.freebsd.org /usr/share/examples/cvsup/stable-supfile

Compiler Optimizations

cp /etc/defaults/make.conf /etc/make.conf

Configure your kernel

CFLAGS= -O -pipe

uncomment cvsup sections KERNCONF=whatever make world && make kernel && mergemaster

ports - make install clean

  • links - text based web browser
  • mutt - text based email client supports imap and Maildir
  • screen - allows multiple ‘virtual’ shells through one connection

By default the syslog dameon opens a port to allow for remote log reporting. We dont want or need that so we’re gonna turn it off. Add the following line in your /etc/rc.conf file:

syslogd_flags="-ss"

Reduce number of getty instances, since we wont be using the termial much

nano /etc/ttys