Subscribe to William Computer Blog : Entries & Del.icio.us. Add this blog to Technorati Favorites

Installing X Windows System on FreeBSD

FreeBSD has always been my operating system of choice for servers but I never use them on the desktop. This time I decided to install FreeBSD 5.3 for desktop since I don’t want to spend money to buy a license of Windows operating system from Microsoft.

FreeBSD supports two X11 servers, the XFree86 and the Xorg. As of FreeBSD 5.3, Xorg became the default X Server on FreeBSD. So, I will be using Xorg on this guide instead of XFree86.

Installing and configuring Xorg.

I decided to install everything using the packages instead of building and installing them by using ports because building from ports will take a long time and use a lot of disk space.

pkg_add -r xorg
The above command will fetch and install Xorg on your FreeBSD system. Wait until everything finish. When the installation is finished, it’s time to configure Xorg. Xorg uses a configuration called xorg.conf and this configuration contains information on hardware devices such as your Video Cards, Keyboard, Mouse, Monitor Refresh Rates and screen resolution and color depths. You can read the explanation of all available options by typing man xorg.conf. We now create an initial configuration file. As root, type Xorg -configure in order for the Xorg server to load all video drivers module and probes for available hardware and write an initial configuration file called xorg.conf.new located in the /root directory. Once you’re done configuring, you can type Xorg -config xorg.conf.new to test the configuration file you edited. You will see a black and white screen with mouse if the configuration is successful. Press CTRL-ALT-BACKSPACE to exit out of the X Environment. Now copy the file xorg.conf.new to /etc/X11/xorg.conf. ### Installing Desktop Environment I finished installing and configuring X. Now, I want to install a desktop environment or window manager. I decided to use both gnome and KDE on my FreeBSD Desktop computer. Again, I decided to install both free desktop environment using packages instead of ports since it will take too long. To install KDE using package type:
pkg_add -r kde3
To install gnome using the package system, you can type:
pkg_add -r gnome2
A lite version of both gnome2 and kde3 is available on FreeBSD. The lite version of the gnome is called gnome2-lite and kde-lite, for the KDE version. ### Starting X at startup Since my computer is a desktop system and I don’t intend on turning it on 24 hours, I want to start X at startup. I don’t want to type startx every time I boot the computer. What I need here is a display manager, a graphical user interface login manager. The default display manager installed by Xorg is the xdm. I decided to use KDM, the display manager provided by KDE. The reason for choosing KDM is because it is prettier and more importantly it allows me to choose which desktop environment I want to use. To make KDM run when the machine boots, I edited the file /etc/ttys and to line 44 where the name of the terminal device is called ttyv8. I changed that line to the following:
Ttyv8   "/usr/local/bin/kdm"        xterm   on secure

It’s done! I got X Windows system installed. I can now login as root and type kdm or reboot the machine to test if kdm starts at boot time.

3 comments so far

1. Spleenie 1 Feb 2005

I found your piece on setting up x-windows on FreeBSD quite useful :) I had never bothered trying to figure it out, but it turns out it wasn’t really that hard hehe

Cheers, Spleenie

2. MK 5 Feb 2005

This sounds to be very easy to successfully install X on FreeBSD 5.3 and it indeed is easy, but successful installation doesn’t guarantee everything works fine… 5.3-RELEASE sucks!

3. Slash 13 May 2005

Thanks for the tip….everything is up and running just fine!

— Slash