Step 1. Choosing Between Ports and Packages:
FreeBSD offers two primary methods of downloading applications and system tools: packages and ports. Users will have to choose between the two collections when installing these tools. Packages are pre-compiled binary packages, typically smaller in size than full port installations and they do not require compilation time. Ports are a much more customizable option, allowing experienced users to adjust how the tool is compiled. Packages are created for less experienced users and should be used unless the user has specific changes they need to make. In general, ports should only be used if the user understands how the packages are compiled and would like to customize this process. Refer to the ports section of the FreeBSD Handbook for more information.
Step 1. Installing the X Window System:
Before installing a desktop environment, a graphical user interface (GUI) is needed. The X Window System is an open source GUI that supports FreeBSD and offers a ton of customization and user tools.
Xorg (the X Windows System) can be installed as a package or port. Both require root privileges so users should first run:
Then after entering the root password, to install the binary packages:
$ pkg install xorg
Installation will then start, duration can vary depending on the computer speed.
Step 2. Learning How to Edit Text Files:
To continue working with FreeBSD and configuring system tools, a general understanding of text editing will be needed. The most powerful tool FreeBSD includes for this process is the “vi” command.
Read through the manual page. Focus on the commands that let you enter and delete text, “a” and “x”. A handy cheat sheet for vi commands can also be found above.
Before entering a command the “esc” key must be used. If you have already used the “a” command to enter text, the “x” key will simply enter that character unless you first esc the command.
Once you are finished, use “esc” to end the last command. Then use one of the save/quit commands to quit editing the file. If you want to save changes use “:wq” otherwise use “:q!” to quit without saving changes.
Step 3. Configuring the X Window System:
The X Window System uses 3D acceleration. In order to benefit from this, users who will be using the GUI need to be added to the video or wheel groups. This can be done in one command as root. Enter these lines but replace guestuser with the user you are adding:
$ pw groupmod video -m guestuser || pw groupmod wheel -m guestuser
This will add the user to the video group, or if that doesn’t exist, the wheel group.
Next, FreeBSD must be configured to set the video output mode. Use the “vi” command to start editing /boot/loader.conf
$ vi /boot/loader.conf
Add this line to the top of the file:
Step 4. Setting Up and Testing the X Window System.
Before the X Window Server can be run, a few dependancies will need to be installed. Start by installing drm-kmod.
$ pkg install drm-kmod
For built-in intel video drivers, follow the next two steps verbatim, for other video drivers, pay attention to the message emitted by the previous command, it will tell you what needs to be loaded on boot. This will replace the kld_list=”i915kms” in the command below.
$ vi /etc/rc.conf
And add the following line
The X Window system can now be tested using the built-in start command:
Step 5. Choosing a Desktop Environment:
While FreeBSD has a huge collection of desktop environments users can choose from, this guide will be focusing on just 2: KDE and Xfce. The other desktop environments can be found in the FreeBSD ports collection.
Xfce is a lightweight desktop environment. This simple environment is great for slower machines or devices with memory limitations. We’ll use Xfce as an example for this guide.
Step 5.1 Installing and Configuring Xfce:
Install Xfce from the binary package:
$ pkg install xfce
Xfce doesn’t offer its own login manager, so it can’t be started as FreeBSD boots in the same way as GNOME or KDE. To be able to start Xfce from the command line, first add this entry to ~/.xinitrc:
$ echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc
While Xfce will not automatically start when the system boots, it can now can be launched through the command line by starting the X Window System:
You now have a desktop environment on your device!
If you chose to configure the rc.conf file, the environment will load each time that FreeBSD boots. Each environment has its own settings but offers a console app to use for command line inputs. Quitting the environment will also allow the user to access the FreeBSD shell.
The next step is using your new desktop environment to download a collection of graphical and accessibility applications or utilities to suit the user’s needs. Check out the FreeBSD ports collection to find a list of available applications.