An Absolute Beginners Guide to FreeBSD
A small extraction from ``The Comprehensive FreeBSD Guide(TM)'', a work in progress by Chris Coleman and Mark Mayo. This section is intended to guide people through the installation and customization of the X Window System. Any advice pertaining to special system requirements and configuration would be appreciated. fbsd-book@vmunix.com
The X Window System is a graphical user interface designed to run on UNIX. There are many different X Window Systems that you can get, however only XFree86 is available for Free. XFree96 is a volunteer project separate from the FreeBSD project, but included on the FreeBSD CDROM. You can obtain more information from http://www.xfree86.org. From here on out, I will refer to XFree86 as X or the X Window System. Commercial X Window Systems for FreeBSD are availble from www.xig.com.
The X Window System can be installed during a regular FreeBSD install, or done after the system is up and running. X is included in several of the Distribution Sets provided in the FreeBSD install. These include
X User
X Developer
Everything
If you have installed one of these Distribution Sets, the X System is on your hard drive and you can skip ahead to configuration.
During a Custom Install, you can select the X Window System as part of the normal install procedure. If you don't install a Distribution Set that contains the X Window System, you have a second chance to install it during the post-install configuration menu. To install X from the post-install configuration menu, select Distributions and choose the X Window Distribution.
If your system is already running, you can install X from the ports collection. You will need to be root to do this:
cd /usr/ports/x11/XFree86
then type make install.
The source code will be downloaded from the FTP site and then compiled and installed. This may take a while depending on the speed of your computer.
If neither of these methods are appealing, you can download the source code directly from www.xfree86.org and compile and install it yourself. Good Luck.
Before you can configure X to use your hardware, you need to know what your hardware is. There are three things you absolutely have to know (or at least be able to guess correctly):
The type of mouse and where its connected. (ie. PS/2 or Serial on COM1)
The brand of video card you have. (Needs to be a supported type.)
The horizontal and vertical sync limits of your monitor.(Found in your monitor manual.)
If you know these three things, setting up X is easy. The rest is just a matter of personal taste and geographic/language requirements. Once you have obtained this data, you will need to run either the text based config program (xf86config), or the graphical config program (XF86Setup). You do not need to run both.
xf86config is located in /usr/X11R6/bin/. If that is part of your path, you can just type xf86config and begin the configuration. Otherwise, you can type /usr/X11R6/bin/xf86config. You need to be root to do this.
The first thing it is going to ask you is which kind of mouse you have attached to the computer:
First specify a mouse protocol type. Choose one from the following list: 1. Microsoft compatible (2-button protocol) 2. Mouse Systems (3-button protocol) 3. Bus Mouse 4. PS/2 Mouse 5. Logitech Mouse (serial, old type, Logitech protocol) 6. Logitech MouseMan (Microsoft compatible) 7. MM Series 8. MM HitTablet 9. Microsoft IntelliMouse
Select 1 - 9 based on which type of mouse you have. If you select a mouse that has 3 buttons, it will ask you if you want to enable the center button, its called ChordMiddle:
Please answer the following question with either 'y' or 'n'. Do you want to enable ChordMiddle?
If you don't enable the Middle Button, it will ask you if you want to emulate the middle button. With the 3 button emulation enabled, if you press both mouse buttons simultaneously, X will pretend that you have pressed the center mouse button.
Please answer the following question with either 'y' or 'n'. Do you want to enable Emulate3Buttons?
Next it wants to know where the mouse is plugged into.
Now give the full device name that the mouse is connected to, for example /dev/tty00. Just pressing enter will use the default, /dev/mouse. Mouse device:
A mouse is usually plugged into either COM1, COM2, or the PS/2 Port.
/dev/ttyd0 (COM1)
/dev/ttyd1 (COM2)
/dev/psm0 (PS/2 Port)
Now it will ask you if you need to be able to re-map keyboard keys. If you don't know, just press ENTER
Please answer the following question with either 'y' or 'n'. Do you want to use XKB?
This if for special language support, if you speak only English, just press ENTER.
If you want your keyboard to generate non-ASCII characters in X, because you want to be able to enter language-specific characters, you can set the left Alt key to Meta, and the right Alt key to ModeShift. Please answer the following question with either 'y' or 'n'. Do you want to enable these bindings for the Alt keys?
These are the Horizontal Refresh rates found in your Monitor manual. #2 is pretty safe if you don't know what your monitor does. You don;t want to selct a setting higher than your monitor is capable of. It is likely to damage an older monitor.
hsync in kHz; monitor type with characteristic modes 1 31.5; Standard VGA, 640x480 @ 60 Hz 2 31.5 - 35.1; Super VGA, 800x600 @ 56 Hz 3 31.5, 35.5; 8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600) 4 31.5, 35.15, 35.5; Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz 5 31.5 - 37.9; Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz 6 31.5 - 48.5; Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz 7 31.5 - 57.0; High Frequency SVGA, 1024x768 @ 70 Hz 8 31.5 - 64.3; Monitor that can do 1280x1024 @ 60 Hz 9 31.5 - 79.0; Monitor that can do 1280x1024 @ 74 Hz 10 31.5 - 82.0; Monitor that can do 1280x1024 @ 76 Hz 11 Enter your own horizontal sync range Enter your choice (1-11):
You need to enter the Vertical refresh rate of your monitor. #2 is a very common SVGA setting.
1 50-70 2 50-90 3 50-100 4 40-150 5 Enter your own vertical sync range Enter your choice:
Answer y to this next question and find your card in the card database.
Do you want to look at the card database?
On the Left is the name of the card, and on the right is the card chipset.
0 2 the Max MAXColor S3 Trio64V+ S3 Trio64V+
1 928Movie S3 928
2 AGX (generic) AGX-014/15/16
3 ALG-5434(E) CL-GD5434
4 ASUS PCI-AV264CT ATI-Mach64
5 ASUS PCI-V264CT ATI-Mach64
6 ASUS Video Magic PCI V864 S3 864
7 ASUS Video Magic PCI VT64 S3 Trio64
8 ATI 3D Pro Turbo ATI-Mach64
9 ATI 3D Xpression ATI-Mach64
10 ATI 3D Xpression+ PC2TV ATI-Mach64
11 ATI 8514 Ultra (no VGA) ATI-Mach8
12 ATI All-in-Wonder ATI-Mach64
13 ATI Graphics Pro Turbo ATI-Mach64
14 ATI Graphics Pro Turbo 1600 ATI-Mach64
15 ATI Graphics Ultra ATI-Mach8
16 ATI Graphics Ultra Pro ATI-Mach32
17 ATI Graphics Xpression with 68875 RAMDAC ATI-Mach64
Enter a number to choose the corresponding card definition.
Press enter for the next page, q to continue configuration.
The term X server used in this next section makes more sense if you think of it as ``video card driver'' instead. The driver suggested by the card database definition will always perform better. However if the card is not in the database, choose the next best card driver. #5 will contain the X server suggested by the card definition.
1 The XF86_Mono server. This a monochrome server that should work on any
VGA-compatible card, in 640x480 (more on some SVGA chipsets).
2 The XF86_VGA16 server. This is a 16-color VGA server that should work on
any VGA-compatible card.
3 The XF86_SVGA server. This is a 256 color SVGA server that supports
a number of SVGA chipsets. On some chipsets it is accelerated or
supports higher color depths.
4 The accelerated servers. These include XF86_S3, XF86_Mach32, XF86_Mach8,
XF86_8514, XF86_P9000, XF86_AGX, XF86_W32, XF86_Mach64, XF86_I128 and
XF86_S3V.
These four server types correspond to the four different "Screen" sections in
XF86Config (vga2, vga16, svga, accel).
5 Choose the server from the card definition, XF86_S3.
Which one of these screen types do you intend to run by default (1-5)?
Now it needs to point startup code to the driver you have just chosen. Ifyou want it to be done automatically, press 'y'. If you want to do it your self later, press 'n'.
Please answer the following question with either 'y' or 'n'. Do you want me to set the symbolic link?
If you don't know, just press ENTER. It is automatically autodetected.
How much video memory do you have on your video card: 1 256K 2 512K 3 1024K 4 2048K 5 4096K 6 Other Enter your choice:
Unless the card definition tells you what to put, just press 'q'.
1 ATT 20C490 (S3 and AGX servers, ARK driver) att20c490
2 ATT 20C498/21C498/22C498 (S3, autodetected) att20c498
3 ATT 20C409/20C499 (S3, autodetected) att20c409
4 ATT 20C505 (S3) att20c505
5 BrookTree BT481 (AGX) bt481
6 BrookTree BT482 (AGX) bt482
7 BrookTree BT485/9485 (S3) bt485
8 Sierra SC15025 (S3, AGX) sc15025
9 S3 GenDAC (86C708) (autodetected) s3gendac
10 S3 SDAC (86C716) (autodetected) s3_sdac
11 STG-1700 (S3, autodetected) stg1700
12 STG-1703 (S3, autodetected) stg1703
The card definition has Ramdac "bt485".
Enter a number to choose the corresponding RAMDAC.
Press enter for the next page, q to quit without selection of a RAMDAC.
Unless the card definitions tells you which to pick, just press ENTER.
1 Chrontel 8391 ch8391 2 ICD2061A and compatibles (ICS9161A, DCS2824) icd2061a 3 ICS2595 ics2595 4 ICS5342 (similar to SDAC, but not completely compatible) ics5342 5 ICS5341 ics5341 6 S3 GenDAC (86C708) and ICS5300 (autodetected) s3gendac 7 S3 SDAC (86C716) s3_sdac 8 STG 1703 (autodetected) stg1703 9 Sierra SC11412 sc11412 10 TI 3025 (autodetected) ti3025 11 TI 3026 (autodetected) ti3026 12 IBM RGB 51x/52x (autodetected) ibm_rgb5xx The card definition has Clockchip "icd2595" Just press enter if you don't want a Clockchip setting. What Clockchip setting do you want (1-12)?
Unless the card definition says NOT to, go ahead and press y.
This is an example of when NOT to probe for clocks.
You must be root to be able to run X -probeonly now. The card definition says to NOT probe clocks. Do you want me to run 'X -probeonly' now?
These are the list of resolutions that you can switch between. The defaults usually work. Unless you want to change these, just press ENTER.
Currently it is set to: "640x480" "800x600" "1024x768" "1280x1024" for 8bpp "640x480" "800x600" "1024x768" "1280x1024" for 16bpp "640x480" "800x600" "1024x768" "1280x1024" for 24bpp "640x480" "800x600" "1024x768" for 32bpp Note that 16, 24 and 32bpp are only supported on a few configurations. Modes that cannot be supported due to monitor or clock constraints will be automatically skipped by the server. 1 Change the modes for 8pp (256 colors) 2 Change the modes for 16bpp (32K/64K colors) 3 Change the modes for 24bpp (24-bit color, packed pixel) 4 Change the modes for 32bpp (24-bit color) 5 The modes are OK, continue. Enter your choice:
You need to press y here to save your configuration.
I am going to write the XF86Config file now. Make sure you don't accidently overwrite a previously configured one. Shall I write it to /etc/XF86Config?
There is a parameter in the /etc/XF86Config file that allows you to select the number of colors your screen will display. It's the ``DefaultColorDepth'' parameter. This parameter is not set by xf86config and will need to be added by hand. It is, however, set by XF86Setup You can set it to 8, 16, 24, or 32. Each has a corresponding subsection. The default it 8 bit color, or 256 colors. Inorder to achieve 16 Million colors, you would need to set it to 24 bit color.
In each subsection, you can set the resolutions you wish that color depth to use. Only accelerated graphics cards, and a very few svga cards can do color depths greater than 8. Most cards with 1MB of ram can only do 8 bit color at 1024 x 768.
Section "Screen"
Driver "accel"
Device "Trident TGUI9680 (generic)"
Monitor "My Monitor"
DefaultColorDepth 8
Subsection "Display"
Depth 8
Modes "640x480" "800x600" "1024x768"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 16
Modes "640x480" "800x600"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 24
Modes "640x480"
ViewPort 0 0
EndSubsection
Subsection "Display"
Depth 32
Modes "640x400"
ViewPort 0 0
EndSubsection
EndSection
There is now a graphical interface for setting up X. It's XF86Setup and located in /usr/X11R6/bin.
It will switch you into graphics mode and let you point and click your way through the configuration. It requires all the same information that xf86config does. If you fail to get X running with XF86Setup you can always try xf86config.
By default, FreeBSD boots to the text based login screen.
FreeBSD/i386 (vnode.vmunix.com) (ttyp8) login:
From here each user can log into the console and type startx and X will start. Typing startx will use default values in /usr/X11R6/lib/X11/xinit/system.xinitrc. These can be over-ridden by placing .xinitrc in your home directory.
The .xinitrc file is a script that gets run every time startx is executed.
The # character is used to comment out lines.
setenv KDEDIR /usr/local startkde #color_xterm -geometry 80x24+0+0 & #color_xterm -geometry 80x23+-1+341 & #color_xterm -geometry 85x24+492+1 -ls & #fvwm95 #fvwm #enlightenment
It is possible to configure X to start autmatically and provide graphical login services. This configuration allows remote X terminals.
Typing xdm as root, will start graphical logins immediately.
Adding xdm to your /etc/ttys file will start xdm at boot up.
ttyv0 "/usr/libexec/getty Pc" cons25 on secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" cons25 on secure ttyv2 "/usr/libexec/getty Pc" cons25 on secure ttyv3 "/usr/X11R6/bin/xdm -nodaemon" xterm on secure
When users log in using xdm .xinitrc is ignored. Instead a different file, .xsession, is executed. None of the users normal startup scripts are initialized during startup, therefore, .xsession must contain all file location and shell information that is needed to start X.
The .xsession file must be executable. You can do this by typing chmod u+x .xsession. Here is an example .xsession that starts kde:
#!/usr/local/bin/tcsh set path = (/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin /usr/X11R6/bin ) setenv KDEDIR /usr/local/ startkde
If a user attemps to log in and the .xsession file does not exist, or has problems, the user will be denied access and errors will be logged to .xsession-errors in that users home directory.
Before running X you need to choose which Window Manager you want to use. If you don't select a window manager, twm will be automatically started for you. You choose which Window Manager you want in the file .xinitrc or .xsession as outlined in the previous section. If it doesn't exist, you will need to create it.
Here is a copy of my .xinitrc file.
setenv KDEDIR /usr/local startkde #color_xterm -geometry 80x24+0+0 & #color_xterm -geometry 80x23+-1+341 & #color_xterm -geometry 85x24+492+1 -ls & #fvwm95 #fvwm #enlightenment
I currently have kde selected as my window manager, I have three other window managers commented out. You can only specify one window manager at a time.
This window manager is setup by default. Its not very user friendly and has no support for virtual desktops.
fvwm has nine virtual desktops and a Windows 3.1 look and feel. Novell 5 Currently uses a version of fvwm as their window manager for their server console.
After fvwm is installed, all you need to do is add fvwm to your .xinitrc or .xsession file.
Looks like Windows 95 with all the fvwm toolbars. Very stable and has nine virt ual desktops. It requires its own configuration file, .fvwm95rc.
A reallly cool looking desktop. Has support for pluggable desktop themes, such as ``aliens''. Supports four virtual desktops.
Allows you to create and delete virtual desktops on demand.
kde is a complete desktop environment. It comes complete with all its own utilities and programs. Therefore its HUGE, but versitile and easy to setup. kde is becoming very popular for new users.
To install kde you need the ports collection instaled. Currently this is the only way to install kde.
cd /usr/ports/x11/kde
make install
ctrl + alt + backspace
Close X and return to the shell
ctrl + alt + keypad plus
Change screen resolutions to the next one in the list.
ctrl + alt + keypad minus
Change screen resolutions to the previous one in the list.
ctrl + alt + F1
Switch out of X to ttyv0
alt + F4
Switch back to X from the tty's (provided X is on ttyv4)