Install FreeBSD With XFCE Banner

How To Install FreeBSD with XFCE 4 [2021]

In this guide, we will look at how to install FreeBSD with XFCE 4 Desktop Environment. We will use a different installation method this time, but please feel free to follow the guide in the link above if you prefer the FreeBSD desktop-manager way. 

If you have not yet installed FreeBSD on your computer, follow Steps 1-4 on my FreeBSD installation guide. If you are a Mac user and would like to try FreeBSD, here’s a detailed guide on How to Install FreeBSD on Parallels Desktop. For Windows and Linux users, the process is straightforward using Virtual Box or VMWare.

If you already installed FreeBSD on your machine and look for an XFCE installation guide, continue reading.

Step 1: Update The System

Before doing anything, let’s make sure our system is up to date. First of all, log in as root:

su -

In the terminal, type one line at a time:

freebsd-update fetch

freebsd-update install

Step 1: Install NANO

We will require the NANO command line text editor to make a small change to our FreeBSD install. Don’t worry. We won’t do much file editing in this guide.

pkg install -y nano

Step 2: Install XORG Server

Before we proceed to install the XFCE desktop environment, we need to install the XORG server. 

If you’re not familiar with this, XORG is a free and open-source implementation of the X Window System developed by the X.ORG Foundation. Think of the XORG server as the base of the graphical environment on your machine. 

pkg install -y xorg 

Step 2: Install XFCE Server

Now, let’s install the XFCE desktop environment on our FreeBSD machine. Type the following command and grab a cup of coffee, as this might take a little while. 

pkg install -y xfce

Step 3: Install SLiM Login Manager

SLiM stands for “Simple Login Manager” and is a lightweight, easy-to-configure, modern-looking login manager. I like SLiM because it requires minimal dependencies, and none of these dependencies are sourced from heavier desktop environments such as KDE or Gnome.

pkg install -y slim slim-themes

Step 4: Configure Startup Services

To make FreeBSD execute our startup services at boot, traditionally, we had to edit /etc/rc.conf. But there is a much simpler way without editing the rc.conf file manually, and this method is advantageous when running multiple FreeBSD machines.

Note: The “rc” stands for “run commands.” This configuration file does what it says: run commands at boot time.

In the terminal, type each command one line at the time as root user:

sysrc dbus_enable=yes

sysrc hald_enable=yes

sysrc slim_enable=yes

sysrc sound_load=yes

sysrc snd_hda_load=yes

Explanation

  • DBUS and HAL (HAL Daemon) are services required by the X server and other programs related to X (XFCE, Gnome, KDE, etc.). 
  • SLiM is the Login Manager needed for the system to startup at boot to automatically login into our XFCE Desktop Environment. 
  • SOUND loads the audio stack in FreeBSD.
  • HDA loads the HDA sound driver.

Step 5: Launch XFCE Desktop Environment At Boot

Now we need to tell our FreeBSD system to launch the XFCE Desktop Environment at boot. For this, we need to edit the xinitrc file located at home/<username>/  where <username> is the user name you provided during the FreeBSD install.

nano /home/<username>/.xinitrc

Add the following line in the xinitrc file: 

exec startxfce4

Save and exit the xinitrc file by typing CTRL+X. When prompted to “Save modified buffer?” type “Y“.

For “File Name To Write: .xinitrc,” hit the ENTER key. 

Install FreeBSD with XFCE xinitrc xinitrc overwrite
Install FreeBSD with XFCE xinitrc file

Step 5: Install Additional Packages

At this point, your FreeBSD system is configured to boot straight into XFCE Desktop Environment. Feel free to reboot your system now or continue to install some frequently used software like Firefox, LibreOffice, Gimp, Thunderbird, VLC, for instance.

pkg install firefox libreoffice gimp thunderbird vlc

You can install additional packages later if you wish via XFCE Desktop Environment.

To reboot the system type:

shutdown -r now

Step 5: XFCE Tweaks

If you followed every step in this guide, you should be welcomed now by the beautiful SLiM Login Manager.

Install FreeBSD with XFCE SLiM Login Manager
Install FreeBSD with XFCE SLiM Login Manager

Type your username and password to log in.

Here you go, your FreeBSD with XFCE 4 system is now completely installed. But we are not fully done. 

Open a terminal by right-clicking anywhere on the desktop and select the “Open Terminal Here” option. 

Install FreeBSD with XFCE Terminal
Install FreeBSD with XFCE Terminal

Install SUDO

Sudo [substitute user do] is not installed by default, so and let’s install and configure it right now. We will use the pkg command with root privileges to install new software on FreeBSD.

To switch to root, use the following command and type the root password when prompted:

su - root

Once you are on the root prompt, use the following command to install sudo. Chose y [Enter] when prompted.

pkg install sudo

The sudo package is now installed, but we will need to configure our system to use it. For that, edit the sudoers file by using the visudo command shown below:

visudo

Once vi editor shows up, use your down arrow to navigate to the line that says root ALL=(ALL) ALL and add below the following:

<your username> ALL=(ALL) ALL

In my case, the username is leonard. Your sudoers file should look similar to this:

configure sudo freebsd
Edit sudoers file using vi editor

Note: the visudo command uses the vi editor to edit the sudoers file. Use the “i key to switch to edit mode, edit the file, and push the ESC key once to exit the Edit mode. To save your changes, type “:wq!” – without quotes.

edit sudoers file using vi in freebsd
Save and quite sudoers file using vi editor

Now you should be able to use sudo in your system. To test it, type sudo in the terminal.

Install Pulse Audio Plugin

The audio stack is configured in our system, but there is no mixer icon in our taskbar to adjust the sound volume. Let’s fix that. 

In the terminal, as root, type:

 pkg install -y xfce4-pulseaudio-plugin

Once installed, right-click on the XFCE menu bar, select Panel -> Add New Items.

FreeBSD with XFCE taskbar configuration
Install FreeBSD with XFCE: taskbar configuration

In the Add New Items window, look for PulseAudio Plugin and click the Add button.

Install FreeBSD with XFCE Pulse Audio Plugin Add
Install FreeBSD with XFCE: PulseAudio Plugin

The speaker icon should now show up on the XFCE bar as shown below:

FreeBSD with XFCE Audio Mixer
Install FreeBSD with XFCE: Pulse Audio Mixer

And here you go, your FreeBSD with XFCE 4 Desktop Environment is now rock and loaded. This is a minimalist clean install with no added bells and whistles. But look how light on resources XFCE can be on FreeBSD. 

Install FreeBSD with XFCE HTOP
Install FreeBSD with XFCE: System Performance (htop)

Now, go ahead and have some fun with your newly installed FreeBSD and XFCE system. If you are looking for more installation guides on FreeBSD, you might like to read:

How To Install FreeBSD with GNOME Desktop

How To Install FreeBSD with KDE Plasma 5 Desktop

How To Install FreeBSD with XFCE Desktop

If you found this guide helpful, spread the word on how awesome FreeBSD can be and share this guide with your friends and colleagues.

But most importantly, stay safe! 

Leave a Comment