The FreeBSD community has been very excited about http://www.freebsd.org/doc/handbook/pkgng-intro.html, the next generation package manager now installed by default with FreeBSD 10. pkgng allows for binary packages to be installed in a similar fashion to yum or apt-get on Linux. The most important feature of binary packages is the speed at which a system can be deployed. pkgng allows for the creation of custom repos that can be configured with pkg.conf files.
It should be noted that http://www.pcbsd.org provides the most complete desktop installation with numerous configuration tools and features for novice and advanced users, including remote backups with Life Preserver and simplified jails management with Warden. The idea here is to provide a minimal but functional desktop with FreeBSD 10 in just a couple commands, as sometimes it is necessary to have a running web browser to be able to configure a device or virtual machine (pfSense for example). These steps assume a basic install of FreeBSD 10 with the ports tree.
The first step is to update/install pkgng. The first time pkgng is run, it will need to be bootstrapped:
pkg update -f
Type “yes” and press Enter to setup pkgng which will also update pkgng to the latest version. The following will install the minimum required Xorg server packages that will allow for the X server to start:
pkg install -y xorg-server xinit xf86-input-keyboard xf86-input-mouse
Depending on your preference, fluxbox and i3wm are minimalist window managers for FreeBSD. In this example, I installed i3 to be the window manager:
pkg install -y i3 i3lock i3status
Running the next set of commands will set the default window manager for all users on the system (except root, as root should not be running X):
foreach dir (`ls /usr/home`) echo "/usr/local/bin/i3" >> /usr/home/$dir/.xinitrc chown $dir /usr/home/$dir/.xinitrc end
If this desktop is running as a guest OS in VirtualBox, run the following commands to install the VirtualBox drivers and start the vbox services on boot:
pkg install -y virtualbox-ose-additions cat<< EOF >> /etc/rc.conf vboxguest_enable="YES" vboxservice_enable="YES" EOF
If you are not running within VirtualBox, you can install the basic failsafe drivers that include VESA to setup a normal VGA desktop:
pkg install -y xorg-drivers
At this point, I add the bare minimum of software I will need. LibreOffice could be omitted but the following is a short list of useful software I add:
pkg install -y rxvt-unicode zsh sudo chromium tmux libreoffice gnupg pinentry-curses
When using chromium, the sem module must be loaded in the kernel. The linux compatibility module is also set to load at boot with the following commands:
echo 'sem_load="YES"' >> /boot/loader.conf echo 'linux_load="YES"' >> /boot/loader.conf
hald and dbus are required for running X, so they must be enabled in rc.conf:
cat << EOF >> /etc/rc.conf hald_enable="YES" dbus_enable="YES" EOF
There is a sysctl value that is required when running chromium. The following will add this value to sysctl.conf:
cat << EOF >> /etc/sysctl.conf #Required for chrome kern.ipc.shm_allow_removed=1 EOF
The last thing to do is reboot to load up all of the necessary modules. Running “startx” as any user will load up the i3 desktop. I have created a script to build the desktop called the The 5 Minute FreeBSD Desktop, which is hosted over on GitHub. Feel free to edit the script to add in whatever software you wish.
The next step is to repackage the FreeBSD install disk with this script to run on first boot.