Chapter 10. Installing the X Window System
We come now to the X Window System — one of the most powerful and important software packages available for Linux. If you've ever used X on a Unix system before, you're in luck; running X under Linux is almost no different from running it under Unix systems. And, if you've never had the occasion to use it before, never fear: salvation is at hand.
It's difficult to describe the X Window System in a nutshell. X is a complete windowing graphics interface for Unix systems. It provides a huge number of options to both the programmer and the user. For instance, at least half a dozen window managers are available for X, each one offering a different interface for manipulating windows. By customizing the attributes of the window manager, you have complete control over how windows are placed on the screen, the colors and borders used to decorate them, and so forth.
Even if you have not heard about the X Window System yet, you may already have heard about KDE and GNOME. These are so-called desktop environments that provide a user-friendly work environment for your daily Linux work. We'll cover these in great detail in the next chapter.
X was originally developed by Project Athena at MIT and Digital Equipment Corporation. The current version of X is Version 11 revision 6 (X11R6), which was first released in April 1994. Since the release of Version 11, X has virtually taken over as the de facto standard for Unix graphical environments.
Despite its commercial use, the X Window System remains distributable under a liberal license from the X Consortium. As such, a complete implementation of X is freely available for Linux systems. XFree86, an implementation of X originally for i386 Unix systems, is the version that Linux uses most often. Today, this version supports not only Intel-based systems, but also Alpha AXP, MicroSPARC, PowerPC, and other architectures. Further architectures will follow. XFree86 is based on X386-1.2, which was part of the official X11R5 sources, but is no longer maintained and is therefore outdated. The current versions now have very little in common with their ancestors. Support for innumerable graphics boards and many other operating systems (including Linux) has been added — and XFree86 implements the latest version, X11R6.3.
We should mention here that commercial X Window System servers are available for Linux that may have advantages over XFree86 (like support for certain video cards). Most people use XFree86 happily, though, so this should certainly be your first stop.
Linux distributions usually automatically install X. If you're lucky, you won't need this chapter at all. But a few users aren't lucky — the distribution doesn't recognize some graphics hardware, writes a file to the wrong location so that the X server can't start up, or has some other problem. One of the big advantages of this book is that we take you down to the depths of X configuration so that you can get it running no matter what your distribution does. You may not need to read this chapter, but if you do need it, you'll appreciate everything that's here.
One word of advice: if you plan to run your Linux machine as a server only, there is no need to install X on it (unless you want to use graphical administration tools). X requires system resources, and if your system never has a monitor attached to it, installing X is a waste of time and resources.
In this chapter, we will tell you how to install and configure the X Window System, and in the next chapter, we will explore how to use X.
10.1. X Concepts
X is based on a client-server model in which the X server is a program that runs on your system and handles all access to the graphics hardware. An X client is an applications program that communicates with the server, sending it requests, such as "draw a line" or "pay attention to keyboard input." The X server takes care of servicing these requests by drawing a line on the display or sending user input (via the keyboard, mouse, or whatever) to the client application. Examples of X clients are the now-famous image manipulation program GIMP and the many programs coming out of the aforementioned desktop environments KDE and GNOME — e.g., the KDE email program kmail.
It is important to note that X is a network-oriented graphics system. That is, X clients can run either locally (on the same system that the server is running) or remotely (on a system somewhere on a TCP/IP network). The X server listens to both local and remote network sockets for requests from clients. This feature is obviously quite powerful. If you have a connection to a TCP/IP network, you can log in to another system over the network and run an X application there, directing it to display on your local X server.
Further advantages of X are security (if the user so desires), the modular separation of functions, and the support for many different architectures. All this makes the X Window System technically superior by far to all other window systems.
The X Window System makes a distinction between application behavior and window management. Clients running under X are displayed within one or more windows on your screen. However, how windows are manipulated (placed on the display, resized, and so forth) and how they are decorated (the appearance of the window frames) are not controlled by the X server. Instead, such things are handled by another X client called a window manager that runs concurrently with the other X clients. Your choice of window manager will decide to some extent how X as a whole looks and feels. Most window managers are utterly flexible and configurable; the user can select the look of the window decoration, the focus policy, the meaning of the mouse buttons when the mouse is on the background part of the screen rather than on an application window, and many other things by editing the configuration files of the window manager. More modern systems even let you configure those aspects over a GUI.
In order to fully understand the concept of window managers, you need to know that the window manager does not affect what the client application does within the window. The window manager is only in charge of painting the window decoration — that is, the frame and the buttons that let you close, move, and resize windows.
There can be only one window manager on any X server. Theoretically, it is even possible to completely do away with window managers, but then you would not be able to move windows around the screen; put a hidden window on top; or minimize, maximize, or resize windows unless the programs themselves provide this functionality.
Let's shortly mention the desktop environments again. A desktop environment like KDE and GNOME is a collection of applications and tools with a common look-and-feel as well as many other common properties — e.g., the menus of the applications could all be set up according to the same concepts. Desktop environments on X always need a window manager, as described earlier. Some desktop environments provide their own window manager (such as kwin in the KDE desktop environment), while others do not have their own window manager. It is up to the user to install a window manager of his or her choice.
Copyright © 2003 O'Reilly & Associates. All rights reserved.