Basic FreeBSD Desktop Setup

I haven’t setup a FreeBSD server in a while so I decided to have a look at FreeBSD 12.1, which I installed as a guest using VirtualBox. I also decided that I wanted a fairly basic desktop on this install. Below are my notes on what I did to setup the desktop after I had already installed the base FreeBSD system.

First – here is a quick list of commands for working with user setup and package management :

  • adduser - Add new user
  • rmuser - Remove a user
  • chpass - Allows for user modification, including shell
  • chsh - Change shell using editor, chsh -s does not use the editor
  • pw - Modify user and groups
    • Type “pw” to get basic help
    • Another example: "pw usermod help"
Working with packages:
  • pkg help
  • pkg info <name>
  • pkg search <name>
  • pkg search -o <name>   - use this one, provides path
  • pkg install <name>
  • pkg delete <name>
  • pkg upgrade
  • pkg autoremove   - remove stale dependencies
  • pkg clean - clean package cache
  • pkg clean -a   - clean all cached packages
  • pkg audit -F   - Check for vulns

Install bash and VIM:

pkg install bash bash-completion vim Edit vimrc: vim /usr/local/etc/vim/vimrc add: "set background=dark" - Easier to see text "set number" - Always display line numbers

Set up UTF-8:

vim /etc/login.conf (edit default class as below)
     :umask=022:\     (add “\” only)
     :charset=UTF-8:\
     :lang=en_US.UTF-8:

execute "cap_mkdb /etc/login.conf"

Edit /etc/profile:
   vim /etc/profile
        LANG=en_US.UTF-8; export LANG
        CHARSET=UTF-8; export CHARSET
        GDM_LANG=en_US.UTF-8; export GDM_LANG

Logout and login again
execute “locale"

Install Xorg, fonts, and XFCE:

pkg install xorg xfce
pkg install virtualbox-ose-additions
pkg install terminus-font liberation-fonts-ttf

execute "fc-cache -vf"

Add the following to /etc/rc.conf:

vim /etc/rc.conf
   dbus_enable="YES"
   vboxguest_enable="YES"
   vboxservice_enable="YES"

If /etc/X11/xorg.conf does not exist:

cd /root/
X -configure

Add these lines to the following:
vim xorg.conf.new

   Section "Files"
        FontPath     "/usr/local/share/fonts/terminus-font/"
        FontPath     "/usr/local/share/fonts/Liberation/"
        FontPath     "/usr/local/share/fonts/dejavu/"

   Section "Module"
        Load  "dri"
        Load  "freetype"
        Load  "bitmap"
        Load  "type1"

   Section "InputDevice"
        Driver      "vboxmouse"

   Section "Device"
        Option     "DRI" "true"
        Driver      "vboxvideo"

cp xorg.conf.new /etc/X11/xorg.conf

Add to ~/.xinitrc (for each user):

exec /usr/local/bin/startxfce4

Add user account:

adduser
passwd username
pw usermod username -G wheel,operator

As user:
vim .xinitrc
    exec /usr/local/bin/startxfce4

Login as user and start xorg:

startx