Install FreeBSD with XFCE and NVIDIA Drivers [2021]

By Leonard Cucos •  Updated: 10/29/21 •  13 min read

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:

Here are the specs of the machine I will be using to install FreeBSD with XFCE in this tutorial:

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:

Things to keep in mind:

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.   

Download FreeBSD. Source:

Click on the largest .dvd1.iso file [e.g., FreeBSD-13.0-RELEASE-amd64.dvd1.iso] to download the FreeBSD 13 iso.

Download FreeBSD iso. Source:

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.

Download Etcher. Source:

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.

Install FreeBSD from USB. Source:

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.

Install FreeBSD from USB - Boot Loader. Source:

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.

Install FreeBSD with XFCE - Welcome. Source:

On the FreeBSD Installer Welcome screen select Install and press ENTER.

Install FreeBSD Welcome screen. Source:

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.

Install FreeBSD - Keymap Selection. Source:

Set a Hostname for your system, e.g., freebsd.

Install FreeBSD - Set hostname. Source:

On the Distribution Select screen, leave the default selection and press OK.

Install FreeBSD - Distribution Select. Source:

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.

Install FreeBSD - Partitioning. Source:

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.

Install FreeBSD - ZFS Configuration. Source:

Choose Stripe – No Redundancy. If you want disk redundancy, you can configure the Mirror/Raid redundancy here.

Install FreeBSD - ZFS Configuration Virtual Device. Source:

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.

Install FreeBSD - ZFS Configuration Disk Selection. Source:

Select Yes to confirm the installation on the given disk. 

Install FreeBSD - ZFS Configuration Last Chance Warning. Source:

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.

Install FreeBSD - Archive Extraction. Source:

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. 

Install FreeBSD with XFCE - Set Root Password. Source:

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.

Install FreeBSD with XFCE - Set Root Password. Source:

FreeBSD will now proceed to configure the IPv4 settings for your network interface.

Install FreeBSD with XFCE - Network Configuration IPv4. Source:

Next, FreeBSD will look for a DHCP server and configure the network interface accordingly.

Install FreeBSD with XFCE - Network Configuration DHCP. Source:

If you are not using IPv6, choose No when prompted to configure the IPv6 for your network interface.

Install FreeBSD with XFCE - Network Configuration IPv6. Source:

Here are the settings detected for my system. Your DNS settings may differ.

Install FreeBSD with XFCE - Resolver Configuration. Source:

On the Time Zone Selector window, choose your region.

Install FreeBSD with XFCE - Time Zone Selector. Source:

Next, choose your country within the region you selected above.

Install FreeBSD with XFCE - Set Country. Source:

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.

Install FreeBSD with XFCE - Set Date. Source:

Check if the time is detected correctly by the FreeBSD installer. If you are not connected to the Internet, proceed setting the time manually.

Install FreeBSD with XFCE - Set Time. Source:

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.

Install FreeBSD with XFCE - System Configuration. Source:

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.

Install FreeBSD with XFCE - System Hardening. Source:

Next, select Yes to proceed to add a user account to your FreeBSD system.

Install FreeBSD with XFCE - Add User Account. Source:

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.

Username:Type your desired username
Full Name:Type your name
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
Install FreeBSD with XFCE - Set Up User Account. Source:

On the Final Configuration window, you can review all the configuration choices you made so far – if needed. Choose OK when finished.

Install FreeBSD with XFCE - Final Configuration. Source:

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.

Install FreeBSD with XFCE - Manual Configuration. Source:

At this point, the FreeBSD installation is completed. Reboot the system and remove the USB flash drive from your computer.

Install FreeBSD with XFCE - Installation Completed. Source:

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.

Log in FreeBSD. Source:
Install FreeBSD with XFCE – Update System

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


freebsd-update fetchChecks the system and download the appropriate updates
freebsd-update installInstall 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.

Update FreeBSD. Source:

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


xorgX display server [mandatory]
xfceXForms Common Environment 
xfce4-goodiesAdditional artwork and applications that are related to the Xfce desktop
lightdmDisplay manager
lightdm-gtk-greeterA highly configurable login screen inspired by the classic GDM
dbusProvides 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


Now, let’s test the X server on FreeBSD.

Install FreeBSD with XFCE - start X. Source:

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:

Install FreeBSD with XFCE - Launch DE. Source:

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
Install FreeBSD with XFCE - LightDM Greeter Setup. Source:

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:


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
Install FreeBSD with XFCE - Login Screen. Source:

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.

Install FreeBSD with XFCE - Linux Binary Compatibility Configuration. Source:

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 FreeBSD with XFCE - Leave ee. Source:
Install FreeBSD with XFCE - Save ee. Source:

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.

Install linux_base-c7 FreeBSD. Source:

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
Install FreeBSD with XFCE - fstab. Source:

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!

Leonard Cucos

Leonard Cucos is an engineer with over 20 years of IT/Telco experience managing large UNIX/Linux-based server infrastructures, IP and Optics core networks, Information Security [red/blue], Data Science, and FinTech.