In this article, we’re going to learn how to install FreeBSD with KDE Plasma 5 using the desktop-installer script, and the latest supported NVIDIA drivers – which at the time of writing this article is NVIDIA 440.
I will perform a bare-metal installation on one of my test machines, but if you prefer to give it a try on an Oracle VirtualBox VM first, you can follow this installation guide too. As of February 2021, the latest FreeBSD stable release is 12.2, with FreeBSD 13.0 release being scheduled for release on 23 March 2021.
This installation requires a minimum of 8GB USB stick and a connection to the Internet.
Note: If you are using a Realtek 8811au wireless chipset, the FreeBSD 12.2-RELEASE installer will automatically detect your chipset during the installer. If you are not sure, connect your computer to the Internet using the LAN port.
The whole installation process will take about 1 hour if you have a decent machine and good Internet connection.
Before we start: If you are not yet ready to install FreeBSD on bare-metal, you can get the OS installed on a virtual machine first. My guide on How To Install FreeBSD on Parallels Desktop will get you up-and-running in no time if you are a Mac user. If you use VMWare/Virtual Box instead, stay tuned as I will publish a guide for each VM solution soon!
Let’s get started!
Step 1: Download FreeBSD 12.2-RELEASE ISO.
First, head over to the FreeBSD website download page. Your machine most likely supports amd64 architecture (unless it is ages old), so click on amd64. You will see a list of images (.iso, .img) of different sizes (CD, DVD, net installer). For this installation, we’re going to use FreeBSD-12.2-RELEASE-amd64-dvd1.iso.
Step 2: Prepare the USB installer.
Go to the Balena Etcher website. Download the installer based on the OS you are using (Windows, macOS, Linux). Insert your USB stick in one of your USB ports.
Install and run Etcher. You will be greeted with an interface like this:
Click Flash from file, locate and click on the FreeBSD-12.2-RELEASE-amd64-dvd1.iso you downloaded earlier. 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 target.
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-12.2-RELEASE USB installer is done, it’s time to get our hands dirty.
Step 3: FreeBSD 12.2-RELEASE Installation
Before we begin: If you plan to install FreeBSD 12.2-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. 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 12.2-RELEASE USB installer and turn on your computer.
Launching The Installer
You will need to enter the Boot Menu to chose your USB as a startup device. The Boot Menu is usually assigned to F10, F11, or F12 keys – depending on the motherboard you’re using. 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.
On the Boot Menu, select your USB device.
If all goes well, you will be greeted by the FreeBSD installer boot menu.
Select 1. Boot Multi user [Enter]
On the FreeBSD Welcome screen, select Install [Enter]
On the Keymap Selection, use the 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].
In the Set Hostname window, type your desired hostname and select OK [Enter].
You can choose the optional system components to install in the Distribution Select window, such as 32-bit libraries, ports, system resource tree, system & kernel debugging, and test suite. Let’s select the 32-bit support, ports, and source tree for this install.
In the Partitioning window, we have 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 assumes that you already 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.
Let’s keep things interesting and select the last option: Auto (ZFS) – Guided Root-on-ZFS [Enter].
On the ZFS Configuration window, you can increase the Swap Size and enable Disk Encryption in case you need it. I will proceed with the defaults and select >>> Install [Enter].
You can configure mirroring or RAID on the ZFS Configuration (Virtual Device type) window if you use multiple disks. We use only one disk; therefore, we will select Stripe – No Redundancy for this install. Select OK [Enter] to continue.
Select the disk you want to install FreeBSD. In my case, the disk is shown as ada0 – SAMSUNG HD080HJ. Choose your disk and click OKOK [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 that disk will be lost! If you are not sure, chose NO, and review your settings. If you are sure, go ahead and select YES [Enter].
The FreeBSD installer will proceed with disk partitioning and system installation.
Setting The ROOT Password
During the installation, you will be prompted to type a password for the system management account (root). Make sure you type a strong password for your root account.
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 in my system, and the FreeBSD 12.2-RELEASE installer is kind enough to detect both interfaces during the installer!
Select Yes [Enter] when asked to configure IPv4 for your interface.
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.
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, you can choose which services you would like to start during boot. I usually go with the default settings. You can change these settings later – if needed. Click OK [Enter].
In the System Hardening window, you can select additional security options to reduce any system vulnerabilities. Here are my usual hardening settings but feel free to select all if you are using your machine in a production environment. Click OK [Enter].
Add User Accounts
Let’s add a new user to our FreeBSD system. Select Yes [Enter] when prompted.
<Add user accounts>
Here, we only need to fill a few fields – marked with bold text 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
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
On the Final Confirmation window, you can review your settings once more before completing the 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].
Your installation is now completed. Click Reboot when prompted and remove the FreeBSD 12.2-RELEASE installation USB stick from your computer.
Congratulations! You completed your FreeBSD 12.2-RELEASE installation!
Step 4: FreeBSD Post-installation Tasks
Your computer will boot into the now-familiar FreeBSD Welcome boot screen. Chose the first option (1) and push Enter to boot into the multi-user mode.
If everything is OK, you will be greeted with a beautiful login prompt.
I know, I know. You expected to see at least a basic GUI, and now you’re worried something went wrong during the installation. Worry no more – this is absolutely normal.
We will install KDE for our new FreeBSD system in a moment, but first, there are a few post-installation tasks we need to perform to make sure everything goes smooth.
Log in as root using the root password you configured during the installation.
Updating The System
Our first task is to make sure our FreeBSD system is up to date.
First, we will inspect the system and fetch the necessary updates by using the following command:
A list with files to be updated will appear. Press Enter until you reach the bottom of the list, press the q key to quit the list.
Let’s proceed with installing the FreeBSD system update by using the command:
Your freshly installed FreeBSD system is now up to date.
Step 5: Installing KDE Plasma Desktop Environment
There are a few ways to install a desktop environment or window manager in FreeBSD. Most ways include installing the necessary components such as display server, desktop environment, GPU driver, and additional configuration manually.
Though I might cover those methods in a future article, I will keep things simple for now and go for the fastest and easiest way to get a FreeBSD desktop environment up and running.
First, jump in the terminal and install desktop-installer — type y when prompted [Enter].
pkg install desktop-installer
Now, launch desktop-installer by typing:
Note: This process will take ~15 minutes, and you will be presented with a detailed explanation for every option you select. Since every computer is different, I advise you to slowly go through the options and select the right choice that matches your system configuration.
Press return to continue… [Enter]
When prompted to configure your firewall, choose the default choice y [Enter].
On the warning, type y [Enter] – unless you are doing this installation via SSH.
When prompted about switching to the latest binaries instead of quarterly snapshots, go with the default n [Enter].
Note: At this point, you may get an error such as “mv: rename /usr/ports to /usr/ports.0: Operation not supported” and the desktop-installer script will terminate.
To solve this problem, delete everything in the /usr/ports folder using the following command:
rm -Rf /usr/ports
Then rerun the desktop-installer script, and repeat Step 5.
The script will quietly populate the /usr/ports folder again and not throw any error this time.
When prompted to update the system before proceeding, choose n [Enter] as we already performed an update.
When prompted about disabling the write cache, leave the default n [Enter].
When prompted to build from the source, go with the default n [Enter]. The desktop-installer script will search for the fastest mirror now.
Choosing a DE or WM
Finally, you will be prompted to select the Desktop Environment or Window Manager of your choice. As you can see, the choices presented are quite generous.
We will choose the KDE 5 Desktop in this installation, but I had equal success installing Gnome, Cinnamon, XFCE, and Mate in the past.
For XFCE fans, here’s my latest guide on How To Install FreeBSD With XFCE 4 Desktop Environment.
The KDE Plasma 5 Desktop is number 8 in the list so let’s type: 8 [Enter].
If you are using a wireless network card or adaptor, chose [y] when prompted. Otherwise, push [Enter] to go with the default option n [Enter].
If your system has a sound interface, chose y [Enter] to load the appropriate driver into the kernel. Otherwise, go with the default option n [Enter].
You will be asked if you want to install from source or packages. Installing from source can take a very long time – 1-2 days on a good computer. Chose n to install from packages.
The desktop-installer script will proceed now with fetching, extracting, and installing the necessary libraries required by the KDE installation. If prompted for Reading/Accepting the License for fusefs-exfat, select Accept [Enter].
NOTE: If you are installing FreeBSD on bare-metal, the desktop-installer script will auto-detect your NVIDIA/AMD GPU card and will automatically download, install and configure the latest working driver. If you are installing FreeBSD on a Oracle VM Virtualbox, you will be asked if you want to install guest-ose-additions. Type y [Enter] as shown below.
You will be prompted for Xorg installation. Press any key to continue…
When asked if you want to reconfigure X11, chose y [Enter].
Chose y [Enter] when asked to install Xorg mouse drivers.
Chose n [Enter] when asked to generate a new xorg.conf.
Chose y [Enter] to enable software cursor.
It is time to test X11 first time. Select y [Enter].
If everything went well, you should be greeted with the KDE Plasma 5 GUI.
This is just the X11 test and not the final configuration so DO NOT REBOOT/SHUTDOWN your computer here, just LOG OUT to return to the shell and continue the installation.
When asked about testing the sddm (Simple Desktop Display Manager), chose y [Enter]. Login using the password for your username (not root). Test your login and then reboot the system.
Once the reboot is completed, your system should boot directly into the KDE Plasma 5 login screen. Type your password to login.
Open the terminal (Konsole). Sudo is not installed by default so and let’s install and configure it. To install new software, we will use the pkg command with root privileges. To switch to root, use the following command and type your 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
In order to make sudo work, we will need to edit sudoers file using the visudo command as root.
Once vi 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 edit should look like 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. In order to save your changes, type :wq!
Now you should be able to use sudo in your newly installed FreeBSD system. To test that, open a new terminal and type sudo.
Install Additional Software
Last but not least, let’s install some additional software to start using our newly installed system. As you can see, we can use sudo without having to switch to the root user to run elevated commands. Type your root password when asked.
sudo pkg install firefox libreoffice kdenlive vlc
Note: There are two ways to install software on FreeBSD: from packages and build from sources. In this article, we installed our software using packages (pkg command). To search for the available packages, you can use the pkg search <package name> command as shown below:
There is an alternative way of building the packages from source using ports which I will discuss in more details in a future post.
This method is not limited to installing KDE only. You can use the desktop-installer post-installation script to install any other Desktop Environment and/or Window Manager listed in Step 5 – Choosing a DE or WM of this guide. You can also check my latest guide on How To Install FreeBSD with XFCE 4 Desktop Environment.
I’ve been using FreeBSD for about 3 years now, and I can’t be happier about it. I use FreeBSD as the main machine daily for coding, audio & video editing, graphic design, etc. It is fast, very stable, well documented, and overall, a fantastic OS! It takes a bit of getting used to but once there, you won’t look for any other alternative – trust me!
If you have any questions or suggestions on how I should improve this article further, drop me a comment below, and I will do my best to help – I promise you!
I hope you will enjoy your newly installed FreeBSD system, as much as I do.
Looking for more FreeBSD Installation guides? Check the latest tutorials on: