In this tutorial, we will learn how to install FreeBSD with XFCE Desktop Environment on bare metal, get the latest official NVIDIA drivers working on FreeBSD 13 as well as Linux binary compatibility support so you can run Linux applications in FreeBSD.
The whole installation process can take up to two hours depending on how fast your internet connection is.
Unlike the prior FreeBSD with KDE Plasma 5 installation guide where we used the desktop-installer script to install and configure the system, this tutorial will show you how to perform the FreeBSD and XFCE installation and configuration manually.
To get FreeBSD with XFCE and NVIDIA Drivers up and running, the following system components will be installed and configured:
- FreeBSD 13
- Xorg
- XFCE4 and XFCE Goodies
- Dbus
- Lightdm and Lightdm GTK Greeter
- NVIDIA Drivers
- Linux binary compatibility
Here are the specs of the machine I will be using to install FreeBSD with XFCE in this tutorial:
- Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
- Gigabyte Z87X-UD3H Motherboard
- Samsung SSD 850 [500GB]
- 32 GB RAM
- 2x NVIDIA GeForce GTX 1070 GPUs
If you decide to install FreeBSD with XFCE on a virtual machine, you can follow this guide as well, the only difference being not having to install your GPU drivers.
Things you need:
- A USB flash drive of min 8GB
- A decent internet connection
- 2-3 hours of your time
- Coffee or tea.
Things to keep in mind:
- If your machine consists of multiple disks or operating systems, I recommend disconnecting all the disks other than the one you plan to install FreeBSD on.
- If for some reason you get stuck while trying to launch the graphical environment, e.g., black screen, use CTRL+ALT+F2 to get to the virtual terminal.
- You can always enable a new shell and switch between them using ALT+F2; ALT+F3, etc., and use your mouse middle-button to copy and paste text between shells.
- If you install FreeBSD on a virtual machine, Step 5 can be skipped.
- All commands issued in this guide should be executed as root user.
And with that out of the way, let’s get busy.
STEP 1: Prepare the FreeBSD USB installer.
Head over to the official FreeBSD download page. On the Installer Images section, click the link accordingly to your machine architecture. Unless you’re using an ancient computer, your architecture most likely is amd64.
NOTE: If you prefer the pre-installed FreeBSD Virtual Machine Images or SD Card Images, you can go ahead and select and download the disk image accordingly.
Click on the largest .dvd1.iso file [e.g., FreeBSD-13.0-RELEASE-amd64.dvd1.iso] to download the FreeBSD 13 iso.
Next, head over to the Balena Etcher website and download the installer/app image for your operating system [it should be detected automatically]. Plugin the USB flash drive.
Install and run Etcher on your system and [1] Browse the FreeBSD image you download above; [2] Select your USB flash drive; and [3] Flash the FreeBSD image on your USB drive.
This process will likely take anywhere between 10-15 minutes.
Once the FreeBSD USB installer is done, reboot your system and hit F10 or F12 to launch the Boot Loader. Your USB should be listed as a boot device. Select it and press ENTER.
NOTE: In case you are unable to launch the Boot Loader, you can configure the boot device order in your Bios. Check your motherboard manual for instructions.
STEP 2: Launch FreeBSD installer
Once you manage to boot the FreeBSD USB installer you should be greeted by a Welcome to FreeBSD screen. Press 1, hit ENTER, or simply wait a few seconds for the FreeBSD installer to start.
On the FreeBSD Installer Welcome screen select Install and press ENTER.
On the Keymap Selection screen, choose your keyboard map. The default FreeBSD keymap is the US and I use an English keyboard so I will select Continue with the default keymap.
Set a Hostname for your system, e.g., freebsd.
On the Distribution Select screen, leave the default selection and press OK.

Next, we will proceed with disk partitioning. Here you can choose Auto (ZFS), Auto (UFS), Manual, or Shell for the more advanced users.
I have only one disk in my system and I am a sucker for ZFS so I will choose Auto (ZFS) – Guided Root-on-ZFS partitioning.
On the ZFS Configuration window, you can choose additional ZFS configuration options such as encryption, swap size, partition scheme, etc. Unless you know what you’re doing, leave the defaults and select the Install – Proceed with Installation option.
Choose Stripe – No Redundancy. If you want disk redundancy, you can configure the Mirror/Raid redundancy here.

Select the disk to install FreeBSD. This is an important step as all the existing data on the disk you select here will be wiped out.
Select Yes to confirm the installation on the given disk.
The FreeBSD installer will now proceed with installing and setting up the FreeBSD system on your disk. This takes less than one minute on an SSD disk.
Next, you will be prompted to type a password for your root account. Make sure you type a strong password but most importantly, make sure you remember it.
Now is time to configure your network settings.
I am using a LAN connection but if you’re looking for wifi, I highly recommend you the EDUP EP-AC1607 802.11ac USB Wireless adapter which I tested and works out of the box on FreeBSD 13 as well as the previous FreeBSD versions. The link above is NOT an affiliate nor sponsored link.
FreeBSD will now proceed to configure the IPv4 settings for your network interface.
Next, FreeBSD will look for a DHCP server and configure the network interface accordingly.
If you are not using IPv6, choose No when prompted to configure the IPv6 for your network interface.
Here are the settings detected for my system. Your DNS settings may differ.
On the Time Zone Selector window, choose your region.
Next, choose your country within the region you selected above.
Check if the date was detected correctly by the FreeBSD installer. If your computer is not connected to the internet, you may have to set the date manually.
Check if the time is detected correctly by the FreeBSD installer. If you are not connected to the Internet, proceed setting the time manually.
On the System Configuration window, choose the services you would like to start at boot. If you don’t know what to select here, leave the defaults.
On the System Hardening window, you can take extra steps to secure your system. I usually select options 5 to 10 for a good security balance on my FreeBSD systems.

Next, select Yes to proceed to add a user account to your FreeBSD system.
The FreeBSD installer will prompt you step-by-step to input the new user information. For most prompts, the default setting is sufficient therefore you will just press ENTER.
Here is a table containing each prompt as well as the action you need to take.
Prompt | Action |
Username: | Type your desired username |
Full Name: | Type your name |
UID: | [ENTER] |
Login Group: | [ENTER] |
Login Group is <username> | wheel video operator |
Login Class [Default]: | [ENTER] |
Shell (sh csh tcsh nologin) [sh] | [ENTER] to choose the sh shell. |
Home directory [/home/<username>] | [ENTER] |
Home directory permissions: | [ENTER] |
Your password-based authentication? | [ENTER] |
Use an empty password? [no] | [ENTER] |
Use a random password? [no] | [ENTER] |
Enter password: | Type the password for your user |
Enter password again: | Confirm the password for your user |
Lock out the account after creation? [no] | [ENTER] |
… | |
OK? (yes/no) | [ENTER] |
Add another user? (yes/no) | Type no in case you don’t want to add an additional user. Yes otherwise |
On the Final Configuration window, you can review all the configuration choices you made so far – if needed. Choose OK when finished.
In case you want to perform more advanced configurations for your system, you can choose to open a shell here. Alternatively, choose No to finish the FreeBSD installation.
At this point, the FreeBSD installation is completed. Reboot the system and remove the USB flash drive from your computer.
If you are welcomed by a login prompt once the system rebooted: congratulations! You successfully installed FreeBSD on your machine.
Log in as the root user.
STEP 3: Update FreeBSD
To make sure our FreeBSD system is up to date, type the following command in the terminal
freebsd-update fetch && freebsd-update install
Where:
Command | Description |
freebsd-update fetch | Checks the system and download the appropriate updates |
freebsd-update install | Install the files downloaded with the above command |
When prompted with the list of files to be added as part of the update, press the Q key twice.
STEP 4: Install XFCE on FreeBSD
Alright. Is time to install the XFCE Desktop Environment on FreeBSD. XFCE requires a few additional components where the most critical is the display server Xorg.
Execute the following command in the terminal:
pkg install xorg xfce xfce4-goodies lightdm lightdm-gtk-greeter dbus
Where:
Package | Description |
xorg | X display server [mandatory] |
xfce | XForms Common Environment |
xfce4-goodies | Additional artwork and applications that are related to the Xfce desktop |
lightdm | Display manager |
lightdm-gtk-greeter | A highly configurable login screen inspired by the classic GDM |
dbus | Provides one-to-one communication between any two applications |
This step will take a while to complete, depending on how fast your internet speed is. You will not be prompted for any action so feel free to take a well-deserved break. Give it ~45 minutes.
STEP 5: Install NVIDIA drivers on FreeBSD.
Installing the NVIDIA drivers on FreeBSD is pretty straightforward. In fact, it is arguably easier than on other operating systems.
Optional: to search the available NVIDIA drivers on FreeBSD, use the following command:
pkg search nvidia
To install the latest proprietary NVIDIA driver on FreeBSD execute the command below:
pkg install nvidia-driver nvidia-xconfig
Type y [ENTER] when prompted.
Execute the following command to load the NVIDIA driver in at boot:
sysrc kld_list+=nvidia-modeset
Load the NVIDIA driver now in the system so you won’t need to reboot the system:
kldload nvidia-modeset
Generate the X configuration file. This file will be located at /etc/X11/xorg.conf
nvidia-xconfig
Now, let’s test the X server on FreeBSD.
startx
If X starts successfully, you will see a screen like the one shown above. Next, test if the XFCE starts by executing the following line:
startxfce4
Voila. XFCE works!
If you encounter any errors when trying to start X, e.g., Fatal server error / No screens found (EE) errors, the X server is most likely confused about which GPU should use as you likely use more than one GPU in your system. Here is how to fix the No screen found error on FreeBSD.
STEP 6: Configure Greeter and LightDM
Greeter is basically the user interface that allows you to type your credentials, allows you to select a session, or choose between various desktop environments installed on your system.
To configure Greeter in LightDM we need to edit the lightdm.conf file using the following command:
ee /usr/local/etc/lightdm/lightdm.conf
Look for the following line: greeter-session = Session to load for greeter. Add the following line underneath:
greeter-session = lightdm-gtk-greeter
Save and exit the file by typing the ESC key and pressing twice the letter a.
Next, let’s instruct FreeBSD to start LightDM at boot. Edit rc.conf as before using the following command:
ee /etc/rc.conf
Add the following line at the bottom of the file:
lightdm_enable=”YES”
Save and exit the file by pressing ESC and twice the a key.
And finally, let’s test LightDM on our machine:
service lightdm onestart
At this point, you should be able to boot your system into XFCE using the LightDM desktop manager. I advise you not to reboot yet, instead use CTRL+ALT+F2 to switch to virtual terminal and continue with the remaining steps as there are still some important things left to configure.
STEP 7: Set Linux binary compatibility in FreeBSD
Linux binary compatibility, also known as Linuxulator, is a mechanism that allows you to run unmodified Linux binaries under FreeBSD.
To enable Linuxulator in FreeBSD execute the following commands in the terminal:
kldload linux
kldload linux64
To make this change permanent on reboot, we need to edit the /etc/rc.conf using the following command:
ee /etc/rc.conf
Add linux_enable=”YES” at the bottom of the file.
To save and exit ee, press the ESC key, type the a key to leave the editor, and again press a to save the changes.
Install the Linux subsystem inside FreeBSD consisting of a set of packages sourced from CentOS 7 using the following command:
pkg install linux_base-c7
Pay attention to the message on the screen once the linux_base-c7 package is installed.
We need to edit /etc/fstab and add the lines highlighted in red above.
Edit the /etc/fstab file using the following command:
ee /etc/fstab
Add the following lines at the bottom of the file:
linprocfs /compat/linux/proc linprocfs rw 0 0
linsysfs /compat/linux/sys linsysfs rw 0 0
tmpfs /compat/linux/dev/shm tmpfs rw, mode=1777 0 0
Press ESC and press the “a” key twice to save and exit the file.
Next, we need to mount the linprocfs, linsysfs, and tmpfs by executing the commands below. Alternatively, you can reboot the system and FreeBSD will take care of that.
mount /compat/linux/proc
mount /compat/linux/sys
mount /compat/linux/dev/shm
STEP 8: Reboot FreeBSD to XFCE
That’s it! We are ready to boot the system to XFCE and enjoy FreeBSD with a Desktop Environment. To gracefully reboot FreeBSD, type the following command in the terminal:
shutdown -r now
If all is well, you should be greeted by the LightDM login screen and be able to boot into XFCE once you logged in. From here on, the sky’s the limit. And the sky on FreeBSD is pretty high.
READ NEXT: How To Install a GUI Package Manager in FreeBSD [OctoPkg].
Wrapping Up
In this guide, we learned how to manually install FreeBSD with XFCE, install the latest NVIDIA drivers on FreeBSD, enable Linux binaries as well as do all the necessary configurations to get XFCE running on FreeBSD.
The whole installation process may seem complex at first but once you go through the guide once or twice, the whole thing starts to make sense.
If you are looking for other great ways to customize your FreeBSD system, as well as a lot of other useful FreeBSD tips and tricks, I highly recommend you have a look at Vermaden’s blog.
I hope you found this guide useful. See you next time.
Stay safe!
