In this guide, we are going to install FreeBSD on VirtualBox. You will also be able to install KDE, GNOME, or XFCE desktop environments at your choice by following a step-by-step guide [with pictures].
Let’s get to work.
- Step 1: Download and Install VirtualBox.
- Step 2: Download FreeBSD image
- Step 3: Setup VirtualBox
- Step 4: Install FreeBSD
- Disk Partitioning
- Setting The ROOT Password
- Network Configuration
- System Configuration
- Add User Accounts
- Final Configuration
- Step 5: Update FreeBSD
- Step 6: Install A Desktop Environment in FreeBSD
Step 1: Download and Install VirtualBox.
Head over to the VirtualBox Download page and click to download the VirtualBox package for your operating System.
Once the download is completed, install VirtualBox and launch the application.
Step 2: Download FreeBSD image
In this guide, we will be using the RELEASE branch. At the time of writing this guide, the latest stable release is FREEBSD 12.2-RELEASE. The same installation procedure works for any new releases in case you read this guide in the future.
Head over to The Free BSD Download page. Under the release section, click on the amd64.
Next, click on FreeBSD-12.2-RELEASE-amd64-dvd1.iso to start downloading the installation .iso.
The download might take a while, depending on your Internet speed.
In the meantime, continue with the next step.
Step 3: Setup VirtualBox
First, we will need to create a new virtual machine. On VirtualBox, click on New.
Give a name to your new virtual machine. I will call mine FreeBSD. Click Next.
Next, allocate the amount of RAM for this virtual machine.
If you plan not to install any graphical desktop environment, the default 2 GB RAM is enough. However, if you want to install KDE, Gnome, or XFCE, I suggest you allocate a minimum of 4 GB RAM. Click Next.
On the Hard Disk window, leave the default settings and click Next.
On the Hard disk file type window, leave the defaults and click Next.
On the Storage on physical hard disk window, leave the defaults and click Next.
On the File location and size window, increase the size to a more decent value – depending on what you plan to do with this virtual machine.
I will give mine 15GB.
Click Create to finish the virtual box setup process.
Now, click on the Settings button on top of the VirtualBox window.
Click on the System and select the Processor(s) tab. Allocate 2 CPUs for your FreeBSD virtual machine.
Note that this step is not mandatory. However, if you want your FreeBSD virtual machine not to take forever to boot, I highly suggest you allocate at least 2 CPUs.
Next, click on Display, and move the slider for Video Memory to the max.
Click on Storage, select Empty. Click on the little CD-like icon next to the Optical Drive and select Chose a disk file…
Browse to the location where you downloaded the FreeBSD iso image, and select it.
To start your virtual machine, click the Start button on the top of the VirtualBox window.
Step 4: Install FreeBSD
If everything goes well, you should be greeted with the FreeBSD installation Welcome screen.
On the FreeBSD installer screen, select Install.
On the Keymap Selection, use the arrow keys to select your keyboard layout [Enter]. I am using a US keyboard, so that I will choose the United States of America keymap. Once you set your keymap, click on Continue with <your keymap> then [Enter].
In the Set Hostname window, type your wanted hostname and choose OK [Enter].
Choose the optional system components to install in the Distribution Select window, such as 32-bit libraries, ports, system resource tree, System & kernel debugging, and test suite. Let’s select the 32-bit support, ports, and source tree for this install.
In the Partitioning window, we have four options:
- Auto (UFS) – Guided Disk Setup will automatically format your disk using the Unix File System.
- Manual – Manual Disk Setup (experts) will allow you to partition your disk manually using a GUI interface. This option assumes that you already know what you’re doing.
- Shell – Open a shell and partition by hand. Again, this implies you are a noob at manual partitioning, and you know what you are doing.
- Auto (ZFS) – Guided Root-on-ZFS if you want to use pooled Storage via multiple discs. You can read more about the Z File System (ZFS) in this excellent post.
Let’s keep things exciting and select the last option: Auto (ZFS) – Guided Root-on-ZFS [Enter].
On the ZFS Configuration window, you can increase the Swap Size and enable Disk Encryption if you need it. I will proceed with the defaults. Select >>> Install [Enter].
You can configure mirroring or RAID on the ZFS Configuration (Virtual Device type) window if you use multiple disks. We use only one disk; therefore, we will select Stripe – No Redundancy for this install. Select OK [Enter] to continue.
Select the disk you want to install FreeBSD. Most likely, you will have only one disk option here. Choose it and click OK [Enter]
You will be warned that this is the Last Chance to review your settings before proceeding with disk partitioning. Since this is a brand new virtual machine, we don’t have to be afraid of losing our disk data. Go ahead and choose YES [Enter].
The FreeBSD installer will proceed with disk partitioning and system installation.
Setting The ROOT Password
You will be prompted to type a password for the system management account (root). Please choose a password and retype it to confirm.
On the Network Configuration window, select which network your interface wants to use. Most likely, you will have your virtual network adaptor listed here. Select Yes [Enter] when asked to configure the IPv4 interface.
Select Yes [Enter] to configure the DHCP settings for your interface.
If you don’t plan to use the IPv6 interface, No [Enter].
The FreeBSD Resolver Configuration will automatically set up the network interface with the appropriate IPv4/DNS settings. Click OK [Enter]
On the Time Zone Selector, choose your region, country, and city. Click OK [Enter].
Skip [Enter] the Time & Date configuration as we will set up this later.
On the System Configuration, choose which services you prefer to start at boot or leave the defaults – you can change this later. Click OK [Enter].
In the System Hardening window, you can select additional security options to reduce any system vulnerabilities. This is a virtual machine, so I will harden might system lightly but feel free to choose all hardening settings if you plan to use this VM for more than testing. Click OK [Enter].
Add User Accounts
Next, we are asked to add a new user to our System.
Select Yes [Enter] when prompted.
Here, we only need to fill a few fields – marked with bold text below. For the rest, you can leave the defaults by just pushing the [Enter] key.
Username: <your username>
Full name: <your full name>
UID (Leave empty for default): [Enter]
Login group: [Enter]
Login group is <xyz>. Invite <xyz> into other groups? [ y]: wheel
Login class [default]: [Enter]
Shell (sh csh tcsh nologin) [sh]: [Enter]
Home directory [/home/<xyz>]: [Enter]
Home directory permissions: [Enter]
Yous password-based authentication? [Yes]: [Enter]
Use and empty password? [no]: [Enter]
Use a random password? [no]: [Enter]
Enter password: <enter your user password>
Enter password again: <confirm your password>
Lockout the account after creation? [no]: [Enter]
OK? (yes/no): Yes
Add another user? (yes/no): No
FreeBSD – Create new user
On the Final Confirmation window, review your settings and select OK [Enter] to complete the installation.
Chose No [Enter] in the Manual Configuration window when prompted to do additional changes via shell.
Your FreeBSD installation in VirtualBox is now completed. Click Reboot when prompted and remove the FreeBSD disk from the virtual machine.
Your VirtualBox FreeBSD installation is now completed.
Once you rebooted your FreeBSD VM, you will be greeted with a command prompt login and no graphical interface. This is perfectly normal in FreeBSD.
Login using your root account and password you set up during the installation.
Step 5: Update FreeBSD
The first thing we need to do is to update the freshly installed FreeBSD system.
First, let’s inspect the FreeBSD system and fetch the necessary updates by using the following command:
A list with files to be updated will be shown in the terminal. Press the [Enter] key until you reach the list’s bottom and press the q key to quit the list.
To update the FreeBSD system, use the following command:
Once the above commands are executed, the FreeBSD is up-to-date.
Step 6: Install A Desktop Environment in FreeBSD
However, unless you want to play with the command prompt only, I suggest installing a desktop environment such as KDE, GNOME, or XFCE and explore FreeBSD’s full potential.
I covered the FreeBSD desktop environment in detail in the following guides. If you decided which desktop environment you want to use on your FreeBSD virtual machine, follow the installation guides for FreeBSD with KDE, GNOME, or XFCE bellow:
- How To Install FreeBSD with KDE Plasma 5
- How To Install FreeBSD with GNOME Desktop
- How To Install FreeBSD with XFCE 4
- How To Install FreeBSD On Parallels Desktop
If you have any questions or suggestions on improving this article, drop me a comment below. I hope you will enjoy your newly installed FreeBSD system as much as I do. 🙂