Install & Configure a Desktop Environment: LXDE
You have just installed FreeBSD, rebooted, and are at the console login prompt. At this point you should be able to login as root, and hopefully you also added a user too.
Setting up the xorg dependency
You will need a user to start the x11 window graphical desktop with the startx command.
Never run startx as root! Always run startx as a user.
This user needs to be part of a group that can start X11. Add this user to at least either the wheel or video group.
See Chapter 3.3 of the FreeBSD Handbook for more detail and how to add a user if you did not do so during install. Basically, type at the root prompt:
and follow the prompts.
If you DID create a user during install but did not add them to wheel or video groups, do so now. To add user <your-user> to whichever group is available:
# pw groupmod video -m <your-user> || pw groupmod wheel -m <your-user>
So login as root, take care of your user setup, then proceeed to install Xorg per Chapter 5.3 of the FreeBSD Handbook.
- xorg will not run if you changed the default system console mode from vt to sc. FreeBSD RELEASE 11.0 and newer defaults to using vt mode.
- xorg will not run in a jail because it does direct calls to the kernel which is a jail security violation.
EITHER: # pkg install xorg
OR: # cd /usr/ports/x11/xorg
# make install clean
Both of these will take a long time, but "pkg install <anything>" goes a lot quicker than "make install <anything>". If you are tempted to ever "make install" the entire ports collection, for instance, it will take all day, literally. Be your own judge, depending on how much time you have & how fast your computer runs.
Setting up the video card dependency
Now, after X11/xorg is installed, it is time to take care of the video cards. The instructions are at: Graphics.
Basically, you need to:
# pkg install drm-kmod
Take careful note of the post-install package message as it contains important information on which config file to use to add the correct driver module. Add this to your /etc/rc.conf OR /etc/rc.conf.d file:
Here "XXX" is one of three choices: basically one for all Intel systems, and one of two for the AMD systems, depending on the age of the computer.
AMD Newer: kld_list="/boot/modules/amdgpu.ko"
AND Older: kld_list="/boot/modules/radeonkms.ko"
AMD video driver modules are newer from about 2014 and later, the older legacy driver modules before that. You just need to do a little looking, and maybe some trial & error. As an example,I know my old 2014 AMD radeon/kabini imbeded video works with the newer amdgpu.ko driver module. Ask on the FreeBSD Forums if you have any question about your specific AMD video. People are glad to help.
Preparing to install a desktop environment
Assuming you have installed Xorg, and installed the drm-kmod for your video drivers, and added user(s) who will have permission to 'startx' the video by adding them to either the wheel or video groups, you are ready to install a desktop environment. As root, reboot:
# shutdown -r now
When rebooted, log in as user [NOT ROOT], and run:
You should be able to see the skeleton Xorg window with three xterm terminals and a clock. Return to root login, and reboot and go back to console if you like, or just just work in the skeleton Xorg window.
Now you will want to install a graphial desktop. Chapter 5.7 of the FreeBSD handbook covers how to install Gnome, KDE, & XFCE. There are many others. The instructions below cover a fourth desktop, LXDE.
Note that you may want to also install a graphical Display Manager, a GUI login between the console and your Desktop Environment. GNOME installs its own Display Manager, GDM. KDE & XFCE do not provide a Display Manager. This is not mandatory. See Chapter 5. - The X Display Manager for details if you like. Otherwise you can login at the console command line with startx as a user, and skip the extra graphical login.
How To Install & Configure LXDE Desktop
LXDE (Lightweight X11 Desktop Environment) is a nice lite desktop, easy to install and configure. LXDE is a good choice for those who want to have a lot of control over which apps are installed. Beyond the basic desktop it only pre-installs a few programs: two terminals, a task manager, a file manager, an image viewer, and desktop configuration tools. You pick your graphical text editor, web browser, etc. Nice and clean. Neat screen savers!
1. INSTALL LXDE:
EITHER: # pkg install lxde-meta
OR: # cd /usr/ports/x11/lxde-meta && make install clean
2. PREPARE .xinitrc file in user's home directory:
# cd /usr/home/username - Switch to users home directory.
# vi .xinitrc or ee .xinitrc - Create the new .xinitrc file & add the next two lines to the file.
ck-launch-session dbus-launch --exit-with-session startlxde
3. ENABLE D-BUS:
- Add this line to the existing /etc/rc.conf file:
4. MOUNT PROC:
- Add procfs like this to existing /etc/fstab file:
proc /proc procfs rw 0 0
5. RE-BOOT, LOGIN AS USER, AND RUN startx:
Remember, NEVER RUN STARTX AS ROOT, only as a user.
I hope you enjoy the LXDE Desktop. Have fun!
Taken in part from https://wiki.lxde.org/en/FreeBSD at lxde.org and other sources, including FreeBSD Forums & Wiki and trial & error experience. Clay Daniels - firstname.lastname@example.org - July 2019 Tested on FreeBSD 13.0-CURRENT r350103 & r350322 using the default vt system console mode.