Полезная информация

Next Up Previous Contents Index
The X Window System

4.2 The X Window System

While there are people that will use the character-cell interface present when you first log in, many people prefer a graphically-oriented user interface. For Linux systems, the graphical user interface of choice is the X Window System.

In order to run X, you need to have the necessary packages installed. If you selected the ``X Window System'' component to be installed when you originally installed Red Hat Linux, everything should be ready to go. In that case, please refer to section 4.2.2.

4.2.1 If You Haven't Installed X

If you didn't select the ``X Window System'' component when you installed Red Hat Linux, your Red Hat Linux system won't have the necessary software installed. While it is possible to manually install the required packages, you'll probably find it easier to re-do the installation, particularly if you're new to Linux. Another possibility is to perform an upgrade of the software and select the X Window System components that you need from the package selection installation process.

4.2.1.1 XFree86 Configuration

There are three methods for configuring XFree86 on your machine:

Xconfigurator and xf86config are functional equivalents and should work equally well. If you are unsure of anything in this process, a good source of additional documentation is:

http://www.xfree86.org

Xconfigurator is a full-screen menu-driven program that walks you through setting up your X server. xf86config is a line-oriented program distributed with XFree86. It isn't as easy to use as Xconfigurator, but it is included for completeness. If these utilities fail to provide a working XF86Config file, you may have an unsupported card or you may need to write the config file by hand. Usually the former is the case, so check and make sure your card is supported before attempting to write the config file yourself If your card is not supported by XFree86 you may wish to consider using a commercial X server. If you have questions about whether or not your video card is supported you can check out http://www.xfree86.org for information on XFree86.

The X Server
Provided you selected the proper video card at install time, you should have the proper X server installed. When later running Xconfigurator or xf86config, you need to make sure you select the same video card or the autoprobe will fail.

If you think you installed the wrong X server for your video card, you will have to install the correct one before it can be configured. For instance, if the CD is mounted on /mnt/cdrom, and you need to install the S3 server, enter the following commands:

cd /mnt/cdrom/RedHat/RPMS
rpm -ivh XFree86-S3-3.1.2-1.i386.rpm
ln -sf ../../usr/X11R6/bin/XF86S3 /etc/X11/X

This will install the S3 server and make the proper symbolic link.

Xconfigurator

To configure the X Window System you must first select your video card. Scroll down the list of supported cards until you locate the card in your machine. Figure 1 may help you determine the video server that matches your hardware. If your card is not listed it may not be supported by XFree86. In this case you can try the last card entry on the list (Unlisted Card) or a commercial X Windows server.

The next step is to select your monitor. If your monitor is not listed you can select one of the generic monitor entries or ``Custom'' and enter your own parameters. Custom monitor configuration is recommended only for those who have a sound understanding of the inner workings of CRT displays. The average user should probably use one of the generic selections from the list. After selecting a monitor you need to tell Xconfigurator how much video memory you have. Move the highlight to the appropriate list entry and then press [Enter] or [F12] to continue. For the next step it is recommended that you select the default (No Clockchip Setting) entry, but experienced users may want to select a specific clockchip.

Selecting your Server
If you are unsure what chipset you have, the best way to find out is usually to look at the card. Figure 1 lists which chipsets and boards require which servers. Pick the one that best matches your hardware.

Server Chipset
8514 IBM 8514/A Boards and true clones

AGX

All XGA graphics boards

I128

#9 Imagine 128 (including Series II) boards

Mach32

ATI boards using the Mach32 chipset

Mach64

ATI boards using the Mach64 chipset

Mach8

ATI boards using the Mach8 chipset

Mono

VGA boards in monochrome

P9000

Diamond Viper (but not the 9100) and Others

S3

#9 Boards, most Diamonds, some Orchids, Others

S3V

Boards using the S3 ViRGE (including DX, GX, VX) chipset

SVGA

Trident 8900 & 9400, Cirrus Logic, C & T, ET4000, S3 ViRGE, Others

VGA16

All VGA boards (16 color only)

W32

All ET4000/W32 cards, but not standard ET4000's

Figure 40: XFree86 X Servers

Finishing Up

If later you want to increase your refresh rate for your monitor, you can edit the config file by hand or you can run Xconfigurator again and pick a monitor from our list that more closely matches the specs of your monitor.

The final configuration step consists of selecting the video modes that you want to include in your XF86Config file. Use the arrow keys to move the cursor up and down the list under each color depth (8, 16 and 24 bit). Use the [Spacebar] to select individual resolutions and the [Tab] key to move between color depth fields. When you have selected the video modes you want to use move the cursor to the ``OK'' button and press [Enter], or use the [F12] shortcut. An information screen will give you the most current information on selecting video modes, starting and stopping the X server.

4.2.2 If You've Already Installed X

If you selected the ``X Window System'' component when you installed Red Hat Linux, but didn't choose to start X automatically when the system boots, you're all set. All you'll need to do is to get X running. As it turns out, there are two ways to do this. You can:

Let's start with the manual procedure.

4.2.2.1 Starting X Manually

Red Hat Linux, during the installation, gives you the option of starting X automatically. If you didn't choose this option, you'll see the character-cell login prompt you saw when you first booted your Red Hat Linux system.

In order to get X started, you'll first need to log in. Do so (using your non-root account), and then enter the startx command. The screen should go blank, and (after a short delay) you should see a graphical desktop with one or more windows. The appearance of the desktop you'll see will vary, depending on the packages you installed and other variables. (See Chapter 1 for more info.)

4.2.2.2 Starting X Automatically

Please Note: Make sure you verify that your X configuration works properly before making X start automatically. Failure to do so can make it difficult to log into your Red Hat Linux system. If you haven't done so already, review the previous section before continuing.

It is possible to configure your Red Hat Linux system such that X will start automatically whenever the system is booted. When configured in this manner, xdm will run, which will present a graphically-oriented login screen. After logging in, you will have a regular X session running, just as if you had issued a startx command manually.

Here's a quick overview of how it's done:

Let's look at each step in more detail.

Testing xdm Using telinit
-- The telinit command is used to change your Red Hat Linux system's ``run level.'' It is the run level that controls various aspects of system operation, including whether xdm should be started or not. Since xdm is started at run level 5, you'll need to issue the command:

/sbin/telinit 5

Please Note: You will need to be logged in as root in order to use telinit. Also note that you should not be running anything else on your Red Hat Linux system when you change run levels, as any running programs may be killed by the run level change.

If everything is configured properly, after a short delay you should see an xdm login screen. Log in, verifying that an X desktop appears. Then log out to make sure that xdm reappears. If it does, your system is configured properly to automatically start X. If there are problems, you can go back to run level 3 using telinit (ie, ``/sbin/telinit 3''), or by rebooting.

Editing /etc/inittab
-- The file /etc/inittab is used to, among other things, determine the system's default run level. We need to change the default run level from 3 to 5; therefore, we'll need to edit /etc/inittab. Using the text editor of your choice, change this line in /etc/inittab:

id:3:initdefault:

When you're done, it should look like this:

id:5:initdefault:

Please Note: Make sure you change only the number 3 to be 5! Do not change anything else, otherwise your Red Hat Linux system may not boot at all! When you've made the change, exit the editor, and use this command to review your handiwork:

less /etc/inittab

(Press the [Space] to page through the file; [Q] will exit.) If everything looks OK, it's time to reboot. Use the shutdown command to properly shut down your system, and you're done!

4.2.2.3 Exiting X

When you're done, and you'd like to leave X, select the GNOME foot on the panel bar, choose Log out and answer Yes to confirm your decision. You will then be logged out of your system.

Please Note: If you're running GNOME as your desktop environment, all programs that were currently running will be restarted when you log back in.

4.2.2.4 Changing Your Desktop

You can use the Switchdesk feature to change out your desktop environment. Switchdesk will present a screen which allows you to switch between any desktop environments that you may have installed on your system. You will then be asked to exit and restart X. You will see your new desktop of choice after X has restarted.

To use the Switchdesk feature you can type switchdesk at the command line of an Xterm. If you are using GNOME, click on the GNOME foot, choose Run Programs and type switchdesk.

4.2.2.5 Virtual Consoles and X

Note that even if you're running X, you still have access to the regular character-cell user interface. That's because Red Hat Linux uses virtual consoles while X is running. To switch to a virtual console, press [Ctrl]-[Alt]-[Fn], where [Fn] is any one of the first six function keys. When switching virtual consoles, you should see a standard login prompt; at this point you can login and use the system normally on any (or all) of the virtual consoles.

When you'd like to go back to your X session, simply press [Ctrl]-[Alt]-[F7].

Please Note: Some people remap keys under X; if you do this, be aware that your X keyboard mappings will only be active when in X. This can be confusing if, for example, you've swapped the [Ctrl] and [Caps Lock] keys under X, as you will have to use two different keystrokes to switch between X and non-X virtual consoles.

4.2.2.6 Handy X-Based Tools

There are several tools that can make life easier for the new Red Hat Linux user. They perform tasks that either require root access, or can only be done by memorizing arcane commands. They all require X to run, so you'll need to get that set up first. These tools are:


Next Up Previous Contents Index