X.org: the gateway to the graphical interface
The command line interface is very powerful in terms of what you can do through it, but most desktop users prefer a more graphical interface. To use a desktop environment or window manager like we mentioned above, you will first need to run an X Window System server. The one that was included with most GNU/Linux distributions is called X.org. This is a program that acts as a graphical shell that works on top of the command line interface.
Usually you will not have to deal with X server configuration unless you use one of the more advanced distributions like Gentoo or Slackware. The rest of this section assumes that you're installing X.org from a package and need help to get it running, or to properly configure it for a new video card.
Before you can use the X server, you will have to properly configure X.org for your system. There are a few different methods for configuring X, but the most reliable method is by using a program called xorgconfig. Running this program is simple; as root, simply type in:
This program is text-based and will ask you multiple-choice questions about your hardware, such as the type of mouse and keyboard you use.
If you don't know what device node your mouse is on, just use the default for now.
Choosing your monitor's refresh rate can be somewhat confusing, since most of us don't know exactly what the settings should be. On many modern monitors you can hit a setup button (usually on the front of the monitor) and it will tell you some or all of the refresh rates that you need to know. Your monitor's manual or the manufacturer's Web site may also reveal the refresh rates. If in doubt, choose 31.5-48.5 for the horizontal refresh and 50-70 for the vertical refresh and you should be safe.
The video driver is tricky; the only ones included with X.org are generic drivers that don't allow for hardware acceleration. This isn't a problem if you aren't doing 3D rendering or don't need OpenGL for anything, but if you do then you'll need to get a different driver. For now just select a generic driver that fits your video card's description (nv for Nvidia cards, radeon for ATI Radeon cards, etc.). After the program is complete, try to start X as outlined below.
Another way of configuring the X server is to let it guess the proper settings. These days it's usually pretty good at detecting your settings, so you may want to try this option before running xorgconfig, just to see if this method will work for you.
The command is:
When it's done it will copy the new configuration file to /root/xorg.conf.new. You must copy this file to /etc/X11/xorg.conf in order for X.org to start properly.
The X.org configuration file
The settings that you just saved by running the xorgconfig program are stored in the xorg.conf file, which can be found in the /etc/X11/ directory. Remember: file names and directories are case-sensitive, so make sure you capitalize the right letters.
If you need to see the log file, which contains startup information and errors that X.org encounters when it is launched, you can find it in /var/log/Xorg.0.log.
The xorg.conf file is very easy to navigate and understand. If you can't start X, you can try changing some of the settings in this file or you can simply re-run the xorgconfig utility and choose different options than before. If your mouse does not work in X, or if it behaves erratically, you've specified the wrong device node for the mouse. If you're using a PS/2 mouse connected to the PS/2 port, try using this device node:
And if you're using a USB mouse, use this node:
So, in your /etc/X11/xorg.conf file you'll want the Core Pointer section to look something like this:
# Core Pointer's InputDevice section
# Identifier and driver
Option ``Protocol'' ``ps/2''
Option ``Device'' ``/dev/mouse''
If you change the Device setting to /dev/input/mice and your USB mouse still doesn't work, you may have to change other settings. For more information on configuring a USB mouse, visit this address.
If your mouse wheel does not work, there are two simple lines that you'll have to manually add to the /etc/X11/xorg.conf file in the Core Pointer section as outlined above:
Option ``Buttons'' ``5''
Option ``ZAxisMapping'' ``4 5''
This sets the mouse's fourth and fifth buttons to scroll up and down (the mouse treats each wheel direction as a button). If you have a mouse with more buttons than usual, you may have to change the numbers:
Option ``Buttons'' ``7''
Option ``ZAxisMapping'' ``6 7''
You can insert these lines anywhere after the Device line in the Core Pointer section. Please note lines that start with ``#'' are called commented lines, which means they won't be run by the program. So if the lines above are already in your xorg.conf file, you can uncomment them by removing the # and X.org will read them the next time it starts. You can also disable lines in the config file by putting a # before them.
There are many ways to start the X Window System. The basic startup scripts that come standard with X are startx and xdm. All you need to do is type one of those commands in and press enter and the X server will start with the default window manager. If you have other window managers installed (such as Fluxbox or Blackbox), you'll want to run xinit instead. This script will start the X Window System without running the default window manager. It gives you a prompt where you'll type in the name of the window manager you want to run; so if you want to run Fluxbox for instance, you'd type in:
and then at the prompt, type:
If you're using KDE you can use a much nicer startup script by running the kdm command. GNOME has a similar script called gdm. Please refer to the help files in KDE or GNOME if you wish to customize these startup scripts.
If X refuses to start, the usual suspects are the video and mouse settings.