Configure X11 in Linux
In the Linux world, X11 (XFree86 or Xorg) provides the tools needed to use graphical applications. Without them, Linux would still be in the command line only. This explains how to configure them on your computer.
Contents
Steps
- You will need to have X11 installed. This was likely already done by your distribution's installer. If you do not have it installed, you can build it from source using details on this website (http://www.linuxfromscratch.org/blfs/view/cvs/x/xorg7.html).
- Press the keys ctrl-alt-f1 and log in as root when the virtual terminal is open.
- Run the command "Xorg -configure"
- A new file has been created in /etc/X11/ called xorg.conf . This file has the configuration settings in it. They were automatically determined and may be satisfactory. To test this, use "startx" .
- If the XServer did not start, or you do not like the configuration, read on.
- Open the file "/etc/X11/xorg.conf"
- There are many sections, each controlling a different aspect of the XServer. If the XServer did not start, check the "Device" section. Here is a sample of this, but this will vary from system to system.
- Section "Device"
- Identifier "Device[0]"
- Driver "nvidia"
- VendorName "NVidia"
- BoardName "GeForce 6150 LE"
- EndSection
- To configure the "Device" section, you can use these options:
- Identifier -- The device's ID for the server.
- Driver -- What device driver to use for the device, some common ones are vesa (basic, no 3D support), nv (for NVidia cards, no 3D support), and NVidia (for NVidia cards, 3D support, must be downloaded and installed usually).
- VendorName -- Not very important, tells who made the driver.
- BoardName -- Tells what device your graphics card is.
- Also, you can configure the input devices such as mouse and keyboard.
- To configure the mouse, you will move to the "InputDevice" section with the "Identifier "Mouse[1]"" entry.
- Section "InputDevice"
- Identifier "Mouse[1]"
- Driver "mouse"
- Option "Buttons" "5"
- Option "Device" "/dev/input/mice"
- Option "Name" "ImPS/2 Generic Wheel Mouse"
- Option "Protocol" "explorerps/2"
- Option "Vendor" "Sysp"
- Option "ZAxisMapping" "4 5"
- EndSection
- The above entry controls the mouse. This section is likely to be correctly auto generated correctly.
- The "Driver" entry controls what driver to use. Unless you know otherwise, stick with "mouse".
- Various "Option" entries are provided to edit the protocols and other advanced things about the mouse. You should probably leave these alone.
- In addition, you can also configure the keyboard.
- Section "InputDevice"
- Identifier "Keyboard[0]"
- Driver "kbd"
- Option "Protocol" "Standard"
- Option "XkbLayout" "us"
- Option "XkbModel" "microsoftpro"
- Option "XkbRules" "xfree86"
- EndSection
- There are many options here, but you probably only care about "XkbLayout" and the Driver.
- "Option "XkbLayout" " controls the layout of your keyboard. You can specify a code to tell the computer what key you press means what.
- The driver should probably be left alone as kbd driver is able to operate virtually all keyboards, just as the mouse driver can run almost any mouse.
- You can also configure the monitor. Be careful as incorrect settings here can damage the monitor permanently. I advise not to edit this section
- Section "Monitor"
- Identifier "Monitor[0]"
- VendorName "VSC"
- Model Name "VIEWSONIC A70"
- UseModes "Modes[0]"
- DisplaySize 310 232
- HorizSync 30.0 - 70.0
- VertRefresh 43.0 - 180.0
- Option "CalcAlgorithm" "XServerPool"
- Option "DPMS"
- EndSection
- Most of the configuration such as MonitorName is self-explanatory. You can also edit the DisplaySize, HorizSync, and VertRefresh settings, but these are the ones that can damage your system so leave them alone.
- Various modules can be loaded into the XServer at startup to facilitate things like fonts and 3D graphics. They will be specified in the "Module" entry.
- Section "Module"
- Load "dbe"
- Load "type1"
- Load "freetype"
- Load "extmod"
- Load "glx"
- EndSection
- The glx module controls 3D graphics.
- The free type module is vital for fonts.
- font is very important for a graphical program. You may want to edit the font paths, these tell the XServer where to look for fonts.
- Section "Files"
- InputDevices "/dev/gpmdata"
- InputDevices "/dev/input/mice"
- FontPath "/usr/share/fonts/misc:unscaled"
- FontPath "/usr/share/fonts/local"
- FontPath "/usr/share/fonts/75dpi:unscaled"
- FontPath "/usr/share/fonts/100dpi:unscaled"
- FontPath "/usr/share/fonts/Type1"
- FontPath "/usr/share/fonts/URW"
- FontPath "/usr/share/fonts/Speedo"
- FontPath "/usr/share/fonts/PEX"
- FontPath "/usr/share/fonts/cyrillic"
- FontPath "/usr/share/fonts/latin2/misc:unscaled"
- FontPath "/usr/share/fonts/latin2/75dpi:unscaled"
- FontPath "/usr/share/fonts/latin2/100dpi:unscaled"
- FontPath "/usr/share/fonts/latin2/Type1"
- FontPath "/usr/share/fonts/latin7/75dpi:unscaled"
- FontPath "/usr/share/fonts/baekmuk:unscaled"
- FontPath "/usr/share/fonts/japanese:unscaled"
- FontPath "/usr/share/fonts/kwintv"
- FontPath "/usr/share/fonts/truetype"
- FontPath "/usr/share/fonts/uni:unscaled"
- FontPath "/usr/share/fonts/CID"
- FontPath "/usr/share/fonts/ucs/misc:unscaled"
- FontPath "/usr/share/fonts/ucs/75dpi:unscaled"
- FontPath "/usr/share/fonts/ucs/100dpi:unscaled"
- FontPath "/usr/share/fonts/hellas/misc:unscaled"
- FontPath "/usr/share/fonts/hellas/75dpi:unscaled"
- FontPath "/usr/share/fonts/hellas/100dpi:unscaled"
- FontPath "/usr/share/fonts/hellas/Type1"
- FontPath "/usr/share/fonts/misc/sgi:unscaled"
- FontPath "/usr/share/fonts/xtest"
- FontPath "/opt/kde3/share/fonts"
- EndSection
- Note that fonts are usually autodetected by Xorg -configure, but if they were not you can add a new entry such as "FontPath wherethefontsare" to load them.
- The last section covered here is the "ServerLayout" section. It controls things such as multiple desktops and tells what devices to use.
- Section "ServerLayout"
- Identifier "Layout[all]"
- Screen "Screen[0]" 0 0
- InputDevice "Keyboard[0]" "CoreKeyboard"
- InputDevice "Mouse[1]" "CorePointer"
- Option "Clone" "off"
- Option "Xinerama" "off"
- EndSection
- There are many important options here. They are explained below.
- InputDevice -- Tells XServer to use a created device.
- Option "Clone" -- If multiple monitors or graphics cards are used, this tells whether or not to display the same thing on all of them.
- Option "Xinerama" -- If multiple graphics cards or monitors are used, this tells whether or not to let them behave like separate desktops.
Tips
- Your distribution might come with a tool to configure this for you, or at least present it in a more convenient way.
- Usually, Xorg -configure can accurately auto-detect your devices, so advanced editing is often not required.
Warnings
- Editing this server can cause problems such as your desktop not loading or damage to your monitor.
- As with editing any system file, there is the danger of your computer being permanently damaged.
Related Articles
- Load Fonts
- Set up X Window System
- Install Gentoo Linux from Ubuntu
- Revive an Old Computer with Linux
- Choose a Linux Distro
- Assign an IP Address on a Linux Computer