Документ взят из кэша поисковой машины. Адрес оригинального документа : http://itpm.msu.su/LDP/LinuxAdministration/linux-admin-made-easy-5.html
Дата изменения: Sun Apr 18 13:35:40 1999
Дата индексирования: Mon Oct 1 21:58:47 2012
Кодировка:
Linux Administration Made Easy: Configuring the X Window System Next Previous Contents

5. Configuring the X Window System

The X Window System (commonly and incorrectly known by many as "X-Windows") is a GUI which sits on top of Linux. Unlike Microsoft Windows, the X Window System can look and feel in a huge variety of different ways. It can operate very primitively or very advanced, look beautiful or ugly, be sleek and fast or bloated or slow (each of which are subjective qualities which cause as many arguments among users as the "Linux vs. Microsoft" debate seems to).

Getting X working properly can range from simple to hair-pulling complicated! It is a common complaint among users who are new to Linux, and I've fought with configuration settings countless times myself, so I'm completely empathic about this.

Although in a majority of cases X can be configured automatically, there are exceptions; I would recommend you know or find out the type of video card and amount of video RAM your system has installed, as well as the type of monitor and its horizontal and vertical synch rates (this information is usually available in the back pages of the monitor's users guide, or can be found on the WWW).

5.1 Getting the X Window System Working with X-Configurator

There are two main methods of getting X working under Red Hat's distribution of Linux. The first and easiest method, is to use Red Hat's own ``Xconfigurator'' utility. The utility tries to detect your hardware and installs the applicable X software with the appropriate configuration settings.

If you are still unsuccessful after trying out various settings with Xconfigurator, you may have better luck with the ``xf86config'' utility. Although certainly not as user-friendly or attractive as Xconfigurator is, it gives you finer control over the configuration process.

Finally, if you are still out of luck you may have to resort to editing the ``/etc/X11/XF86Config'' file by hand and tweaking various settings. If this is the case, you may need to get help from the Linux community (see the "Where to Turn for Help" section for details). Relax, however -- in a majority of cases Xconfigurator does an adequate job!

After getting X working properly, you may be disappointed in the lack of rich colours. This is because X uses 8-bit per pixel (``bpp'') colour depth. You can use higher colour depths, however, assuming your video hardware will support them.

The various colour depths are listed in your ``/etc/X11/XF86Config'' file, and look like this:


    Subsection "Display"
        Depth       24
        Modes       "800x600" "1024x768"
        ViewPort    0 0
        Virtual     1024 768
    EndSubsection
 

The above section shows the possible resolutions which are available when using the 24-bit colour depth (800x600 and 1024x768, as listed in the " Modes" line); these resolutions can be switched between "on-the-fly" using the <Alt><+> and Alt><-> keys. Note: As a default, when X starts up it does so using the lowest resolution. If you dislike this behaviour as much as I do, simply edit the ``/etc/X11/XF86Config'' file and reverse the resolutions (ie. "1024x768" "800x600").

When you are getting things set up, you can test each colour depth manually by typing, ``startx -- -bpp 24'' (for the 24-bit depth) and make sure X is working properly for the colour depth you wish to use.)

If you are able to successfully use a higher colour depth and wish to use it as the default, you will need to create a ``/etc/X11/xinit/xserverrc'' file as follows:

exec X :0 -bpp 24

The above change will allow X to use 24 bits per pixel (if you have problems with this, try 16 or 32 instead of 24).

Assuming you have configured X properly, starting it is a simple matter of typing ``startx'' as any user. The X GUI will start, and after you have finished your session and quit X, you will be returned to the regular Linux console.

Optionally, X can start up at system boot, and always run (see the "Using the X Desktop Manager" for details on how to accomplish this). This can be handy for those users who dislike seeing the "boring" black & white console, or for those who wish to avoid dealing with command line shells as much as possible.

5.2 Using the X Desktop Manager

If you wish, you may use the X Desktop Manager (``xdm'') to start up the X Window System automatically at system boot time. This allows your Linux system to always run under X (although you can switch between the GUI and regular consoles with <Alt>-<F1> and <Alt>-<F7> as needed). This is a nice way of providing an attractive and friendly environment for your users, and avoid having to type ``startx'' all the time.

To enable xdm, simply edit the ``/etc/inittab'' file and change the line that reads "id:3:initdefault:" to the following:

id:5:initdefault:

The above change will switch Linux to run level 5 upon system boot up; this run level, by default, will start xdm. You may also wish to check your ``/etc/inittab'' file, probably near the bottom, to ensure the following line is present:

x:5:respawn:/usr/bin/X11/xdm -nodaemon

If you have enabled xdm and wish to use a higher ``bpp'' value than the default of 8 (and your video card and monitor will support it), you will need to modify the ``/etc/X11/xdm/Xservers'' file as follows:

:0 local /usr/X11R6/bin/X -bpp 24

The above change will start the xdm at 24 bits per pixel.

You may also wish to edit the ``/etc/X11/xdm/Xsetup_0'' file and with a ``#'' character, comment out the line that starts ``xbanner'' as shown:

#/usr/X11R6/bin/xbanner

This will prevent the default xdm banner screen from displaying for a split second between KDE sessions. Aesthestics, I know, but...

Note: Sometimes you may find it necessary to switch back to the console (for example, certain games run under the console but not under X). There are two ways of doing this. To temporarily switch away from X to the console, press <Alt><F1>, and to switch back to X again, press <Alt><F7>. Or, if you wish to terminate X altogether (thus freeing up your available memory), you can type ``/sbin/telinit 3'' as "root" to switch the system run-level; this tells XDM to terminate. To switch back, type ``/sbin/telinit 5''.

5.3 Choosing a Window Manager for X

Now, you should decide on a window manager. The X Window System is simply the environment which allows graphics to be displayed on your system's hardware; the window manager is responsible for how X looks and how it interacts with you and your applications.

The Red Hat distribution of Linux contains several window managers, including fvwm, olvm, twm, AfterStep, and others. The default one that you will probably see when starting up X for the first time is fvwm95, a Win95-like environment.

Personally, I find the usual offerings differ from my own tastes, and I recommend using either GNOME or KDE (or both!), whose installation are covered in the next two sections.

5.4 GNOME Installation and Configuration

The GNU Network Object Model Environment (GNOME) is a window manager that enhances your X window environment. It is full-featured, including a large selection of applications you may find useful. However, at the time of this writing, GNOME is a "work-in-progress", meaning you may have to put up with errant behaviour caused by bugs or missing features.

The first step for installing GNOME is to download the latest RPM distribution of the package. The RPM files can be found at ftp://ftp.gnome.org/pub/gnome/redhat/0.99.2/i386 (or from a mirror site).

After you have all the necessary files, the GNOME package can be installed with a simple command, typed as "root":

rpm -Uvh gtk*.rpm *.rpm

(The above command ensures the GTK libraries are installed first, to avoid dependency errors from occurring).

GNOME is actually not a Window manager, but instead sits on top of your favorite one, providing added functionality to it. Therefore, once you have installed GNOME, you should decide which window manager you wish to use, and create a ``.xinitrc'' file in your directory which loads the appropriate window manager and starts GNOME. The file should look something like this:


exec afterstep &
exec gnome-session

The above file will load AfterStep for the window manager, and then run GNOME on top of it.

More information on the GNU Network Object Model Environment can be found on the GNOME web page at http://www.gnome.org/

5.5 KDE Installation and Configuration

The K Desktop Package (KDE) is another popular window manager that is somewhat more mature than GNOME is at the time of this writing. However, it seems to require a bit more memory resources than GNOME does, so take into consideration the amount of RAM you have available on your system (if you have anything less than 64 Mb of RAM and 128 Mb of swap, you might be better off using GNOME).

The first step for installing KDE is to download the latest RPM distribution of the package. To do so, locate an FTP mirror at http://www.kde.org/mirrors.html. Try to choose a mirror that is close to your geographic location, but make sure whichever one you choose is updated often (which can be determined by looking at the list of mirrors).

When you have found a suitable mirror, download all the RPM files which are applicable to your version of Red Hat and your platform. For example, if you are using Red Hat 5.2 on an Intel platform, you will likely want to download the package from the ``/pub/mirrors/kde/stable/latest/distribution/rpm/RedHat-5.2/i386/'' directory on the FTP mirror.

After you have all the necessary files, the KDE package can be installed with the following simple commands, typed as "root" (make sure you are in the directory where all your KDE rpm files are):

rpm -Uvh qt*.rpm install-kde-1.1-base

The above commands will install the Qt libraries first, and then install the KDE base package. Once this is done, you should log off and log back in (or if you are ``su''ed as root, just exit and ``su'' again) so that your path environment is set appropriately, then type:

install-kde-1.1-apps

The above command will install the applications programs.

This installation procedure is discussed in more detail in the file ``readme-redhat-rpms.txt'' that should have been included with the KDE files you downloaded.

If all goes well, and KDE has been installed without any error messages, you may, if you wish, configure KDE to be the default window manager for any of your users (the one they will see immediately after typing ``startx''), by typing the following, again as "root":

/opt/kde/bin/usekde userid

(Make sure you replace userid with an actual user id!)

More information on the K Desktop Environment can be found on the KDE web page at http://www.kde.org/


Next Previous Contents