Published : 2013-01-07

FreeBSD installation

FreeBSD is an excellent free operating system. The only downsides are the limited commercial support compared to Linux, and its lower visibility. It is a great operating system, extremely stable like every BSD, focused on performance.

The main thing to know about FreeBSD is compilation. The system is designed to be stable and finely tuned, by picking which options to add to binaries. Once you have a working FreeBSD system, unless you need new features, you only need to update it to patch security issues.

This article walks you through installing FreeBSD. We will use a VM with an 8 GB disk, 1 CPU, and 512 MB of RAM. Insert the CD and boot from it.

Boot

Capture du 2013-01-07 22:25:33You can press Enter to boot immediately.

Capture du 2013-01-07 22:27:39The installer offers to install, open a shell, or use the live CD. The last two are useful for repairing other FreeBSD systems. Pick Install.

Keyboard

Capture du 2013-01-07 22:27:49We will now configure the keyboard.

Capture du 2013-01-07 22:28:01We are using a French AZERTY keyboard with accents — that layout is perfect.

Hostname

Capture du 2013-01-07 22:28:27Configure the hostname (FQDN notation) of the machine here.

Distributions

Capture du 2013-01-07 22:28:42You are then offered to install several optional parts of the distribution: documentation, games, 32-bit libraries (if you have 32-bit binaries), the ports tree built into the ISO you downloaded, and the sources backing that ISO. I do not recommend pulling the ports tree from the CD; rather extract it once the installation is done with portsnap.

Here we uncheck everything and validate.

Partitioning

Capture du 2013-01-07 22:28:50Now comes the formatting step. FreeBSD lets you be guided, do it manually, or open a shell to handle it yourself. The last option is useful, for instance, if you want your / partition on ZFS (which is a bit tricky). Pick Guided.

Capture du 2013-01-07 22:28:57Choose between the whole disk or a single partition. Pick Entire Disk.

Capture du 2013-01-07 22:29:16FreeBSD uses GPT partitions (just like Mac OS X, which sits on top of FreeBSD’s Mach microkernel layer). More documentation on GPT is available here.

By default, FreeBSD suggests putting everything in the / partition. That choice is debatable for some setups, but on this system there is little point separating /usr, /var, and /: ports install under /usr/local and keep most of their data there. If you wish, you can create a second /usr/local partition.

FreeBSD uses the UFS2 filesystem, known for being very stable albeit a bit slow. Since FreeBSD 9.0, UFS2 supports journaling (UFS2+J), which avoids very long fsck runs at boot.

Capture du 2013-01-07 22:29:27Once your partition table is set up, pick Finish, then Commit.

Note: the red letter is the keyboard shortcut that activates the option.

Installation

Capture du 2013-01-07 22:29:36The distribution then installs. The system first checks the checksum of each .txz before installing it. If the checksum fails, the component is not installed.

Configuration

Capture du 2013-01-07 22:30:48You exit the dialog to reach a shell prompt that runs the passwd command for the root user.

Capture du 2013-01-07 22:30:58You are then asked to configure networking. Pick the network interface you want to use.

Capture du 2013-01-07 22:31:06You can choose IPv4 only, IPv6 only, or both. After validating IPv4, you will be asked whether to use DHCP. Here we choose no.

Capture du 2013-01-07 22:31:36Enter the IP address, mask, and router, then validate.

Capture du 2013-01-07 22:31:48You are then asked whether to configure IPv6. Here we will not. Otherwise you will be asked to use router discovery or pick a static address.

Capture du 2013-01-07 22:32:04You can then configure the DNS servers and the search domain.

Capture du 2013-01-07 22:32:15You are then asked to configure the timezone. As usual I pick No at this question, then pick the timezone; for France, Europe then France. In winter you will be asked whether CET is fine. In summer it will be CEST.

Capture du 2013-01-07 22:32:36You can now enable a few services. We only enable SSH, but you can also pick moused to get a console mouse, the NTP server to keep time in sync (very important), and powerd to save CPU.

Capture du 2013-01-07 22:32:48You are then asked whether to enable crash dumps. Up to you — personally I don’t use them.

Capture du 2013-01-07 22:32:57You can now add users to the system.

Capture du 2013-01-07 22:33:37Fill in the various fields and validate. Note that on BSD, a user MUST be in the wheel group to use the su command.

End of Installation

Capture du 2013-01-07 22:33:51Installation and configuration are done. You can reconfigure anything you got wrong, otherwise pick Exit.

Capture du 2013-01-07 22:34:03You are offered once more to open a shell if you need to do something specific. Pick No, then Reboot.

The installation is now finished!

Conclusion

You now have a FreeBSD system in your hands. The three key things to remember about FreeBSD are:

  • System configuration and service activation (with flags) is based on the file /etc/rc.conf.
  • You must use the ports tree (portsnap to fetch and extract it).
  • System updates use the freebsd-update command.

I strongly recommend reading the FreeBSD handbook, which is clear and covers all system administration topics in detail. It is also worth noting that migrating a FreeBSD installation does not break the system or third-party applications, unlike some Linux systems that don’t always upgrade smoothly.