-->
Previous Table of Contents Next


X on Linux

X is very hardware-dependent. In the UNIX workstation world, you don’t see many problems with this, because the UNIX vendors maintain tight control over the hardware and do the hard work of supporting X for that hardware.

The PC realm, though, is different. You have zillions of vendors and a huge number of combinations of various graphics cards, monitors, buses, even lowly mice. So, as we’ll repeat again and again, you need to know the intimate details of your hardware in order to get the X Window System up and running. If you’re used to the UNIX workstation world, this will come as a rude surprise. If you’ve already charted Chapters 1 and 2 of this book, it will less of a surprise.

X on Linux is actually in the form of XFree86, a public project devoted to bringing X Window to PC-based Unices. While there are some changes between a straight X Window System installation on a workstation and XFree86, you probably won’t notice these differences.

How XFree86 Works

Remember that X is both the X server (also named X) and a number of X application programs (also called clients). To get X going, you must first start the X server and then start a number of X applications. Almost always, one of these X applications will be a window manager.

To start X, you must first login your Linux system, such as in the following:


  Welcome to Linux 2.0.29

  yonsen login:

  Password:

Once you login and get the Linux shell prompt, you can start X with the startx script:


     yonsen~#: startx

This assumes that XFree86 has been configured correctly for your Linux installation, a process we’ll go over in a bit.

The startx script runs a program called xinit, which starts up the X server, /usr/X11R6/bin/X (you may be more familiar with /usr/bin/X on most other UNIX systems), and looks for a file named .xinitrc (note the leading dot) in your home directory. The .xinitrc file is a shell script that launches all the X applications you want. For example, our .xinitrc file launches a number of instances of the xterm program, which provides a shell window, and the rounded clock called oclock, as shown in Figure 3.4.


Figure 3.4  A typical X environment started from the .xinitrc file.

Before any of these programs is launched, though, the X server must be started, a task also handled by xinit.

The X server looks for the XFree86 configuration file—the most critical file for X on your system. This file, usually named XF86Config and stored in /usr/X11R6/lib/X11 (symbolically linked to /var/X11R6/lib), is a specially formatted file that tells XFree86 about your system’s hardware.

The hardest part about installing XFree86 on your system will be in fleshing out this file. There are tools that help, but the process is still dangerous and fraught with error.

The XF86Config file contains six sections, each of which describes some part of your system to the X server. We list these sections in Table 3.2.

Table 3.2 Sections in the XF86Config File
Section Usage

Files Tells where font and RGB files are located
ServerFlags Special X server flags like DontZap, which turns off the Ctrl-Alt-Backspace sequence that aborts the X server
Keyboard What kind of keyboard you have
Pointer Information on your mouse
Monitor Excruciating details about your monitor
Device Graphics card
Screen Combined card and monitor

Installing XFree86

To install and properly set up XFree86, a scary task under the best of conditions, you need to go through the following steps:

  Determine your system configuration.
  Set up the proper X server for your graphics card.
  Fill out the XF86Config file.
  Test that you can run X.
  Tune your XF86Config file.

We’ll cover all these steps in the rest of this chapter.

Virtually all of XFree86—including the version with the Slackware Linux on the accompanying CD-ROMs—installs into the /usr/X11R6 directory. Note that many other directories, such as /usr/bin/X11 and /usr/lib/X11, will be symbolic links into locations in /usr/X11R6.

If you installed Linux and XFree86 from the accompanying CD-ROM, all the files are in the right place.

If you picked up an update to XFree86 from the Internet, then you’ll likely need to unpack the collected files. Check the README file that was in the same directory as the XFree86 files you grabbed. Most likely, the files are compressed tar archives. For example, if you see a file like X312bin.tar.gz, you know that this file was compressed with GNU zip (.gz) from a tar file (.tar). To extract this file, use the following commands:


     mv X312bin.tar.gz /usr/X11R6

     cd /usr/X11R6

     gunzip X312bin.tar.gz

     tar xvof X312bin.tar

The first two commands move the XFree86 file (and your current working directory) to the /usr/X11R6 directory, where Linux expects X files to be located.

Especially if you acquired XFree86 over the Internet, you must untar any XFree86 archives as the root user. Otherwise, you’ll find that XFree86 does not install properly.

If you load XFree86 from the Slackware CD-ROM and use Slackware’s installation program, you shouldn’t have any problems.


Previous Table of Contents Next