пятница, 26 февраля 2010 г.

LPI exam 101 prep: The X Window System

В рамках подготовки к сдаче экзамена 101 уровня Junior Level Linux Professional LPIC-1 публикую краткие описания команд и фактов из подготовительных материалов IBM к этому экзамену.

Install and configure X


The X Window System, also known simply as X or X11, is a window system for
graphical (bitmap) displays. X originated at MIT in 1984.

The original configuration tool, xf86config, required a user to have and enter detailed
information about video card and monitor timings. Recent versions of XFree86 are
capable of dynamically determining the available hardware and can run with little or
no configuration information.

XFree86 -autoconfig
Running XFree86 with the -autoconfig option will attempt to automatically
configure the X server.

XFree86 -configure
Running XFree86 with the -configure option may work if the -autoconfig
option does not.

xf86cfg
The xf86cfg command attempts to start the display and input drivers.

xf86config
The xf86config command uses a text-mode interface to interactively prompt
for information about your mouse, keyboard, video card, and display.

The configuration file is named xorg.conf rather than XF86Config. You may find it in
one of several places: /etc/xorg.conf, /etc/X11/xorg.conf, /usr/X11R6/etc/xorg.conf,
/usr/X11R6/lib/X11/xorg.conf.hostname, or /usr/X11R6/lib/X11/xorg.conf.

X -configure
Running X with the -configure option causes the X server to load each
driver module, probe for the driver, and create a configuration file that is saved
in the home directory of the user who started the server (usually /root). The file
is called xorg.conf.new.
xorgcfg
This tool is similar to xf86cfg
xorg86config
The xorgconfig command uses a text-mode interface to interactively prompt
for information about your mouse, keyboard, video card, and display. As with
xf86config, you will need horizontal and vertical frequency information for your
display. You can select most video cards from a database of known video
cards. If not, you may need specific chipset and timing information for your
card.

use the xvidtune command to tune the size and position of your X display.

With the core X11 fonts system, the X Server obtains fonts and font information from
a font server. The X font server, xfs, usually runs as a daemon and is started at
system startup, although it is possible to run it as an ordinary task.

You can use the xdpyinfo command to check your X server.

The Xft library provides functions that allow client applications to select fonts based
on pattern criteria and to generate glyphs to send to the server.

the mkfontdir command created the fonts.dir file.
When installing scalable fonts, such as TrueType or Type1 fonts, an extra step is
required to create scaling information. After you copy the font files to the target
directory, run the mkfontscale command and then the mkfontdir command.
The mkfontscale command will create an index of scalable font files in a file called
fonts.scale.

Set up a display manager

The initialization scripts (/etc/init.d/boot or /etc/init.d/rcS) will then run other scripts.
Eventually, a series of scripts for the chosen runlevel will be run. For the above
examples, these might include /etc/rc2.d/S13gdm (Ubuntu) or
/etc/init.d/rc5.d/S16xdm (SUSE), which are both scripts to run a display manager.
You will find that the rcn.d directories in /etc/init.d usually contain symbolic links to
scripts in /etc/init.d without the leading S (or K) and number. The S indicates that the
script should be run when the runlevel is entered, and the K indicates that the script
should be run when the runlevel is terminated. The digits specify an order from 1 to
99 in which the scripts should be run.

You may find that the script for running a display manager, say
/etc/init.d/rc5.d/S16xdm, may be a small script that contains additional logic to
determine which display manager will really be run.

It should come as no surprise that you can control whether your display manager is
started at system startup simply by creating symbolic links for starting and stopping it
in the appropriate rcn.d directory.

The X Display Manager (XDM) is included in the XFree86 and X.Org packages.
Under the Filesystem Hierarchy Standard, the configuration files should be located
in /etc/X11/xdm. The main configuration file is /etc/X11/xdm/xdm-config. This file
contains the location of other files used by XDM, information on authorization
requirements, the names of scripts run to

KDM is the K Desktop Manager for the K Desktop Environment (KDE). KDE version
3 uses a kdmrc configuration file, a change from earlier versions, which used
configuration information that was based on the xdm configuration files. This is
located in the $KDEDIR/share/config/kdm/ directory, where $KDEDIR might be
/etc/kde3/kdm/ or perhaps somewhere else. For example, on a SUSE SLES8
system, this is located in /etc/opt/kde3/share/config/kdm.

You can also change many of the
Login Manager settings by using the KDE control center (kcontrol)

GDM is the GNOME Desktop Manager for the GNOME Desktop Environment. This
desktop manager was not based on XDM, but was written from scratch. GDM uses a
gdm.conf configuration file, normally located in the /etc/X11/gdm directory.

You can configure GDM by editing the gdm.conf file. You can also change many of
the settings by using the gdmsetup command.

Customize a window manager

Configuration files for startx and xinit
File Description
$HOME/.xinitrc User-defined executable script that
merges in resource files and starts
client applications
$HOME/.xserverrc User-defined executable script that
provides overrides for default X

/usr/X11R6/lib/X11/xinit/xinitrc System default executable script
that merges in resource files and
starts client applications
/usr/X11R6/lib/X11/xinit/xserverrc System default executable script
that provides overrides for default X
server configuration
$HOME/.Xresources User-defined file describing
resources for X applications
$HOME/.Xmodmap User-defined file defining keyboard
and mouse settings
/usr/X11R6/lib/X11/xinit/.Xresources System default file describing
resources for X applications
/usr/X11R6/lib/X11/xinit/.Xmodmap System default file defining
keyboard and mouse settings

Since there are many attributes, it is
easier to have defaults. Such defaults are stored in a resource database, which is
built from resource files using the xrdb command.

Several tools can help you customize windows and keystrokes.
xrdb
Merges resources from a resource file into the X resource database for the running X server. By default it passes the source resource file through a C++
compiler. Specify the -nocpp option if you do not have a compiler installed.
xmodmap
Sets keyboard and mouse bindings. For example, you can switch settings for
left-handed mouse usage, or set up the backspace and delete keys to work the
way you are accustomed to.
xwininfo
Tells you information about a window, including geometry information.
editres
Lets you customize the resources for windows on your screen, see the
changes, and save them in a file that you can later use with xrdb.
xev
Starts a window and captures X events that are displayed in the originating
xterm window. Use this to help determine the appropriate codes to use when
customizing keyboards or checking mouse events.

An X display is known by a name of the form
hostname:displaynumber.screennumber. For Linux running on a workstation such as
a PC, there is typically only one display with a single screen. In this case, the
displayname may be, and usually is, omitted so the display is known as :0.0.

For local displays on Linux systems, authorization usually depends on a so-called
MIT-MAGIC-COOKIE-1, which is usually regenerated every time the X server
restarts. A user can extract the magic cookie from the .Xauthority file in his or her
home directory (using the xauth extract command and give it to another user to
merge into that user's .Xauthority file using the xauth merge command.
Alternatively, a user can grant authority for other users to access the local system
using the xhost +local: command.

To give all local users authority to open applications on the display (:0.0), user ian
can use the xhost command. Open a terminal window on your desktop and enter
this command:
xhost +local:
Note the trailing colon (:). This will allow other users on the same system to connect
to the X server and open windows. Since you are a single-user system, this means
that you can su to an arbitrary non-root user and can now launch xclock or other X
applications.

Комментариев нет: