in FreeBSD, UNIX

This article is a part of a series on FreeBSD, the BSD operating system derived from Unix®. Check out the whole series on the dedicated FreeBSD page for more tutorials and tips on FreeBSD.

Installing FreeBSD for the first time can be daunting if you’ve never encountered an installer like bsdinstall (the name of FreeBSD’s installer program). Have no fear, however, as the process is easier than it seems. In this guide, we’ll walk through every single step of a standard FreeBSD installation. If you’re familiar with a BSD-like Linux OS such as Slackware, this install should be a breeze.

Contents:

  1. Getting a FreeBSD installer
  2. Installing FreeBSD

This installation is oriented towards desktop use for an average user, and as such won’t include elements such as system hardening or what specific services do, which you probably won’t need to worry about if you’re hiding behind a residential firewall or are just starting to learn how to use a Unix® operating system.


Part I: Getting the install media

Our first task is to grab a copy of FreeBSD’s installation media. If you’re old school and like to buy a physical copy of your OS installers, you can head over to the FreeBSD Mall and order a CD or DVD copy. If you’re firmly within the 21st century, however, you can download the install media from FreeBSD’s download page.

FreeBSD 11.1 downloads list

Figure 1: The list of FreeBSD images at the time of this post.

On the FreeBSD download page, you’re presented with a list of architectures (fig 1). Which architecture’s image you want to download depends on what system you’re going to be installing FreeBSD on. Most new systems will use the amd64 image. If it’s a considerably old Intel machine, you’ll probably want the i386 image. One of the powerpc images are required to run on New World ROM and pre-Intel Macintosh hardware.

Picking your install medium

FreeBSD's AMD64 images

Figure 2: FreeBSD’s AMD64 images for FreeBSD 11.1.

Which image you want depends on what medium you plan on using to install FreeBSD. The DVD and Disc installers can still be used via memory stick, but you’ll need a higher capacity stick to use them.

  • The bootonly.iso installer is the smallest installer. This installer will download all of the files it needs during the installation process, so an Internet connection is required. This version should be burned to a CD.
  • The mini-memstick.img installer is the same as the bootonly.iso installer, only for memory sticks instead of CDs. Use it if you have an Internet connection to the computer you wish to install FreeBSD on, but a low capacity memory stick. This installer will require around 400 megabytes of space.
  • The memstick.img installer includes everything that you might need to install and run FreeBSD. Use it if you have a memory stick that has at least a gigabyte of space.
  • The disc1.iso installer is the same as the memstick.imginstaller, only designed to be burned to a CD. Use it if you don’t have a memory stick, and plan on using CDs or DVDs.
  • Finally, the dvd1.iso installer includes everything within the previous two installers, as well as additional files to install some third-party applications. You’ll need at least 4 gigabytes of space on your install medium to use this installer.

All of the above media, except for dvd1.iso, will require an Internet connection to install additional applications that aren’t a part of FreeBSD’s core. You should choose the installer that’s most applicable to how you intend on installing FreeBSD. If you’re just going to be running FreeBSD in a virtual machine, you can use any of them, but I would personally recommend using bootonly.iso due to its small size, and the presumption that you’ll have an Internet connection on a system with VMs.

Anything that isn’t included in the installer that you choose is available later on, either during the install itself or afterwards, so don’t worry about potentially missing out on some features by choosing a smaller installer.

I will be using the bootonly.iso image for the purpose of this tutorial, as VirtualBox does not support mounting .img files, but I won’t cover how to burn the install media to a disc. Part II deals exclusively with memory stick images. Skip to Part III if you’re using a CD or DVD.


Part II: Creating a bootable installer

There’s a lot of ways to go about creating a bootable installer, but I’m going to stick to the two methods recommended by the FreeBSD documentation: dd and Win32 Disk Imager. Before performing either of the following steps, take note that any data on your memory stick will be destroyed. Back up your data!

Note: The section on dd is coming soon. In the mean time, follow the FreeBSD documentation linked above for instructions on how to use it to create a bootable memory stick on a Unix-like platform.

Using Win32 Disk Imager on Windows

Download Win32 Disk Imager from the SourceForge site and install it on your system. Once it’s installed, run it, then click the blue folder icon highlight in figure 3. Using the prompt that opens, navigate to and open your installer image. You should see the file address in the text area next to the blue folder icon.

Win32 Disk Imager's blue folder icon

Figure 3: Win32 Disk Imager’s blue folder icon

Next, select your memory stick’s drive letter in the Drive menu. Now you click the write button to write the installer image to your memory stick. Once that’s done, you’ll have a bootable FreeBSD installer.


Part III: Installing FreeBSD with bsdinstall

Now that you have a bootable installer, go ahead and boot from it. You’ll be greeted by the FreeBSD bootloader – a small menu surrounded by ASCII art. Hit enter, or wait for the ten second timer to lapse, to boot into multi user mode so that we can install FreeBSD. Don’t worry about the other boot options; in most circumstances, you won’t need them. Once the boot process is complete, you’ll be greeted by bsdinstall (figure 4).

BSDinstall's initial screen

Figure 4: The FreeBSD installer’s initial screen.

Since we’re installing it, selecting install makes the most sense. Hit enter to proceed (this applies to every screen of the installer). You’ll be presented with a list of keymaps – you should choose the one that matches your keyboard. Use your up and down arrow keys to select a keymap and the enter key to proceed. If you’re not sure what keymap you have, picking the ISO variant for your country of residence is a sound decision.

The next thing you’ll have to set is your system’s hostname. I personally set my system hostnames to something along the lines of mypcname.rauchland.co.il. You should use a fully qualified domain name – meaning it should be an actual domain, not just a one word name. For the purpose of this tutorial, it doesn’t have to be one that you actually own, or point to a real site. After you’ve set your hostname, you’ll be presented by a list of optional system components (figure 5). You don’t need to select any of these, so hit enter again.

Selecting optional system components

Figure 5: Selecting optional system components.

Networking

If you’re not using an installer that must download files, such as dvd1.iso, skip to Formatting with ZFS below. Return to this section after completing it.

If you’re using an image that requires a network connection to download the rest of the system, your next screen will inform you that additional installation files must be downloaded from the Internet. Hit enter, and you’ll be presented with a list of network interfaces in your system. Select your primary interface (I chose em0 when doing this in VirtualBox) and you’ll be asked if you would like to configure IPv4. Select yes, and you’ll be asked if you would like to use DHCP. Unless you have a reason not to, select yes again. You’ll then be asked if you wish to configure IPv6, which I don’t – because my ISP currently doesn’t support IPv6. You’ll be presented with DNS configuration next (figure 6), which you can leave as the default, but I tend to set everything up to use OpenDNS, using their IPs .

DNS Configuration

Figure 6: DNS configuration.

If you’re using one of the installer-only images, you’ll be prompted to select a mirror. This is where the distribution files required to install FreeBSD will be downloaded from. I personally just use the main site mirror (ftp://ftp.freebsd.org), but you should choose the mirror closest to you if you have a slow Internet connection.

Formatting with ZFS

If you’re using an installer that must download files, such as bootonly.iso, return to Networking above. Return to this section after completing it.

Next, you’ll be provided with a list of disk partitioning methods. We are going to use Auto (ZFS) - Guided Root-on-ZFS for this installation. If you have significantly old hardware with very little RAM, the ZFS file system might not be appropriate, but we won’t be covering that in this tutorial. Use the arrow keys to reach it in the list, then hit enter. You’ll be provided with a list of configuration options (figure 7). You don’t need to know what most of these are, because we’re only concerned with T: Pool Type/Disks for the purposes of this tutorial. Navigate to it and hit enter.

Figure 7: The Guided Root-on-ZFS configuration options screen

Figure 7: The Guided Root-on-ZFS configuration options screen

You’ll be presented with a list of virtual device types. Unless you plan on installing FreeBSD to multiple disks, you will want Stripe - No Redundancy. Select it and press enter. The next screen will be a list of disks that have been detected by FreeBSD. Move through the list to the disk you wish to install FreeBSD to, then hit space to select it. Since I’m installing this in a VirtualBox VM, my disk is ada0 - VBOX HARDDISK. The disk you select here will be wiped clean. All data will be lost. Make sure you select the correct disk!

After selecting your disk and moving to the next window, you should be returned to the ZFS configuration screen. Pool Type/Disks should now say stripe: 1 disk. If it doesn’t go back through the previous steps and make sure you select a disk. If it does, go up to >>> Install and proceed. You’ll be given a final warning about destroying the data on the disk you have selected. Proceed, and you’ll be taken to a screen (or series of, if you are using an installer that must download files) that shows the current progress of the installation, as you can see in figure 8.

Figure 8: Downloaded FreeBSD files extracting from file archives.

Figure 8: Downloaded FreeBSD files extracting from file archives.

Final steps

Once this process is completed, you will be prompted for a root password. root is FreeBSD’s main system administration account. You won’t be using it 99.99% of the time, as you will have your own account. You can use any password you want, but it should be something secure that is easy to remember. The root password should not be the same as a password that will be used for a user account. Changing the root password after you have forgotten it is a pain, so make sure what you choose is easy! Write it down somewhere handy if you must.

After you’ve selected a root password, you’ll be directed to the timezone options. Use your arrow keys – or the numbers next to the names – to pick your region and your country. FreeBSD will then prompt you to confirm that your timezone abbreviation is correct – in the UK, GMT during winter and BST during summer are correct. Then you’ll be asked to set the current date and time, which should be correct by default.

Following this, you’ll be able to select what services are started at system boot. I enable local_unbound, sshd, ntpd, powerddumpdev, but you can enable any that you wish to. On the next screen, you’ll be asked to choose some system hardening options. For a residential system hiding behind a router firewall, you won’t need any of them. Go ahead and move to the next screen.

You’ll be asked if you want to add new users to the system – which you do. Select yes, and you’ll be dropped into a shell. Follow the on-screen prompts to create your user account. This is the account you’ll use to log in. When asked if you want to invite [username] into other groups?, enter wheel to gain administrator permissions on your new account. Apart from that, you can select what you wish. You can see my input in figure 9, below.

Figure 9: Creating my user account

Figure 9: Creating my user account.

If you have other users that need accounts, enter yes and go through the process again to make them. The process is identical, no matter how many times you repeat it. Otherwise, enter no. You’ll be returned to the installer, and shown the final configuration page. Unless there is a step you’ve missed during this process, you can exit the installer.

Hit no on the manual configuration prompt, then reboot your system. Remove the install media and you’ll boot into your brand new FreeBSD install!

Part IV: Final points on installing FreeBSD

Hopefully this process was a breeze for you. If this was your first time installing FreeBSD, or any Unix® or Unix®-like operating system, congratulations! You’re officially a member of the club. More FreeBSD tutorials and articles are on their way! Setting up and running the software required to have a desktop experience is next up. If you’re interested in running a website on your new FreeBSD machine, Brian at Sporkeheheh has a great article on installing WordPress on FreeBSD. If you have any suggestions on how to improve this article, or if you had any problems completing it, please leave them in the comment area below.

If you enjoy my blog or find it useful, please consider becoming a patron on Patreon to help me keep my site live and create more content!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.