Ict-innovation/LPI/106.1

= 106.1 Install and Configure X11 = Candidates should be able to install and configure X11.

Key Knowledge Areas


 * Verify that the video card and monitor are supported by an X server.


 * Awareness of the X font server.


 * Basic understanding and knowledge of the X Window configuration file.

Introduction
The X Windows system was developed as the display component of Project Athena at the Massachusetts Institute of Technology. It is the graphical environment for UNIX. The X Window system for Linux is based on the freely distributable port of X Window version 11 release 6 (Commonly referred to as X11R6).

This freely distributable port is commonly known as xfree86 for the 80386/80486 and Pentium processor families. Since its initial port, Xfree86 has been ported to other computing platforms, including System V/386 and 386BSD.



The above diagram shows the components of the X11R6 server. The “Section” names refer to configuration sections in the XF86Config configuration file (covered in the next section).

The two clients depicted on top of the server are so-called x-applications (e.g. xclock or xterm). The window manager is also a client. Window managers add “windowing” facilities around the other x-application clients, allowing functionalities such as window dragging, focus, iconification, etc.

Configuring X11R6
Two of the configuration utilities provided with the Xfree86 software are the XF86Setup and xf86config scripts. Other vendors have specific utilities such as:

Xconfigurator, redhat-config-xfree86 (RedHat)

XFdrake (Mandrake)

sax (Suse)

Once the server has been configured one can change the horizontal and vertical settings for the monitor with xvidtune.

All the above mentioned configuration utilities will create and edit the XF86Config configuration file. This file is read at start up by the X Server and determines its behavior. This file is typically found in the /etc/X11 directory, and this is its’ full path: /etc/X11/XF86Config.

There are 11 configuration sections in the config file, they are listed below:


 * ServerFlags


 * Module


 * InputDevice


 * Device


 * VideoAdapter


 * Monitor


 * Modes


 * Screen


 * ServerLayout


 * DRI


 * Vendor

One of the first sections is the Section “Files”. The <tt>FontPath</tt> keyword tells whether to get fonts from a local directory or from a font server. The <tt>RgbPath</tt> keyword is used to indicate the full path to rgb text file used to map color names to RGB notation:

Section “Files”

FontPath “/path/to/fonts/dir/”

FontPath “trans/hostname: port”

RgbPath "/path/to/rgb"

EndSection

Where trans is the transport type unix, hostname is the fully qualified domain name of the font server, and port is the port to connect to, usually port 7100.

Example:

FontPath “unix/:7100” # Local Font Server

FontPath “unix/myfontserver.mydomain.com:7100”

Below is a sample XF86Config file:

Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" FontPath "/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/" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "keyboard" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/psaux" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "Primary Monitor" VendorName "Unknown" ModelName "Unknown" HorizSync 31.5-37.9 VertRefresh 55-90 Modeline "800x600" 40.00 800 840 968 1056 600 601 605 628 +hsync +vsync EndSection Section "Device" Identifier "Primary Card" VendorName "Unknown" BoardName "None" VideoRam 2048 EndSection Section "Screen" Driver "Accel" Device "Primary Card" Monitor "Primary Monitor" DefaultColorDepth 24 BlankTime 0 SuspendTime 0 OffTime 0 SubSection "Display" Depth 24 Modes "800x600" EndSubSection SubSection "Display" Depth 32 Modes "800x600"

Controlling X clients
Setting Fonts and Colours

X clients are configured using the .Xresources or .Xdefaults file. These file are kept in the users home directory. It is not automatically created by default, as system-wide defaults are also available for each program.

Below is an extract from a .Xresources:

xterm_color*background: Black xterm_color*foreground: Wheat xterm_color*cursorColor: Orchid xterm_color*reverseVideo: false xterm_color*scrollBar: true xterm_color*saveLines: 5000 xterm_color*reverseWrap: true xterm_color*font: fixed xterm_color.geometry: 80x25+20+20 xterm_color*fullCursor: true xterm_color*scrollTtyOutput: off xterm_color*scrollKey: on term_color*VT100.Translations: #override\n\ <KeyPress>Prior : scroll-back(1,page)\n\ <KeyPress>Next : scroll-forw(1,page) xterm_color*titleBar: false

Each of these directives is a system default directive that describes how a client will be displayed. Each line consists of the client name followed by an asterisk and the X Window parameter. Through a carefully configured .Xresources file the user can define the way a client will look each time it is started.

The DISPLAY Variable

When an x-application (or X client) is started it needs to know which X server to run on. An X server is referred to as a display. For example the first X server you start ( using <tt>startx</tt> for example) is called :0 the second would be called :1 and so on. The first X server (or display) running on the host 192.168.1.99 is called 192.168.1.99:0

Most native X clients such as <tt>xterm </tt>or <tt>xclock</tt> have a -display switch which can be used to set the display. But the easiest method is to set the environment variable called DISPLAY!

The next two commands are equivalent:

However the X server on the host 192.168.1.99 will not allow this x-application to run. The user that started the X server on the remote host (192.168.1.99) needs to run the<tt> xhost </tt>command. This tool can selectively add or remove hosts to an access control list.

Example: Allow remote x-applications from host 192.168.1.7 to run on local server

Starting X

An X session can be started using 2 methods:

Method 1: From the command line, after logging in onto a virtual terminal the user launches the X Server using a script called startx

Method 2: A Display Manager is running prompting the user with a graphical login, this is available for a specific runlevel (on RedHat type distributions this is runlevel 5).

From the Command Line

The startx script starts xinit. The xinit script has two main arguments (a) the X server and (b) the xinitrc script. The xinitrc script will source (read) the files Xresourses (controlling the x-applications) and the Xclients (choosing a window manager). So we can trace the startup sequence as follows:

startx --> xinit --> X -> xinitrc -> Xclients

Troubleshooting X Clients

Occasionally X Clients won’t terminate properly leaving zombie processes. A zombie process in one whose parent processes has terminated, and cannot clear references to the child process. When a child process’ parent exits leaving the child process still running, this is usually visible by running ps which will reveal the child process being owned by PID 1 (init). These processes should be killed because they may be using CPU resources. Killing such a process requires the user to be the user who owns the process, or root. It might be necessary to use the –9 option to actually kill these processes.

Choosing a Window Manager
The area that is commonly referred to as the desktop is also known in the X Window world as the screen. It covers the entire area of your monitor display. The root window is the background of your screen, typically used to display a colour or picture. The window manager provides an interface between the user and the X server. It is virtually impossible to use X without a window manager, because it provides the title bar and the familiar buttons with which you manipulate the display.

Information on available window managers is available from the Window Managers website at http://www.PliG.org/xwinman. Many of the Linux versions of these window managers are available at ftp://metalab.unc.edu/pub/Linux/X11/window-managers.

In addition to the different window managers there are also various desktop environments, among which the most common are KDE, GNOME and XFCE.

Below is a brief list of integrated window managers:


 * Enlightenment
 * fvwm
 * icewm
 * amiWM
 * mlvwm
 * dfm
 * olwm
 * olvwm
 * mwm

The following is a partial list of files, terms and utilities that were used.


 * /etc/X11/xorg.conf
 * xhost
 * DISPLAY
 * xwininfo
 * xdpyinfo
 * X

Previous Chapter | Next Chapter