Deploying a FreeBSD 6.2 Desktop
Scope of This Document
This is the process that I use when I build my own desktop workstations. I'll warn that it can be quite time consuming, but in the end, you will have a system that is rock solid stable. Finally, I will assume that you have navigated to this article with a base system already installed, such as by following the document Installing FreeBSD 6.2.
Setup Useful Daemons
To get started, lets configure time synchronization with ntpd, and net-snmp. When configuring net-snmp, make sure you specify snmp-v1 and snmp-v2 community strings that only you know, its just good practice.
# cd /usr/ports/net-mgmt/net-snmp; make install clean
First up, lets manually sync the time of the computer.
# ntpdate -v -b 0.us.pool.ntp.org
Configure net-snmp. Most sites use snmp-v1 or snmp-v2, but net-snmp supports the more secure snmp-v3 as well. If you just want to be able to query your machine against a public or private community string, follow the prompts to configure the snmpd.conf file for snmp-v1/v2.
Add these lines to /etc/rc.conf, so that the daemons start at boot.
ntpdate_enable="YES" ntpdate_hosts="0.us.pool.ntp.org" snmpd_enable="YES" ntpd_enable="YES"
Ntpd will require the creation and population of the file /etc/ntp.conf, with these settings below. The 'echo restrict' line, should reflect your local network's address.
server 0.us.pool.ntp.org server 1.us.pool.ntp.org server 2.us.pool.htp.org restrict 192.168.125.0 mask 255.255.255.0 nomodify notrap driftfile /var/db/ntp.drift
Last, we start our daemons.
# /etc/rc.d/ntpd start # /usr/local/etc/rc.d/snmpd start
Prepare Configuration Files
Tell the sound driver to load. This driver is one that will try them all, then load the one it finds. Later, we can discover the one that is in use, and load just that one.
... so add that to /boot/loader.conf. That is a generic meta driver that will load every sound driver available, and if one works, your system will use it. Which driver it chooses can be later used to trim out this generic driver, and specify just the correct one. After you system is up and running with the generic sound driver, you can use these commands to see which drivers are loaded (kldstat will show all, and 'cat /dev/sndstat' will specify which sound driver is currently in use)
[root@athena ~]# kldstat Id Refs Address Size Name 1 14 0xc0400000 6ab778 kernel 2 1 0xc0aac000 5f60 snd_ich.ko 3 2 0xc0ab2000 22b88 sound.ko 4 1 0xc0ad5000 59960 acpi.ko 5 1 0xc382f000 16000 linux.ko 6 1 0xc39ca000 5000 i915.ko 7 1 0xc39cf000 e000 drm.ko [root@athena ~]# cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: pcm0: <Intel ICH6 (82801FB)> at io 0xcfdc0400, 0xcfdc0600 irq 21 bufsz 16384 kld snd_ich (1p/1r/0v channels duplex default)
As you might note, the output of my 'kldstat' shows that the module actually in use is 'snd_ich.ko'. Now that we know this, we can then add this line to /boot/loader.conf and specify just the module we need:
Building the Desktop Environment
Now we are finally ready to build the GUI environment. This part is quite lengthy; my Pentium 4 3.2 system took about 22 hours just to compile KDE. X.org was probably about 2 hours. I also include the Nvidia driver on my system, if you do not have an Nvidia based card, omit that step. Also, since xorg and KDE take so long to compile, we use batch mode for them.
NOTE - Currently, Xorg 7.2 has just been merged into the ports tree. This change affects a large number of ports, that now have a new dependency. Xorg 7.2 has its paths in a different area of the file system than 6.9 used, so this is definalty a big change. For the time being, Xorg 7.2 will not install without a special environment switch being enabled. This quote from /usr/ports/UPDATING:
It is necessary to set the XORG_UPGRADE environment variable while updating from xorg 6.9 to 7.2. Once the upgrade is complete this is no longer be required. For users of csh-like shells: # setenv XORG_UPGRADE yes For users of sh-like shells: # export XORG_UPGRADE=yes
So now we set out to install the desktop. I use the bash shell, but take note above and use the right enrivonment variable. By the way, I use 'BATCH=yes' here for xorg and kde, to keep them from pausing from any configuration screens... instead it will take what ever default options are presented, and continue on (as well as with each dependency).
# export XORG_UPGRADE=yes # cd /usr/ports/x11/xorg; make BATCH=yes install clean # cd /usr/ports/x11/kde3; make BATCH=yes install clean # cd /usr/ports/x11/nvidia-driver; make install clean
Start Your Desktop Environment
Log out root, and log in as your user. If you want KDE to start, you can insert the file .xinitrc into your homedir, and this will cause KDE to load.
$ touch .xinitrc $ echo exec startkde >> .xinitrc $ startx
X.org on my system was actually able to auto detect all my settings, but this was the first time I experienced this. If your system will not start the GUI on the first try, then its likely because you need to create an xorg.conf file in /etc/X11/. As root, use the command:
Add Some Useful Desktop Programs
Now that we are up and running, lets open a konsole and become root. Here is a sample of some of the programs I tend to add right away to a new system I build. You can literally spend days exploring and compiling interesting things from the ports collection, so I highly recommend you visit the ports page, and give it a search.
# cd /usr/ports/misc/kdeaddons3; make install clean # cd /usr/ports/graphics/gwenview; make install clean # cd /usr/ports/x11/xscreensaver-kde; make install clean # cd /usr/ports/security/nmap; make install clean # cd /usr/ports/sysutils/gkrellm2; make install clean # cd /usr/ports/www/firefox; make install clean # cd /usr/ports/net-im/gaim; make install clean # cd /usr/ports/print/acroread7; make install clean # cd /usr/ports/sysutils/cdrtools; make install clean