Finding the "bus id" of your cards is easy, just run:
lspci | grep VGA
the result would be something like:
01:08.0 VGA compatible controller: Number 9 Computer Company Revolution 4 (rev 02)
Then "01:08.0" is your bus id. If you have two cards, you will have two lines like that.
Then open your /etc/X11/xorg.conf
file with a text editor as root. Edit it to contain two Device
sections. An example of a device section:
Section "Device"
Identifier "My video card 1"
Driver "ati"
BusID "PCI:1:8:0"
EndSection
Identifier is any text you like to identify your video card with - you will need it in later sections of the xorg.conf file. Driver is one of:
apm, ati, chips, cirrus, cyrix, fbdev, glide, glint, i128, i740, imstt, intel, mga, neomagic, nv, openchrome, r128, radeon, rendition, savage, s3virge, siliconmotion, sis, sisusb, sunbw2, suncg14, suncg3, suncg6, sunffb, sunleo, suntcx, tdfx, trident, tseng, vesa, vmware, voodoo, wsfb, xgi, xgixp
Choose one of them which seems to look like the type of chipset which is in your video card (the string from lspci | grep VGA
will be helpful). And the BusID you already know. Create two such Sections.
I'll explain how to configure two monitors with two video cards, you should be able to extend that to four monitors once you understand how the config file works.
Then create two "Monitor" sections. Some like this should be enough:
Section "Monitor"
Identifier "My monitor 1"
HorizSync 30-94
VertRefresh 48-85
EndSection
The Identifier is again anything you choose, you should check the horizontal sync and vertical refresh rates in your monitor instruction manual to find out the two other required parameters.
Then create two "Screen" sections like this:
Section "Screen"
Identifier "My screen 1"
Device "My video card 1"
Monitor "My monitor 1"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1600x1200"
EndSubSection
EndSection
Where you use the identifiers you made up in the previous sections, and 24 is the color-depth you want, and in Modes you put the resolution you want on that monitor.
The last thing you want is to edit your ServerLayout section to look like this:
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "My screen 1"
Screen 1 "My screen 2" RightOf "My screen 1"
InputDevice "My keyboard"
InputDevice "Configured Mouse"
EndSection
Most of it will already be there, the thing you need to add is this line:
Screen 1 "My screen 2" RightOf "My screen 1"
Where you put the Identifiers of the screens you defined earlier.
Then restart your X server and it should work. If it doesn't look in /var/log/Xorg.0.log
or similar log file for errors. If you want to read how to create such files, it should be in the manual:
man xorg.conf
If you don't have one on your system, a Google search for "man xorg.conf" will show many resources.
This should also be interesting for you to read:
http://www.ghacks.net/2009/02/04/get-to-know-linux-understanding-xorgconf/
This is for Gentoo, but shows lots of useful examples of how to write an xorg.conf file:
http://en.gentoo-wiki.com/wiki/X.Org/Dual_Monitors/ATI