Selecting KDE
Many distributions allow you to select whether to use KDE, GNOME, or some other desktop during installation. Switching desktops is usually fairly simple after installation, however. The only complicated part is determining how your particular distribution starts the desktop.
Using the Display Manager
If you're using either gdm (the GNOME display manager), or kdm (the KDE display manager) you can select your desktop during login using the Session (or Session type) menu.
After you have selected your desktop once, the display manager will remember it when you log in again. Just leave the setting as Default.
Using Switchdesk
Red Hat includes a utility called switchdesk that enables you to easily change between GNOME, KDE, and twm (a simple window manager). From the command line, enter
$ switchdesk-kde
then select the desktop you want (KDE in this case), and press OK.
The option Change Only Applies to Current Display enables you to have different desktops for different displays. Generally changing displays indicates that you are logging in from a different machine. For example, you might have an NCD X terminal (a machine that displays X, but doesn't do any computations of its own and has no operating system). If your X terminal is across a slow network link, you might prefer to use a lightweight desktop like twm instead of KDE.
Tip - You can use another utility called switchdesk-gnome instead of switchdesk-kde. The difference between these tools is in the toolkits used for displaying the dialogs. Either tool can be used to select either desktop.
Selecting KDE Manually
If you want to select KDE by hand, you can modify the configuration files directly. This can be useful if you have a very customized start-up sequence or if you are running Debian (which has no built-in support for KDE).
To modify the default desktop for all users under Red Hat and similar distributions, edit /etc/sysconfig/desktop and enter KDE as a single line. This will automatically set the desktop for all users who haven't selected their own already.
If you want to set the default desktop for a single user under Red Hat, edit ${HOME}/ .Xclients to read exec startkde.
Under Debian, there is no easy way to set the default desktop, though you could modify /usr/bin/x-window-manager if you understand shell scripting. To modify the desktop for a given user, edit ${HOME}/.xsession to read exec startkde. Then verify that /etc/X11/ Xsession.options includes a line reading allow-user-xsession.
OpenLinux has no native support for anything but KDE, so there's no need to modify anything to use KDE as default.
Tip - ${HOME}/.Xclients or ${HOME}/.xsession is the last file run by the window manager start-up sequence, so this is the place for anything you want run before your window manager. Running your window manager should always be the last line of this file, and should always be preceded with exec (as in exec startkde). The exec tells the shell to completely replace itself with the window manager. Otherwise, an unnecessary copy of your shell will be left in memory. See "SHELL BUILT-IN COMMANDS" in the bash man page for more information on exec.
${HOME}/.Xclients or ${HOME}/.xsession should be executable. You can make them executable by running the following:
$ chmod u+x ${HOME}/.Xclients
If you are using .xsession, of course, replace .Xclients in the preceding command.
Note - If you have set environment variables in your ${HOME}/.bash_profile (Red Hat/ OpenLinux) or ${HOME}/.profile (Debian), KDE might not know about them. This will affect things such as your PATH setting when using the Run Commands dialog. If this is a problem, you can use the following .Xclients (or .xsession) to fix it:
if [ -e ${HOME}/.bash_profile ]; then . ${HOME}/.bash_profile elsif [ -e ${HOME}/.profile ]; then . ${HOME}/.profile fi exec startkde