Instructions for Installing KDE Plasma on FreeBSD

By Nicholas Scribner
August 31, 2022

I originally published the contents of this article on the FreeBSD Forums on November 19, 2021 (I started the thread on October 10, 2021—my 33rd birthday). In this fifth rough draft of instructions, I will show you how to install KDE that will be started with the command startx. Thanks go to astyle for ironing out the final details and everyone else who contributed on the FreeBSD Forums.

Without a desktop environment, such as KDE, FreeBSD is just the UNIX shell (think "WarGames," "The Matrix," or MS-DOS!). Follow these instructions to set up a desktop environment so your computer looks like Windows or Mac.

Commands, code, and keystrokes are in bold (some other functions may be in bold as well). Commands and code will also have a silver background. Filenames are in green. I recommend reading all of the instructions before trying them.

1. Enter the superuser/root account by entering % su and the password for the root account. Note that the command prompt on the shell (%, $, #, etc.) is dependent on what user is currently logged in. Therefore, the % should not actually be typed out. Once in the root account, the command prompt will be #.

2. Run # pkg install drm-kmod

3. Enter the easy editor to edit the file /etc/rc.conf by entering the following command: # ee /etc/rc.conf

4. Once in the easy editor, on a new line, enter the following two lines on separate lines:

kld_list="/boot/modules/i915kms.ko"
dbus_enable="YES"

5. Make sure to hit Enter so the file starts on a new line after saving.

6. Save and exit the easy editor by pushing Esc and following the prompts to save and exit. The KMS driver should now be set up.

7. (7 and 8 are superfluous if you reboot in step 10. i915kms and dbus get loaded while booting because you added them to /etc/rc.conf in 4. In other words, you can skip 7 and 8. I am still including the steps for future reference.) Go ahead and load the drm driver. Run # kldload /boot/modules/i915kms.ko

8. (7 and 8 are superfluous if you reboot in step 10. i915kms and dbus get loaded while booting because you added them to /etc/rc.conf in 4. In other words, you can skip 7 and 8. I am still including the steps for future reference.) Run # service dbus start

9. Run # pkg install xorg

10. Reboot by running # shutdown -r now and booting up to a command-line login prompt.

11. Log in as a regular user (this is important).

12. Run % startx as a regular user. (Even the Handbook tells you to do this in the Quick Start section 5.4.1, Step 3.)

13. TWM window manager will start. You can return to text mode by opening the pop-up menu by left-clicking on the desktop and then clicking Exit.

14. Become the superuser/root account again by running % su

15. Reboot by running # shutdown -r now

16. After logging in, become the superuser/root account again by running % su

17. Run # pkg install kde5 firefox

18. Enter the easy editor to edit the file /etc/fstab by entering the following command: # ee /etc/fstab

19. Once in the easy editor, on new lines, enter the following two lines (you can push the Tab key or spacebar after entering each field):

fdesc   /dev/fd fdescfs rw   0  0
proc   /proc procfs rw   0  0

(See post #33. There is debate on whether this instruction should be included; I am including it because it may be beneficial for those who want to run applications such as LibreOffice.)

20. Make sure to hit Enter so the file starts on a new line after saving.

21. Save and exit the easy editor by pushing Esc and following the prompts to save and exit.

22. Run # mount /dev/fd

23. Run # mount /proc

24. Exit the superuser account by running # exit. All files in your $HOME directory should be edited as a regular user, not as root.

25. Enter the easy editor to edit the file ~/.xinitrc by entering the following command: % ee ~/.xinitrc

26. Once in the easy editor, on a new line, enter the following line:

exec ck-launch-session startplasma-x11

27. Make sure to hit Enter so the file starts on a new line after saving.

28. Save and exit the easy editor by pushing Esc and following the prompts to save and exit.

29. Become the superuser/root account again by running % su

30. Reboot by running # shutdown -r now

31. If you chose not to reboot, enter # exit to leave the superuser account.

32. If everything worked, you should see the KDE desktop after running % startx as a regular account.

Article ID: 14