Section 7.2. Objective 1: Install and Configure X11


7.2. Objective 1: Install and Configure X11

Most Linux distributions install and automatically configure XFree86, freeing users from much of its installation and configuration. However, Exam 101 requires specific knowledge of some of the underpinnings of X configuration.


Warning: Be careful about installing an X server on a system that already has X installed. A backup should be made prior to the installation.

7.2.1. Selecting and Configuring an X Server

The XFree86 project provides support for an amazing array of graphics hardware. This outcome is possible partly due to cooperation by manufacturers through public release of graphics device documentation and driver software, and partly due to the tenacity of the XFree86 developers. Fortunately, many manufacturers who were historically uninterested in offering technical information to the XFree86 project have become cooperative. The result is that most recent video hardware is well-supported by XFree86.

7.2.1.1. Supported video hardware

To avoid problems, it is important to verify XFree86 compatibility with your hardware prior to installation. At the very least, you should be aware of these items:


Your XFree86 version

As with any software, improvements in XFree86 are made over time, particularly in support for hardware devices. You should choose a version of XFree86 that offers a good balance between the video support and stability you require. To determine the version of X you're running, simply issue the following command:

 $ /usr/X11R6/bin/X -version XFree86 Version 4.0.1a / X Window System 


The video chipset

XFree86 video drivers are written for graphics chipsets, not the video cards they're installed on. Multiple video cards from a variety of manufacturers can carry the same chipset, making those cards nearly identical in function. You must verify that the chipset on your video card is supported by XFree86 to use advanced graphics features.


Monitor type

XFree86 can be configured to handle just about any monitor, particularly the newer and very flexible multisync monitors sold today, which can handle preset configurations provided in the XFree86 configuration utilities. However, if you have a nonstandard monitor, you need to know some parameters describing its capabilities before configuring X, including your monitor's horizontal sync frequency (in kHz), vertical refresh frequency (in Hz), and resolution (in pixels). These items can usually be found in your monitor's documentation, but since most monitors conform to standard display settings such as XGA (1024x768 pixels at 60 Hz vertical refresh), you should be able to use a preset configuration.

7.2.1.2. Installing XFree86

The procedures for installation vary depending on the release of X you're using. For example, with versions prior to 4.0, a specific X server is required to match your chipset to use modes other than standard VGA. For versions after 4.0, a newer modular design allows a single server program to manage all supported chipsets by calling driver modules. In addition, the type of XFree86 distribution you're using affects installation. XFree86 is available as source code, in precompiled binary form, or as an RPM or Debian package.

It is rare that you'll actually need to install XFree86 by hand, as XFree86 is typically installed during initial system installation for systems that plan to use X. Most Linux distributions include XFree86 packages on the installation media so you can install them from there using your distribution's choice of package managers.

Some applications might require that you install a new release or development version of XFree86 that is not available as a package. In these cases, you can download the source files or precompiled binaries from XFree86's mirror web sites, listed at http://www.xfree86.org. Refer to Chapter 4 for more information on installing applications from packages or source.

7.2.1.3. Configuring an X server and the XF86Config file

XFree86 configuration differs slightly among versions and among Linux distributions, but essentially involves the creation of the XF86Config file customized for your system. The X server uses this configuration file as it starts to set such things as keyboard and mouse selections, installed fonts, and screen resolutions.

XF86Config contains technical details concerning the capabilities of system hardware, which can be intimidating for some users. For this reason, automated configuration tools are available that will generate the file for you:


xf86config

This program is distributed with XFree86. It is a simple text-mode program that requests information about the system from the user and then writes a corresponding XF86Config file. This utility does not use information stored in an existing configuration file, so its utility is limited. (Remember that xf86config is a binary program that writes the XF86Config text file.)


XF86Setup

This program was distributed with XFree86, though some distributions, such as Red Hat, have deprecated the tool. XF86Setup is a graphical program that starts a VGA X server, which should run on most PC hardware. It allows you to select the graphics chipset, monitor, mouse, and keyboard device types and writes the appropriate configuration file for you. As of XFree86 4.3.0, XF86Setup hasn't been updated for the new 4.x configuration. XFree86 plans to make it available again in a future version.


xvidtune

This program is used to fine-tune video settings, adjusting your video display to your monitor. xvidtune allows you to move your display up and down, left and right, similar to your monitor controls but with a command-line interface. Depending on your video chipset, xvidtune may also support a number of other options including invert states and screen wrapping.


xf86cfg

This program is distributed with XFree86 v4.0. Like XF86Setup, it is a graphical tool; however, xf86cfg's interface is slightly different. Whereas other tools offer a menu-based approach, xf86cfg offers a block diagram of the system, including a monitor, video device, keyboard, and mouse. The user configures each element by manipulating its properties. When the user is happy with the configuration, the tool writes the XF86Config file.


Distribution-specific tools

Various Linux distributors provide their own configuration utilities. For example, redhat-config-xfree86 is distributed by Red Hat Software. It is an X based GUI tool that can probe graphics chipsets and features. Older Red Hat systems (7.x and older) used a menu-based system called Xconfigurator.

Example 7-1 contains an abbreviated XF86Config file created using the Red Hat Xconfigurator tool for XFree86 v3.3.3. (The XF86Config files shown here are examples and are not intended for use on your system.)

Example 7-1. A sample XF86Config file for XFree86 v3.3.3

 # File generated by XConfigurator. Section "Files"         RgbPath    "/usr/X11R6/lib/X11/rgb"         FontPath   "unix/:-1" EndSection Section "ServerFlags" EndSection Section "Keyboard"         Protocol    "Standard"         AutoRepeat  500 5         LeftAlt     Meta         RightAlt    Meta         ScrollLock  Compose         RightCtl    Control         XkbDisable         XkbKeycodes     "xfree86"         XkbTypes        "default"         XkbCompat       "default"         XkbSymbols      "us(pc101)"         XkbGeometry     "pc"         XkbRules        "xfree86"         XkbModel        "pc101"         XkbLayout       "us" EndSection Section "Pointer"         Protocol    "PS/2"         Device      "/dev/mouse"         Emulate3Buttons         Emulate3Timeout    50 EndSection Section "Monitor"         Identifier  "My Monitor"         VendorName  "Unknown"         ModelName   "Unknown"         HorizSync   31.5 - 64.3         VertRefresh 50-90         # 1280x1024 @ 61 Hz, 64.2 kHz hsync         Mode "1280x1024"                 DotClock    110                 Htimings    1280 1328 1512 1712                 Vtimings    1024 1025 1028 1054         EndMode EndSection Section "Device"         Identifier  "My Video Card"         VendorName  "Unknown"         BoardName   "Unknown"         VideoRam    16256 EndSection Section "Screen"         Driver      "svga"         Device      "My Video Card"         Monitor     "My Monitor"         Subsection "Display"                 Depth       32                 Modes       "1280x1024"                 ViewPort    0 0         EndSubsection EndSection 

Under v3.3.3, the default location for the XF86Config file is in /usr/X11R6/lib/X11, though many distributions use /etc/X11. The file contains the following sections:


Files

This section is used to specify the default font path and the path to the RGB database. Using the FontPath "path" directive multiple times creates a list of directories that the X server will search for fonts. The RGB database is an equivalence table of numeric red/green/blue color values with names. Here's a short excerpt of the RGB database:

 255 228 196             bisque 255 218 185             peach puff 255 218 185             PeachPuff 255 222 173             navajo white 

Hundreds of these names are defined and may be used in the configuration of X applications where color names are required.


ServerFlags

This section allows customization of X server options such as the handling of hotkeys.


Keyboard

This section is used to specify the keyboard input device, its parameters, and default keyboard-mapping options.


Pointer

This section is used to define the pointing device (mouse).


Monitor

Multiple Monitor sections are used to define the specifications of monitors and a list of video modes they can handle.


Device

Multiple Device sections are used to define video hardware (cards) installed.


Screen

The Screen section ties together a Device with a corresponding Monitor and includes some configuration settings for them.

On the Exam

You don't need to memorize details about XF86Config, but it is an important file, and your familiarity with it will be tested. In particular, be aware of what each of the sections does for the X server, and remember that the Screen section ties together a Device and a Monitor.


The XF86Config file format was modified slightly for XFree86 v4.0. In particular, a new ServerLayout section has been added; it ties the Screen, Pointer, and Keyboard sections together. Example 7-2 contains an abbreviated XF86Config file created using the bundled xf86cfg tool from the XFree86 project.

Example 7-2. A Sample XF86Config file for XFree86 v4.0.1

 Section "ServerLayout"         Identifier     "XFree86 Configured"         Screen      0  "Screen0" 0 0         InputDevice    "Mouse0" "CorePointer"         InputDevice    "Keyboard0" "CoreKeyboard" EndSection Section "Files" EndSection Section "InputDevice"         Identifier  "Keyboard0"         Driver      "keyboard" EndSection Section "InputDevice"         Identifier  "Mouse0"         Driver      "mouse"         Option      "Protocol" "PS/2"         Option      "Device" "/dev/mouse" EndSection Section "Monitor"         Identifier   "Monitor0"         VendorName   "Monitor Vendor"         ModelName    "Monitor Model"         HorizSync    31.5 - 64.3         VertRefresh  50.0 - 90.0 EndSection Section "Device"         Identifier  "Card0"         Driver      "nv"         VendorName  "NVidia"         BoardName   "Riva TNT"         ChipSet     "RIVATNT"         BusID       "PCI:1:0:0" EndSection Section "Screen"         Identifier    "Screen0"         Device        "Card0"         Monitor       "Monitor0"         DefaultDepth  24         SubSection "Display"                 Depth     24         EndSubSection EndSection 

Under v4.0, the default location for the XF86Config file is in /etc/X11. The file contains the following sections:


ServerLayout

This section ties together Screen with one or more InputDevices. Multiple ServerLayout sections may be used for multiheaded configurations (i.e., systems with more than one monitor).


Files

This section is used to add paths to fonts and color information, just as it is in XFree86 v3.3.3.


InputDevice

Multiple InputDevice sections should be used to include at least a keyboard and mouse. Subsections within InputDevice in v4.0 replace the Pointer and Keyboard sections for XFree86 v3.3.3.


Monitor

This section is similar to the Monitor section for XFree86 v3.3.3, except that mode specifications are not usually necessary. The X server is already aware of standard VESA video modes and chooses the best mode based on the horizontal sync and vertical refresh rates.


Device

This section specifies the modular driver for the X server. Multiple Device sections can be included to handle multiple graphics devices.


Screen

This section ties together a Monitor with a Device and is specified in the ServerLayout. Multiple Screen sections can be included to handle multiple monitor/device pairs.

On the Exam

As already mentioned, you don't need to worry about details in XF86Config. However, you should be aware of the major differences in the configuration files for XFree86 Versions 3.3 and 4.0.


7.2.2. X Fonts

XFree86 is distributed with a collection of fonts for most basic purposes, including text displays in terminal windows and browsers. For many users, the default fonts are adequate, but others may prefer to add additional fonts to their system. A variety of fonts are available, both free and commercially, from many sources, such as Adobe. Some very creative fonts are created by individuals and distributed on the Internet (a search should return some useful links to a query such as XFree86 fonts).

XFree86 makes fonts that it finds in the font path available to client programs. A basic font path is compiled into the X server, but you can specify your own font path using the FontPath directive in the Files section of XF86Config. The simple syntax is:

 FontPath "path" 

For example:

 Section "Files"         RgbPath    "/usr/X11R6/lib/X11/rgb"         FontPath   "/usr/X11R6/lib/X11/fonts/misc"         FontPath   "/usr/X11R6/lib/X11/fonts/Type1"         FontPath   "/usr/X11R6/lib/X11/fonts/Speedo"         FontPath   "/usr/X11R6/lib/X11/fonts/100dpi"         FontPath   "/usr/X11R6/lib/X11/fonts/75dpi"         FontPath   "/usr/X11R6/lib/X11/fonts/local" EndSection 

This group of FontPath directives creates a font path consisting of six directories, all under /usr/X11R6/lib/X11/fonts. When XFree86 starts, it parses these font directories and includes their contents in the list of fonts available during the X session.

7.2.2.1. Installing fonts

Adding new fonts is straightforward. (For this brief discussion, we assume that we're working with Type 1 fonts. Other types, such as TrueType fonts, may require additional configuration depending on your version of XFree86.) First, a suitable directory should be created for the new fonts, such as /usr/X11R6/lib/X11/local or /usr/local/fonts. You may wish to separate your own fonts from the default XFree86 directories to protect them during upgrades. After the fonts are installed in the new directory, the mkfontdir utility is run to catalog the new fonts in the new directory. New entries are added to the XF86Config file to include the path for new fonts. For example:

 FontPath   "/usr/local/fonts" 

At this point, the X server can be restarted to recognize the new fonts, or the fonts can be dynamically added using the xset command:

 # xset fp+ /usr/local/fonts 

xset is beyond the scope of the LPIC Level 1 exams.

On the Exam

Be sure you understand how the X font path is created and how to extend it to include additional directories. Knowledge of the internal details of font files is not necessary.


7.2.2.2. The X font server

On a network with multiple workstations, managing fonts manually for each system can be time consuming. To simplify this problem, the administrator can install all of the desired fonts on a single system and then run xfs, the X fonts server, on that system. On a local system, xfs off-loads the work of rendering fonts from the X server, which means the X server can do other tasks while fonts are being rendered. This is especially noticeable on slower systems or systems without an FPU.

The X font server is a small daemon that sends fonts to clients on both local and remote systems. Some Linux distributions use xfs exclusively, without a list of directories in the manually created font path. To include xfs in your system's font path, add a FontPath directive like this:

 Section "Files"         RgbPath     "/usr/X11R6/lib/X11/rgb"         FontPath   "unix/:-1" EndSection 

If you install xfs from a package from your distribution, it is probably automatically configured to start at boot time and run continually, serving fonts to local and remote client programs. To start xfs manually, simply enter the xfs command. For security purposes, you may wish to run xfs as a non-root user. xfs is configured using its configuration file, /etc/X11/fs/config. Example 7-3 contains an example config file for xfs.

Example 7-3. Sample configuration file for xfs

 # Allow a max of four clients to connect to this font server client-limit = 4 # When a font server reaches its limit, start up a new one clone-self = on catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,             /usr/X11R6/lib/X11/fonts/75dpi:unscaled,             /usr/X11R6/lib/X11/fonts/100dpi:unscaled,             /usr/X11R6/lib/X11/fonts/misc,             /usr/X11R6/lib/X11/fonts/Type1,             /usr/X11R6/lib/X11/fonts/Speedo,             /usr/X11R6/lib/X11/fonts/75dpi,             /usr/X11R6/lib/X11/fonts/100dpi,             /usr/share/fonts/ISO8859-2/100dpi,             /usr/share/fonts/ISO8859-9/100dpi,             /usr/X11R6/lib/X11/fonts/local # In 12 points, decipoints default-point-size = 120 # 100 x 100 and 75 x 75 default-resolutions = 75,75,100,100 # How to log errors use-syslog = on 

As you can see, the config file contains the following keyword=value pairs:


catalogue

This keyword holds a comma-separated list of directories containing fonts to be served by xfs. This is where new font directories are added.


alternate-servers (strings)

This section contains a listing of alternate font servers that can be found on the local machine or on other machines.


client-limit

This shows the maximum number of client requests to be served.


clone-self

When on, the font server makes copies of itself if it reaches the client-limit.

You don't need to remember details about the contents of the xfs configuration file (config), but be aware of the use and general contents of the file. In particular, remember that the catalogue keyword is used similarly to FontPath in XF86Config.

On the Exam

Remember that xfs can take the place of the list of directories in a manually configured font path. However, running xfs doesn't replace the font path. xfs itself must be on that path as shown earlier in Example 7-1 with the FontPath 'unix/:-1' entry.


7.2.3. Controlling X Applications with .Xresources

The X Window System also has many built-in customization features. Many X applications are programmed with a variety of resources, which are configuration settings that can be externally manipulated. Rather than have a configuration utility built into each application, applications can be written to examine the contents of a file in the user's home directory. The .Xresources file contains a line for each configured resource in the following form:

 program*resource: value 

This line can be translated as follows:

  • program is the name of a configurable program, such as emacs or xterm.

  • resource is one of the configurable settings allowed by the program, such as colors.

  • value is the setting to apply to the resource.

For example, the following is an excerpt from .Xresources that configures colors for an xterm:

 xterm*background: Black xterm*foreground: Wheat xterm*cursorColor: Orchid xterm*reverseVideo: false 

On the Exam

You should be aware of X resources and the function of the .Xresources file. In particular, you should understand that X applications will look in the .Xresources file for settings. You should also be able to construct a resource setting given a particular example, but you do not need to be able to generate a configuration file from scratch.




LPI Linux Certification in a Nutshell
LPI Linux Certification in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596005288
EAN: 2147483647
Year: 2004
Pages: 257

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net