In this guide, we will look at how to install FreeBSD 13 with XFCE 4 Desktop Environment. You will need:
- A USB of a minimum of 8GB capacity
- An Internet connection [preferably LAN], but I had great success with the rtl8812au WLAN dongle, on both FreeBSD 13.0 and FreeBSD 12.2 releases where my WiFi USB dongle is automatically recognized during the installation process.
- The FreeBSD DVD installer image from the official website.
- About 1-2 hours of your time, depending on your Internet speed, and 1 or 2 cups of coffee or tea 🙂
Let’s get to work.
Step 1: Download FreeBSD
Open a browser and navigate to the official FreeBSD download page.
Here you have to choose the architecture of your computer. Most likely your computer architecture is an amd64 unless you are using a very old computer that requires i386 architecture. If you plan to install FreeBSD on a virtual machine (e.g., VirtualBox, VMWare, Parallels Desktop), chose the amd64 image. In this tutorial, we are going to use the amd64 architecture.
I will perform a bare-metal FreeBSD 13.0 installation on one of my test machines, but if you prefer to give it a try on an Oracle VirtualBox VM first, continue following this tutorial.
Step 2: FreeBSD USB Installer
Insert your USB stick in the computer.
In the browser, navigate to Balena Etcher website and download the Etcher installer based on the Operating System you are using. Once the download is completed, install and launch Etcher. You will see an interface like this.
Click Flash from file, locate and browser for the FreeBSD-13.0-RELEASE-amd64-dvd1.iso file you downloaded above. Then, click on the Select target button. Your USB stick should be listed as one of the options.
Warning: If you have other drives attached to your computer, make sure you chose the right USB stick!
Note: Etcher will label the high-capacity HDD/SSD drives as “Large drives” to warn you not to select those drives as targets.
Click the Flash! button, insert your password when asked, and grab a cup of coffee. This process will take ~5-10 minutes. Once the FreeBSD USB stick is flashed, continue to the next step.
Step 3: Install FreeBSD
Warning: If you plan to install FreeBSD 13.0-RELEASE on bare-metal and/or dual-boot configuration, it is highly recommended to disconnect all other HDD/SSD drives in your machine and leaving only the drive you plan to install FreeBSD. This way, you prevent data loss in case something goes wrong during the installation process.
You know what they say: better be safe than sorry!
I will be using a single 200GB SSD drive for this install.
Assuming your computer is turned off, plug-in the FreeBSD USB installer and turn on your computer.
Launching The FreeBSD Installer
This step depends on what motherboard you are using but here are some of the most common ways to configure the FreeBSD boot loader.
You will need to enter the Boot Menu of your computer to choose your USB as a startup device. The Boot Menu is usually assigned to F10, F11, or F12 keys – depending on your motherboard. Typically, the first screen after powering on your machine will show the key assignment for Boot Menu, Bios, etc.
In my case, the Boot Menu is triggered by the F11 key [I am using a Gigabyte motherboard].
On the Boot Menu, select your USB device.
If all goes well, you will be greeted by the FreeBSD installer Welcome menu.
Select 1.Boot Multi user [Enter]
On the FreeBSD Welcome screen, select Install [Enter]
Install FreeBSD XFCE 4 – Welcome Screen
On the Keymap Selection, use the keyboard arrow keys to select your keyboard layout [Enter]. I am using a US keyboard so that I will select the United States of America keymap. Once you selected your keymap, click on Continue with<your keymap> then [Enter].
On the Set Hostname window, type your desired hostname and select OK [Enter].
On the Distribution Select window chose the additional system components you want to install: 32-bit libraries, ports, system resource tree, system & kernel debugging, and test suite. I will select the 32-bit support, ports, and source tree for this FreeBSD installation.
In the Partitioning window, FreeBSD presents us with 4 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 via GUI. This option is for more advanced users and assumes you know what you’re doing.
- Shell – Open a shell and partition by hand. Again, this assumes you are not new to 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 awesome post here.
Let’s go for the latest and the greatest and choose the last option here: Auto (ZFS) – Guided Root-on-ZFS [Enter].
If you using multiple disks, you can configure mirroring or RAID on the ZFS Configuration (Virtual Device type) window. I am using a single SSD in this install and I will select the Stripe – No Redundancy option. Select OK [Enter] to continue.
Select the disk you want to install FreeBSD. In my case, the disk is shown as ada0 – SAMSUNG HD080HJ. In your case, the disk name might be different. Choose your disk and click OK [Enter]
FreeBSD Installer will now warn you this is the Last Chance to review your settings before proceeding with disk partitioning.
Once you select YES, all your data on the selected disk will be lost!
If you are not sure, chose NO, and review your settings/disk configuration. If you are sure, select YES [Enter].
Setting The ROOT Password
Next, the FreeBSD installer will prompt you to type a password for the system management account (root). Make sure you type a strong password for your root account if you plan to use this machine on production.
Setting The ROOT Password
On the Network Configuration window, select which network interface you want to use. I am using the onboard network LAN interface and an EDUP Dual Band Wireless USB using the rtl8812au chipset in my system, and the FreeBSD installer is detecting both interfaces during the installation without me messing with the config files.
Select Yes [Enter] when asked to configure IPv4 for your interface in the Network Configuration window.
Select Yes [Enter] when asked to configure DHCP for your interface.
Note: I do not use IPv6 for my interface, so I select No [Enter] when asked in the Network Configuration window.
If your Network Connection is working, FreeBSD will automatically configure your 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].
On the Time & Date windows, you can select Skip [Enter] as this will be configured later.
On the System Configuration, choose which services you would like to start at boot. I usually go with the default settings here. You can change these settings later – if needed. Click OK [Enter].
Next, in the System Hardening window, we can select additional security options to improve our system security. These are my usual hardening settings but feel free to select all if you are using this machine on production or as a server. Click OK [Enter].
Add User Accounts
It is now time to add a new user to the FreeBSD system. Select Yes [Enter] when prompted.
Here, we only need to fill a few fields – marked in red bold 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 video operator
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>
Lock out the account after creation? [no]: [Enter]
OK? (yes/no): Yes
Add another user? (yes/no): No <– you can add another user by choosing Yes here.
On the Final Confirmation window, you can review your settings once more before completing the FreeBSD installation process. Select OK [Enter].
If you need to do any additional changes to your FreeBSD installation via a shell, you can do it in the Manual Confirmation window. Otherwise, click No [Enter].
The FreeBSD installation is now finished. Click Reboot when prompted and remove the FreeBSD installation USB stick from your computer.
Congratulations! FreeBSD is now installed on your system! 🙂
At your first boot, you should see the now-familiar FreeBSD Welcome screen. This is a good sign that your FreeBSD installation was successful. Push the [Enter] key to boot into the Multi-user mode.
The FreeBSD installer doesn’t come with any pre-installed Desktop Environment (DE) or Window Manager (WM). But that’s just great as with a few command lines, we can install any DE or WM we want on FreeBSD.
On the login prompt, login as root and provide the root password you chose during the installation.
Step 4: Post Installation Tasks
Update The System
The FreeBSD installer will proceed with disk partitioning and system installation.
Before doing anything, let’s make sure our system is up to date.
In case you are not login as root, you can switch to the root user using the following command.
In the terminal, type one line at a time:
A list with files to be updated and their path will be listed on the screen. Press the [Enter] key until you reach the bottom of the list, then press the q key to quit the list.
In the previous step, we fetched the missing updates to be installed and now it is time to update the system using the following command:
As you see, installing the FreeBSD system updates is very fast and easy.
Done! Your system is up to date now.
Install NANO Text Editor (Optional)
If you are familiar with ee or vi Text Editors, you can skip this step. ee and vi are installed by default on FreeBSD.
For those not familiar with ee or vi, I recommend the nano command line Text Editor. We will need a text editor to make a quick change to our system in a moment. Don’t worry. This installation guide doesn’t mess a lot with FreeBSD configuration files.
pkg install -y nano
Step 5: Install XFCE 4 Desktop Environment
To get XFCE to work on FreeBSD we will need to install the following components:
- The X graphical server [XORG].
- The XFCE server.
- A login manager – in this case, we are using the Simple Login Manager [SLiM].
You can choose to skip the login manager if you don’t want to boot automatically into a graphical interface. You can manually start the X server by typing as root in the terminal the startx command.
This is a tip received from the awesome FreeBSD community on Reddit and useful in case you update your FreeBSD and end up with a broken graphical interface. You can read the discussion here.
Install XORG Server
Before we proceed to install the XFCE DE, 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
Now, let’s install the XFCE desktop environment on the FreeBSD system. Type the following command and grab a cup of coffee, as this might take a while.
pkg install -y xfce
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 6: 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
- DBUS and HAL (HAL Daemon) are services required by the X server and other programs related to X (XFCE, Gnome, KDE, etc.). Note that HAL is deprecated and might not be required in the future.
- SLiM is the Login Manager needed for the system to startup at boot to automatically login into our XFCE Desktop Environment. This step is necessary if you want to launch the Simple Login Manager automatically at boot.
- SOUND loads the audio stack in FreeBSD.
- HDA loads the HDA sound driver.
Step 7: Launch XFCE 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 installation.
Users familiar with ee or vi text editors installed by default on FreeBSD, can use them instead nano.
Add the following line in the xinitrc file:
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.
Step 8: Install Additional Software
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 9: Some XFCE Tweaks
If you followed every step in this guide, you should be welcomed now by the beautiful SLiM Login Manager.
Type your username and password to log in.
Here you go, your FreeBSD 13 with XFCE 4 system is now completely installed. But we are not fully done yet.
Open a terminal by right-clicking anywhere on the desktop and select the “Open Terminal Here” option.
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:
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:
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.
Now you should be able to use sudo in your system. To test it, type sudo in the terminal.
Install XFCE Goodies
The Xfce Goodies Project includes additional software and artwork that are related to the Xfce desktop, but not part of the official release. This is what the XFCE Goodies package includes [credit FreeBSD Reddit community]
ARCHIVE BATTERY CALCULATOR CLIPMAN CPUGRAPH DASHBOARD \ DATETIME DICTIONARY DISKPERF FSGUARD GENMON GIGOLO \ MAILWATCH MEDIATAGS MENULIBRE MOUNT NETLOAD PAROLE \ POWERMANAGER RISTRETTO SCREENSAVER SCREENSHOOTER \ SMARTBOOKMARK STOPWATCH SYSTEMLOAD TASKMANAGER TERMINAL \ THEMES TIMEOUT TIMER VCS VERVE WAVELAN WEATHER WHISKERMENU \ XFBURN XKB
To install XFCE Goodies in your system, type the following command as root:
pkg install xfce4-goodies
Alternatively, you can install the XFCE Goodies from ports using the following command:
cd /usr/ports/x11/xfce4-goodies/ && make install clean
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.
In the Add New Items window, look for PulseAudio Plugin and click the Add button.
The speaker icon should now show up on the XFCE bar as shown below:
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.
Now, go ahead and dive deeper into your newly installed FreeBSD and XFCE system. If you find something new, let me know in the comment section bellow.
If you are looking for more installation guides on FreeBSD, you might like to read:
How To Install FreeBSD with GNOME Desktop
This FreeBSD 13 with XFCE 4 installation post would have not been possible without the great help and contribution of the FreeBSD Reddit community. If you are a FreeBSD fan, I highly recommend joining the FreeBSD community on Reddit.