Certification Objective 14.01-X with Clients and Servers


The X Window System is designed as a flexible and powerful client/server-based system. To configure and troubleshoot the X Window interface, you need to understand the client/server nature of the X Window System.

As you might have guessed from the terms client and server, the X Window System is designed to work in a networked environment. The client and server can both reside on your own computer or on separate computers on the network. In other words, not only can you run X applications on your system, you can run X applications on other computers on your network. The graphical displays from those remote applications are sent to your monitor.

In fact, X Window applications handle this task so well that, providing the network is fast enough, you really can't tell from a performance point of view which applications are running locally and which applications are running remotely.

When you configure the X server, I'll show you the modularity of the system. In brief, components such as keyboards, mice, and monitors are configured separately and all become modular components of the X server. While one X server process controls the display, you can run as many X clients as your hardware resources, primarily RAM, will support. If your Linux system is part of a network, you can also start X clients on other systems on the network and have those clients send their displays to your X server.

X clients exist for almost every basic application-word processing, spreadsheets, games, and more. The Red Hat GUI configuration tools were developed as X clients. There are even X client versions of popular utilities such as the emacs editor.

Different Meanings for Client and Server

Normally on a network, the local computer is the client and the remote computer acts as the server. X Window clients and servers work on a different paradigm. The X server controls the graphics on the local computer. The X server draws images on your screen and takes input from your keyboard and mouse. In contrast, X clients are local or remote applications such as xclock that you can run on the local X server.

You can run an X client locally or remotely. Local X clients run on your workstation; remote X clients run on the local X server. When you run a remote X Window client application, you start the program on a different computer and send its output to use the X server on your local computer. Figure 14-1 illustrates a local X server with one local and one remote X client.

image from book
Figure 14-1: Running X Window clients from remote or local computers

Before reading more about running X client applications, you need to first configure an X server. While RHEL normally configures most hardware configurations during the installation process, you need to know how to edit the X Window configuration file, directly in a text editor or with the Red Hat Display Settings tool (system-config-display).

On the Job 

If you're in the GNOME (GNU Network Object Model Environment) or KDE (K Desktop Environment) desktops, you can also start the Red Hat Display Settings tool with the GNOME System (or KDE Main Menu) | Administration | Display command.

Supported Hardware

If a Linux installation program does not successfully configure the X Window System, it can be difficult to configure the GUI on a Linux workstation. Fortunately, RHEL comes with tools and drivers that make this job relatively painless and easy.

But it all depends on the hardware. Linux may not always work with the latest and greatest video card or monitor. Many video cards and monitors include proprietary software; it may take some time before Linux developers are able to "reverse-engineer" these components. For the latest official information, check the Linux Video and DVD Project at www.linuxvideo.org, the Linux Hardware Compatibility List at www.tldp.org/HOWTO/Hardware-HOWTO/, and the Red Hat Hardware Catalog at https://hardware.redhat.com/hwcert/.

On the job 

Linux provides world-class support for graphics. The list of movie studios that use Linux to create feature films is impressive (including Disney, DreamWorks, Industrial Light and Magic, Paramount, and so on). If you need motion picture-quality graphics support, you may want to consider commercial alternatives to the X.org server, such as Accelerated-X from Xi Graphics (www.xinside.com).

The X Window server shipped with RHEL 5 is an open-source X server program from X.org. This server supports hundreds of video cards and monitors. The best places to check to determine whether your video card and monitor are supported are the hardware lists described earlier. Alternatively, navigate to the X.org Web site to find the latest support information.

The latest version of X.org includes modules for different video servers. Hardware support for most video servers is already there. If you learn of updates, changes are easy. Just add the module, and then point to it in the /etc/X11/xorg.conf configuration file.

If you are using an unsupported video card, support is also included for generic VGA and VESA devices. Most video cards and monitors will work with these X servers.

Default X Clients

When you configure a workstation for most users, you'll be configuring their GUI. You may need to specify a default desktop such as GNOME or KDE. I'll describe these desktops later in this chapter. You may want to set up specific icons for that user's desktop. Settings for default X clients are stored in each user's home directory, in various hidden directories. In RHEL, KDE configuration files are stored in each user's ~/.kde directory (where the tilde, ~, represents a Linux home directory). GNOME configuration files are stored in hidden directories such as ~/.gconf, ~/.gnome, and ~/.gnome2.

Exercise 14-1: Starting X Server

image from book

In this exercise, you will start your X server without a window manager. You'll then start an X client application known as xterm. Some of the commands used in this exercise are covered later in the chapter. If the X Window System is not running, you can skip steps 1 and 3.

  1. If the X Window System is running, change to a text console by pressing CTRL-ALT-F1.

  2. If you see a login prompt, log in at the text console as the root user. Otherwise, press CTRL-C to stop the X Window.

  3. When you log in as root at the text console, stop the current X Window server with the following command (telinit 3 works as well):

     # init 3 

  4. Now log in as a regular user. You can log out and log back in, or you can log in more directly. For example, I access my own account with the following command:

     # su - michael 

  5. Start the X.org server by typing this command:

     # X & 

    Your X server will start, but all you will see is a blank gray screen, with an "x" that represents your mouse cursor.

  6. Switch back to your text console session by pressing CTRL-ALT-F1.

  7. Type the following command:

     # xterm -display localhost:0.0 & 

    (Note: there is only one hyphen before the display switch.)

  8. Switch back to your X Window display by pressing ALT-F7.

You should now have an xterm terminal window. Select the window and enter commands at the xterm command line. Check out the contents of the /usr/X11R6/bin directory. Try starting other X client applications such as xclipboard and xminicom from the xterm command line. Reboot your system to return things to normal.

One last keystroke hint for X: pressing the CTRL-ALT-BACKSPACE keys sends a termination signal to the X server. In some situations, the Linux GUI crashes and it's not possible to start a text console session by pressing CTRL-ALT-F1. In this case, the CTRL-ALT-BACKSPACE key combination can keep you from having to reboot your computer.

image from book

X Clients and Command Line Options

Starting an X client is very easy. When you start the X Window System for the first time, it puts X client icons on the desktop by default. You can start additional X clients by selecting a program from a menu, or you can start an X client from a command line terminal screen. Later, I'll show you how to set up default X clients when you start the Linux GUI.

It's almost as easy to start running X clients from remote servers. All you need to do is configure a remote server to provide X clients using the Secure Shell, SSH. Just log in with the -X or -Y switch. For more information, see Chapter 13.

X clients are standard Linux applications, which you can start with commands such as xclock, xeyes, xterm, xclipboard, and so on. If you choose to start an X client from a command line, you can follow the command name with any number of options. Most X clients understand a common set of options. These options are used to control such things as the size and location of the X client's window, the font the application uses to display the text, and even the display on which the application should display its output. Table 14-1 lists some of the more useful options you can supply when you start an X client from the command line.

Table 14-1: Common X Client Command Line Options

Option

Example

Result

-geometry XSIZE×YSIZE+XOFF+YOFF

-geometry 100×100+10+20

Specify the size and location of the window. In this case, we want a window 100×100 pixels in size, offset from the upper-left corner by 10 pixels horizontally and 20 pixels vertically.

-font fontname

-font lucidasans-14

Display text for this client using a specific font.

-background color

-background blue

Set the window background to blue.

-foreground color

-foreground white

Set the window foreground to white.

-title string

-title "My Window"

Place a title on the client window's title bar.

-bordercolor color

-bordercolor green

Make the window border green.

-borderwidth pixels

-borderwidth 5

Make the window border 5 pixels wide.

The -geometry option is used to specify both the size and location of the window in which the X client starts up. Notice that the first two numbers, the XSIZE and the YSIZE, are separated by a lowercase x. These two numbers specify the size of the client window in either pixels or characters, depending on the application. For example, if you are opening an xterm window, the size represents a terminal screen with XSIZE columns and YSIZE lines. If you are starting an xclock, the size represents a window XSIZE×YSIZE in pixels.

The next two numbers specify where you want the client window to appear on your display. The numbers are relative to the upper-left and lower-right corners of the desktop: +0+0 represents the upper-left corner, -0-0 represents the lower-right corner. These specs are shown in Table 14-2.

Table 14-2: X Client Geometrical Positioning

XSIZE×YSIZE

Description

-0-0

Lower-right corner

-0+0

Upper-right corner

+0-0

Lower-left corner

+0+0

Upper-left corner

Therefore, for XOFF+YOFF, if you specify +10+10, the client is positioned 10 pixels from the left edge of the screen and 10 pixels from the top of the screen. Alternatively, -10-10 positions the client 10 pixels from the right edge of the screen and 10 pixels up from the bottom of the screen.

The -font option specifies the font that the X client should use to display text. The X Window System comes with a wide variety of both fixed and proportionally spaced fonts. The default list is located in the /usr/share/X11/fonts directory. This directory contains a number of subdirectories, each of which contains font files for the various types of fonts installed on your system.

Many of the X client command line options enable you to specify colors for different parts of the client window. You can specify a simple color such as red, green, white, and black. Alternatively, you can specify a color by indicating the red, green, and blue components of the color:

 # xclock -background RGB:FF/00/FF 

xterm

One of the most useful X clients is a program called xterm. As its name implies, xterm is a client that creates a terminal window on your X display. So, after all the hard work you've gone through to get a nice windowing display, you're right back where you started, with a command line interface.

The difference is that now you can start up as many of these command line interfaces as you like, and you can switch between them with the click of a mouse. Since xterm is an X client, you can even open terminal windows on other computers on your network and have them display to your desktop. You can start xterm either from a menu or from a command line prompt.

Red Hat has configured gnome-terminal as the default command line interface within the default GNOME desktop, which you can start by choosing Applications | Accessories | Terminal. Alternatively, the KDE Konsole is accessible by choosing Main Menu | System | Terminal.



RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302)
Linux Patch Management: Keeping Linux Systems Up To Date
ISBN: 0132366754
EAN: 2147483647
Year: 2004
Pages: 227
Authors: Michael Jang

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