General Information
This guide demonstrates the ease of installing Xorg and KDE on FreeBSD 5.x.
Requirements
- root access
- Internet access or FreeBSD 5.x CD-Rom Discs
Note: For FreeBSD 5.3 and prior only disk 1 is needed. For FreeBSD 5.4 and later, disk 2 is also needed.
- A working FreeBSD installation without Xorg or KDE installed.
Installation
Login and su to root (alternated logging in as root will work but is not recommended).
You may install packages from the CD-Rom or from the Internet. Another option is to install from ports. It is much faster to use the CD-Rom. Be aware that versions 5.3 and previous have Xorg and KDE on the first CD while versions starting with 5.4 have Xorg and KDE on the second CD.
Installing from CDROM
To install from the CD-Rom, put the FreeBSD 5.x CD-Rom in your drive. Remember for 5.4 and later Xorg and KDE are on the second CD.
Mount the CD.
# mount /cdrom
Install Xorg from the packages directory on the CD. Make sure you find the correct package file as the one listed in the command below is for 5.3. The version on your CD may be different.
# pkg_add /cdrom/5.3-RELEASE/packages/x11/xorg-6.7.0_1.tbz
- Xorg will install -
Install KDE from the packages directory on the CD. Make sure you find the correct package file as the one listed in the command below is for 5.3. The version on your CD may be different.
# pkg_add /cdrom/5.3-RELEASE/packages/x11/kde-3.3.0.tbz
- KDE will install -
# pkg_add /cdrom/5.3-RELEASE/packages/x11/kde-lite-3.3.0.tbz
Installation from Internet packages
Install Xorg by simply running the following command:
# pkg_add -r xorg
- Xorg will install along with all dependencies -
Install KDE by simply with the following command:
# pkg_add -r kde-lite
- KDE will install along with all dependencies -
# pkg_add -r kde-lite
Installation from ports
Change to the /usr/ports/x11/xorg directory and start the installation Xorg.
# cd /usr/ports/x11/xorg # make batch=yes install distclean
- Xorg will compile and install along with all dependencies -
Change to the ports directory for KDE and start the installation kde.
# cd /usr/ports/x11/kde3 # make batch=yes install distclean
- KDE will compile and install along with all dependencies -
Configuration
Make sure to run rehash or hash -r once the applications are installed. Otherwise, you will get an error running the Xorg configuration command. Since you just installed X.org, the command may not be registered with your shell. The rehash or hash -r command will register commands from newly installed ports.
# rehash
- or -
# hash -r
Configuring Xorg with xorgcfg
To configure X.org, run the following command.
# xorgcfg -configure
This will bring up the window.

Select OK and hit enter. You will see the following screen.

This screen will allow you to configure all the settings for X.org. Hit enter to configure your mouse. You will see the following screen.

You don’t have to change the default identifier name. Just hit enter to go to the next screen that prompts for your mouse protocol.

You want to choose Auto, it is already selected by default, so just hit enter to continue. You will be prompted as to whether you would like to enable three button emulation on the screen below.

Select No (unless you have an old mouse with only two buttons with no scroll bar) and hit enter. You will be asked what your mouse device is.

Leave the default as ‘/dev/sysmouse‘ and hit enter.
If you want to enable your scroll bar, you should read the very last entry in the above guide.

You will be taken back to the Main Menu.

Notice the next option, configure keyboard, is automatically highlighted. Hit enter to start configuring your keyboard. You will be prompted for the identifier for your keyboard.

You don’t have to change the default identifier name. Just hit enter to go to the next screen that prompts for your keyboard model.

Once you have found your keyboard layout, select it and hit enter. You will be prompted for your keyboard layout.

Select your appropriate layout for your keyboard. You will be taken back to the main menu. The next option to configure your monitor will be highlighted.

Hit enter to configure your monitor and you will be prompted for a monitor identifier.

You don’t have to change the default identifier name. Just hit enter to go to continue.

Click Next to continue. You will be prompted for your Horizontal sync.

If you know your monitor’s settings, enter them manually. If you are unsure and you don’t have the manual for your monitor, you will have to guess. A good guess may be the following option:
31.5 – 57.0; High Frequency SVGA, 1024×768 @ 70 Hz
If that does not work you can reconfigure X.org again with an alternate setting.
Once you make your selection, you will be prompted for vertical sync range.

Select the appropriate vertical sync (or Vertical Refresh rate) of your monitor. If you are unsure, it is usually safe to choose 50 – 70. If that does not work you can reconfigure X.org again with an alternate setting.
Make your selection and click next. You will be taken back to the main menu. The next option to configure your video card will be highlighted.

Hit enter to begin configuring your video card. You will be prompted for your video card identifier.

You don’t have to change the default identifier name. Just hit enter to go to the next screen that prompts if you want to look at the card database.

Hit enter to select Yes. You will get a long list of cards that are in the card database.

Scroll through the list of cards and find the card that most closely matches your card. Highlight it and hit enter to select it.
Once you select your video card, you be asked for a Card Bus ID.

Leave this blank and hit enter. You will now be taken back to the Main Menu.

Hit enter to configure you screen. You will be prompted for your screen identifier.

You don’t have to change the default identifier name. Just hit enter to go to the next screen that prompts you to select the video card.

If you selected the defaults in previous configuration steps, you will see only one option, Card0. Hit enter to select Card0 and continue. You will now be prompted for the monitor.

If you selected the defaults in previous configuration steps, you will only see one option, Monitor0. Hit enter to select Monitor0 and to continue. You will now be prompted for the screen depth.

Most monitors and video cards can handle the highest setting of 24 bits. If you have a newer video card, a newer monitor, and you found a close match to your video card when you configured it, select 24 bits and hit enter.
Once you have selected your screen depth, you will be prompted for your screen modes.

If you know which settings your video card and monitor support, select them by highlighting the option and hitting the space bar.
Once you have selected the settings your hardware supports, hit enter to finish configuring your screen settings. You will now be taken back to the Main Menu. Notice that the next option to configure your layout will be automatically be highlighted.

Hit enter to begin configuring your screen. You will be prompted for a screen identifier.

You don’t have to change the default identifier name. Just hit enter.

This screen informs you that since you have only one screen, mouse, and keyboard, your layout configuration will be automatically created.
Hit enter to finish. You will now be taken back to the Main Menu. Notice that the next option to Write your X.org config will be automatially be highlighted.

Hit enter to save your X.org config and to finish the X.org configuration. You will be prompted save your X.org configuration file.

Leave the default location /etc/X11/xorg.conf and hit enter to save. You will be taken back to a command prompt. X.org is now configured, however, we still need to configure the user settings to use KDE when Xorg is launched with startx.
Auto-creation of xorg.conf
Log in and su to root, then run the following command:
# Xorg -configure
This will auto detect the settings needed to create a configuration file for Xorg and save it as /root/xorg.conf.new
Copy /root/xorg.conf.new to the /etc/X11 directory as xorg.conf
# cp /root/xorg.conf.new /etc/X11/xorg.conf
X.org is now configured, however, we still need to configure the user settings to use KDE when Xorg is launched with startx.
Configuring User Settings to Run KDE when X is started
Make sure you are logged in as the user in question. Use the following command to create an .xinitrc file in your user directory that will tell X to load KDE when you run startx.
# echo "exec startkde" >> ~/.xinitrc
Now simply run startx.
# startx
Xorg should launch bringing up KDE.
Configuring FreeBSD Booting directly to an X login using KDM
Login and su to root. Now we want to edit a single line in /etc/ttys so that it when we boot up KDE's kdm utility will be called by ttyv8. Open /etc/ttys with a text editor such as ee or nano and find this line:
# ee /etc/ttys ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
Replace this line with the following line:
ttyv8 "/usr/local/bin/kdm" xterm on secure
# sed -i .bak '/ttyv8/s/X11R6/local/' ttys # sed -i .tmp '/ttyv8/s/xdm -nodaemon/kdm/' ttys # sed -i .tmp '/ttyv8/s/off/on/' ttys # rm ttys.tmp
The first command will create a backup of your original /etc/ttys file and modify the current /etc/ttys file. The next two commands modify the current file and since we don't want to overwrite the backup file, we use a .tmp file and then delete it.
Now simply reboot and your FreeBSD box should boot to a GUI KDE login screen.
# kill -HUP 1
See The following Guide for information on CD-Rom icons in KDE that will automatically mount a CD-Rom as a user.
http://bsdguides.org/guides/freebsd/beginners/kde_cd_icons.php
Troubleshooting X.org
If after running startx the computer hangs, or nothing happens, or if it starts and errors out, you may want to go back and reconfigure X.org with lower settings.
To see the log file for X.org, do the following command
# more /var/log/Xorg.0.log