Introduction: How to Set Up Multiple Monitors in Linux

About: My name is Joe. I enjoy long walks on the beach, pina colladas, getting caught in the rain, playing with dead things, playing with fire, hacking, programming, reverse engineering and blowing stuff up. my areas…

this tutorial will show you how to set up a multi-head system in most linux distros, primarily ubuntu. please note, this is still largely unfinished.

Step 1: Install Your Hardware.

the title explains it. i'm assuming you know how to open the case and install the cards. just make a note of which card is where and which monitor is on which card. FYI: my system uses one Nvidia riva tnt2, one nvidia riva tnt, and one 3dfx voodoo3. (in that order on the pci bus)

Step 2: Boot Up and Get X Going

if X fails and drops to the terminal type in:
sudo dpkg-reconfigure -phigh xserver-xorg
(if you're already root, don't use sudo)
use the wizard to set up drivers for whatever monitor the wizard is showing up on. (usually the first on the bus)
reboot to start x

Step 3: Check the Order and Find the Addresses

by now you should be looking at your linux desktop on one boring screen.
open a terminal and type
you should now see a list of devices and their bus id. find the graphics cards and write down the bus id's you'll need them later.

Step 4: Set Up X for Multiple Screens

open your xorg.conf for editing.
in ubuntu, open a terminal and type
sudo gedit /etc/X11/xorg.conf
(again, if you're already root, don't use sudo)
save it as xorg.conf.backup or something simular, i can gaurentee the next step won't work the first time.
now, go back to that list of cards and addresses you made. make a device section for each. like this:

Section "device"
identifier "name for card here"
driver "card driver name here"
BusID "X:Y:Z"

replace x:y:z with the bus id of the card, you can replace "name for card here" with anything, but make sure you're using the proper driver for your hardware.

now make a monitor section for each monitor

Section "Monitor"
Identifier "monitor name here"
HorizSync 28.0 - 51.0
VertRefresh 43.0 - 60.0
Option "DPMS"

if your monitor has dpms, you can omit the sync and refresh. if it doesn't, remove the dpms line.

Now make a Screen for each card/monitor pair

Section "Screen"
Identifier "screen name here"
Device "card name here"
Monitor "monitor name here"
DefaultDepth X
SubSection "Display"
Depth 4
Modes "1024x768" "800x600" "640x480"
SubSection "Display"
Depth 8
Modes "1024x768" "800x600" "640x480"
SubSection "Display"
Depth 15
Modes "1024x768" "800x600" "640x480"
SubSection "Display"
Depth 16
Modes "1024x768" "800x600" "640x480"
SubSection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"

replace X with whatever color depth your hardware can handle.
under each subsection list all the available modes and sizes for each mode.
you can get away with just listing one display section and one resolution, if that's all you'll use, or if you're lazy. try to keep the default depth and highest resolution the same for each 'screen', it makes things much easier.

now, find the ServerLayout section, and add the screens

Screen "first screen name" 0 0
Screen "Second screen name"" RightOf "left"
Screen "third screen name" RightOf "center"

it should now look something remotely like this

Section "ServerLayout"
Identifier "Default Layout"
Screen "first screen name" 0 0
Screen "Second screen name"" RightOf "left"
Screen "third screen name" RightOf "center"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"

add as many screens as you want. use RightOf or LeftOf to tell the computer where the monitors are relative to each other. don't touch the InputDevices and make sure the Identifier is "Default Layout"

Step 5: Cross Your Fingers!

restart x! (in ubuntu just hit control-alt-backspace)
if it works, you'll have a desktop across all (or most) monitors. move the mouse across each to make sure they're in the right order! if they're not, go to the previous step and switch them around in the server layout. if you have one (or more) monitor that won't show anything (and the mouse skips it) make sure you used the correct bus id and driver in the device section. also try checking the bios settings. on my computer i had to set the oldest card (riva tnt) as the primary boot device under pci vga settings in the bios. (even though the newest is used as the primary in ubuntu) if the screen is still blank, but you loose the mouse in it, check the cables and make sure the monitor is on!
from here on, just expiriment with different configurations and arrangements until you find one you like.

now, get yourself some kickin' multi-screen wallpapers!
digital blasphemy
deviant art

Step 6: Add Menus (optional)

this only applies to Gnome based distros.
right click on any panel and select new panel
drag it to annother screen, right click on it and add to the menu.
you can also make it look really cool by setting the background color to semi-transparent.