(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

4. Software Configuration

These are the the configuration files we are going to custimise: /etc/profile /etc/bashrc .bashrc .bashrc .bash_profile .bash_logout .inputrc .less .lessrc .xinitrc .fvwmrc .fvwm2rc95 .Xmodmap .Xmodmap.num .Xdefaults .jedrc .abbrevs.sl .joerc .emacs . Don't add users until you have completed your system configuration; you'll put the dot files in /etc/skel.

4.1 bash(1)

Arguably, the most important piece of software after the kernel. To tailor the behaviour of bash, these are the main files to edit:

  • /etc/bashrc contains system wide aliases and functions;
  • /etc/profile contains system wide environment stuff and startup programs;
  • $HOME/.bashrc contains user aliases and functions;
  • $HOME/.bash_profile contains user environment stuff and startup programs;
  • $HOME/.inputrc contains key bindings and other bits.

Examples of these files are shown below. First, the most important: /etc/profile. It's used to configure a lot of features in your Linux box, as you will see in the following sections. Please look out for reverse quotes!


# /etc/profile

# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

# This file sets up the following features and programs:
# path, prompts, a few environment variables, colour ls, less,
# rxvt, Backspace key behaviour, xterm title.
#
# Users can override these settings and/or add others in their
# $HOME/.bash_profile

# first: root or normal user? Set PATH and umask accordingly. Note that the
# PATH is normally set by login(1), but what if you access the machine
# via ssh?

if [ $(id -gn) = $(id -un) -a $(id -u) -gt 14 ]; then
  umask 002  # normal user
  PATH="/usr/local/bin:/bin:/usr/bin:."
else
  umask 022  # root
  PATH="/sbin:/bin:/usr/sbin:/usr/bin"
fi

# Now extend the PATH.
PATH="$PATH:/usr/X11R6/bin:$HOME/bin:." # !!! Beware of ./ !!!

# notify the user: login or non-login shell. If login, the prompt is
# blue; otherwise, magenta. Root's prompt is red.
# See the Colour-ls mini HOWTO for an explanation of the escape codes.
USER=$(whoami)
if [ $LOGNAME = $USER ] ; then
  COLOUR=44  # blue
else
  COLOUR=45  # magenta
fi

if [ $USER = 'root' ] ; then
  COLOUR=41  # red
  PATH="$PATH:/usr/local/bin" # my choice
fi

ESC="\033"
PROMPT='\h'    # hostname
STYLE='m'      # plain
# PROMPT='\u'  # username
# STYLE=';1m'  # bold
PS1="\[$ESC[$COLOUR;37$STYLE\]$PROMPT:\[$ESC[37;40$STYLE\]\w\\$ "
PS2="> "

# Ulimits: no core dumps, max file size 200 Mb.
ulimit -c 0 -f 200000

# a few variables
USER=$(id -un)
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"  # sendmail, postfix, smail
# MAIL="$HOME/Mailbox"        # qmail
NNTPSERVER=news.myisp.it      # put your own here
VISUAL=jed
EDITOR=jed
HOSTNAME=$(/bin/hostname)
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 PS2 USER LOGNAME MAIL NNTPSERVER
export VISUAL EDITOR HOSTNAME HISTSIZE HISTFILESIZE

# enable colour ls
eval $(dircolors /etc/DIR_COLORS -b)
export LS_OPTIONS='-s -F -T 0 --color=yes'

# customize less
LESS='-M-Q'
LESSEDIT="%E ?lt+%lt. %f"
LESSOPEN="| lesspipe.sh %s"
LESSCHARDEF=8bcccbcc13b.4b95.33b. # show colours in ls -l | less
# LESSCHARSET=latin1
PAGER=less
export LESS LESSEDIT LESSOPEN VISUAL LESSCHARDEF PAGER

# you might need this to fix the backspace key in rxvt/xterm
stty erase ^H  # alternative: ^?

# set xterm title: full path
case $TERM in
  xterm*|rxvt)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
    ;;
esac      

for i in /etc/profile.d/*.sh ; do
  if [ -x $i ]; then
    . $i # beware - variables and aliases might get overridden!
  fi
done

# call fortune, if available 
if [ -x /usr/games/fortune ] ; then
echo ; /usr/games/fortune ; echo 
fi

This is a sample /etc/bashrc:


# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile
# Insert PS1 definitions here if you experience problems.

export CDPATH="$CDPATH:~"

# common aliases
alias cp='cp -i'
alias l=less
alias ls="ls $LS_OPTIONS"
alias mv='mv -i'
alias rm='rm -i'
alias rmbk='/bin/rm -f .*~ *~ *aux *bak *log *tmp 2> /dev/null'
alias u='cd ..'
alias which="type -path"
alias x=startx

# A few useful functions
c ()    # cd to the new directory and list its contents
{
  cd $1 ; ls
}

inst()  # Install a .tar.gz archive in current directory
{
  if [ $# != 0 ]; then tar zxvf $1; fi
}

cz()    # List the contents of a .zip archive
{
  if [ $# != 0 ]; then unzip -l $*; fi
}

ctgz()  # List the contents of a .tar.gz archive
{
  for file in $* ; do
    tar ztf ${file}
  done
}

tgz()   # Create a .tgz archive a la zip.
{
  if [ $# != 0 ]; then
    name=$1.tar; shift; tar -rvf ${name} $* ; gzip -9 ${name}
  fi
}

crpm()  # list information on an .rpm file
{
  if [ $# != 0 ]; then rpm -qil $1 | less; fi
}

This is a sample .bashrc:


# $HOME/.bashrc
# Source global definitions

if [ -f /etc/bashrc ]; then
  . /etc/bashrc
fi

# this is needed to notify the user that they are in non-login shell
if [ "$GET_PS1" = "" ] ; then
  COLOUR=45; ESC="\033"; STYLE=';1m';  # STYLE='m'
  USER=$(whoami)
  export PS1="\[$ESC[$COLOUR;37$STYLE\]$USER:\[$ESC[37;40$STYLE\]\w\\$ "
fi

# personal aliases
alias backup='tar -Mcvf /dev/fd0'
alias dial='eznet up myisp'
alias f='cd ~/fortran'
alias hangup='eznet down'
alias lyx='lyx -width 580 -height 450'
alias restore='tar -M -xpvf /dev/fd0'

# personal functions
xj()    # Launch xjed and a file in background
{
  xjed $1 &
}

This is a sample .bash_profile:


# $HOME/.bash_profile

# User specific environment and startup programs
# This file contains user-defined settings that override
# those in /etc/profile

# Get user aliases and functions
if [ -f ~/.bashrc ]; then
  GET_PS1="NO"  # don't change the prompt colour
  . ~/.bashrc
fi
    
# set a few `default' directories
export CDPATH="$CDPATH:$HOME:$HOME/text:$HOME/text/geology"

This is a sample .inputrc:


# $HOME/.inputrc

# key bindings
"\e[1~": beginning-of-line
"\e[3~": delete-char
"\e[4~": end-of-line
# (F1 .. F5) are "\e[[A" ... "\e[[E"
"\e[[A": "info \C-m"

set bell-style visible          # please don't beep
set meta-flag On                # allow 8-bit input (i.e, accented letters)
set convert-meta Off            # don't strip 8-bit characters
set output-meta On              # display 8-bit characters correctly
set horizontal-scroll-mode On   # scroll long command lines
set show-all-if-ambiguous On    # after TAB is pressed

To make the backspace and delete keys work correctly in xterm and other X11 applications, the following is also needed:

  • put this in your .xinitrc:
    usermodmap=$HOME/.Xmodmap
    xmodmap $usermodmap
    
  • then your .Xmodmap will contain:
    keycode 22 = BackSpace
    keycode 107 = Delete
    
    this fixes the console. To fix xterm:
  • put this in your .Xdefaults:
    xterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\
            <Key>Delete:        string(0x1b) string("[3~")\n\
            <Key>Home:          string(0x1b) string("[1~")\n\
            <Key>End:           string(0x1b) string("[4~")\n\
            Ctrl<Key>Prior:     string(0x1b) string("[40~")\n\
            Ctrl<Key>Next:      string(0x1b) string("[41~")
    
    nxterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\
            <Key>Delete:        string(0x1b) string("[3~")\n\
            <Key>Home:          string(0x1b) string("[1~")\n\
            <Key>End:           string(0x1b) string("[4~")\n\
            Ctrl<Key>Prior:     string(0x1b) string("[40~")\n\
            Ctrl<Key>Next:      string(0x1b) string("[41~")
    

rxvt is a wee bit more complicated, as some compile--time options influence its behaviour. See the above /etc/profile.

More info in bash(1) and readline(3) man pages.

Don't expect every application to work correctly! If you run joe in xterm, for instance, some keys won't work; the same holds for some versions of rxvt.

4.2 I18n

(This section doesn't apply to native English speakers.)

A.k.a. ``internationalisation''. Gasp. This long word means ``to adapt Linux to your local conventions: language, format of date, currency etc.''.

Although Red Hat has its own method for setting up i18n (/etc/sysconfig/i18n), you may want to enable your language only in some cases. I, for one, enabled i18n in kdm (via kdmconfig) and xfce, but want to read English messages when I work in console or xterm.

Consider these lines:

LANG=it # choose your language: fr, de, es, ...
LANGUAGE=it
LC_ALL=it
export LANG LANGUAGE LC_ALL

If you insert them in your .xinitrc or .xsession just before the line that starts the window manager, you'll get internationalised messages - including those in xterms started from within the window manager. But if you'd rather get English messages, set the language to ``en'' and put the same lines in .bash_profile.

4.3 ls(1)

ls can display directory listings using colours to highlight different file types. To enable this feature, you just need a couple of lines in /etc/profile as seen above. However, this won't work with old versions of rxvt; use some flavour of xterm instead. It looks like some old rxvts have a bug that prevents them from inheriting the environment correctly in some circumstances.

4.4 less(1)

With this excellent pager you can browse not only plain text files, but also gzip compressed, tar and zip archives, man pages, and what have you. Its configuration involves a few steps:

  • to use it with the movement keys, have this plain ASCII file .lesskey in your home directory:
    ^[[A   back-line
    ^[[B   forw-line
    ^[[C   right-scroll
    ^[[D   left-scroll
    ^[OA   back-line
    ^[OB   forw-line
    ^[OC   right-scroll
    ^[OD   left-scroll
    ^[[6~  forw-scroll
    ^[[5~  back-scroll
    ^[[1~  goto-line
    ^[[4~  goto-end
    ^[[7~  goto-line
    ^[[8~  goto-end
    
    then run the command lesskey. (These are escape sequences for vt100-like terminals.) This creates a binary file .less containing the key bindings.
  • write the following file as /usr/bin/lesspipe.sh:
    #!/bin/sh
    # This is a preprocessor for 'less'.  It is used when this environment
    # variable is set:   LESSOPEN="|lesspipe.sh %s"
    
    lesspipe() {
      case "$1" in
      *.tar) tar tf $1 2>/dev/null ;; # View contents of .tar and .tgz files
      *.tgz|*.tar.gz|*.tar.Z|*.tar.z) tar ztf $1 2>/dev/null ;;
      *.Z|*.z|*.gz) gzip -dc $1  2>/dev/null ;; # View compressed files correctly
      *.bz2) bzip2 -dc $1  2>/dev/null ;;
      *.zip) unzip -l $1 2>/dev/null ;; # View archives
      *.arj) unarj -l $1 2>/dev/null ;;
      *.rpm) rpm -qpil $1 2>/dev/null ;;
      *.cpio) cpio --list -F $1 2>/dev/null ;;
      *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.l|*.man) FILE=`file -L $1`
        FILE=`echo $FILE | cut -d ' ' -f 2`
        if [ "$FILE" = "troff" ]; then
          groff -s -p -t -e -Tascii -mandoc $1
        fi ;;
      *) file $1 | grep text > /dev/null ;
        if [ $? = 1 ] ; then # it's not some kind of text
          strings $1
        fi ;;
      esac
    }
    
    lesspipe $1
    

    then make it executable with chmod 755 lesspipe.sh.
  • put the variables that affect less in /etc/profile as seen above.

4.5 Editor

Only the most popular will be covered here.

emacs(1)

I rarely use emacs, so I have only a couple of tips for you. Some emacs distributions don't come preconfigured for colours and syntax highlighting. Put this in your .emacs:

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

This only works in X11. Moreover, to enable accented characters you'll add this line:

(standard-display-european 1)

I'll leave it to you to peruse all of emacs' documentation to find out how to tailor it to your needs---potentially, it can take months of hacking. The Dotfile generator (Section Configuration Software) is a good helping hand.

joe(1)

Some versions of joe don't work with colours in console, and some special keys don't work either. A quick and dirty (and inelegant) solution to the former problem is this:

~$ export TERM=vt100
~$ joe myfile
   (edit your file)
~$ export TERM=linux

To make the special keys work, all you have to do is edit .joerc, .jstarrc or your favourite emulation; you can start from the system-wide config files in /usr/lib/joe. Look for the fourth section (key bindings). This enables Home and End:

bol ^[ [ 1 ~    Go to beginning of line
eol ^[ [ 4 ~    Go to end of line

Find out the desired ESC sequences typing cat followed by the special keys.

jed(1)

This is my favourite editor: it does what I need, it's lighter and easier to configure than emacs, and emulates other editors quite well. Many users at my university use jed to emulate EDT, VMS' system editor.

jed's configuration files are .jedrc and /usr/lib/jed/lib/*; the former can be adapted from jed.rc in the latter directory.

  • if xjed apparently doesn't recognise the DEL key, add or comment out these lines in your .jedrc:
    #ifdef XWINDOWS
      x_set_keysym (0xFFFF, 0, "\e[3~");
      setkey (``delete_char_cmd'', "\e[3~");
    #endif
    
  • to make jed emulate EDT (or other editors) all you have to do is edit a couple of lines in .jedrc. If you want the numeric keypad `+' to delete words instead of a single character, add this in .jedrc:
    unsetkey("\eOl");
    unsetkey("\eOP\eOl");
    setkey("edt_wdel", "\eOl");
    setkey("edt_uwdel", "\eOP\eOl");
    
    after the line that reads () = evalfile("edt") (or similar);
  • to make xjed use the numeric keypad for EDT emulation, insert the following in .Xmodmap:
    keycode 77  = KP_F1
    keycode 112 = KP_F2
    keycode 63  = KP_F3
    keycode 82  = KP_F4
    keycode 86  = KP_Separator
    
  • colour customization for xjed is done adding lines like these in .Xdefaults:
    xjed*Geometry: 80x32+150+50
    xjed*font: 10x20
    xjed*background: midnight blue
    # and so on...
    
  • the ``abbreviation'' feature is an invaluable timesaver. Write a file like the following as $HOME/.abbrevs.sl (you can change this name by inserting variable Abbrev_File = "/usr/lib/jed/abbrev.sl"; in .jedrc):
    create_abbrev_table ("Global", "0-9A-Za-z");
    define_abbrev ("Global", "GG", "Guido Gonzato");
    create_abbrev_table ("TeX", "\\A-Za-z0-9");
    define_abbrev ("TeX", "\\beq", "\\begin{equation}");
    define_abbrev ("TeX", "\\eeq", "\\end{equation}");
    % and so on...
    
    and type ESC x abbrev_mode to enable it. To enable the abbreviation by default, add entries like these to your .jedrc:
    define text_mode_hook ()
    {
      set_abbrev_mode (1);
    }
    %
    define fortran_hook ()
    {
      set_abbrev_mode (1);
      use_abbrev_table ("Fortran");
    }
    % and so on...
    

4.6 pine(1)

Edit the global configuration in /usr/lib/pine.conf, taking care at least of the following fields: user-domain, smtp-server, and nntp-server. Note that inbox-path depends on your MTA: if you use sendmail or postfix, that'll be var/spool/mail/$USER; with Qmail, /home/$USER/Mailbox (but root will use /var/qmail/alias/Mailbox.

4.7 minicom(1)

Users can't use minicom unless a global configuration has been made by root. Remember to make it.

4.8 efax(1)

This package is probably the most convenient for simple sending/receiving of faxes. You'll have to tailor the script /usr/bin/fax or (mandrake) /etc/fax.config; easy job, but a couple of quirks caused me quite a headache:

  • to find out whether your modem is class 1, 2, or 2.0, use minicom or similar program to issue the command at+fclass=?. The reply may be like 0,1,2; 1 and 2 are the classes supported by your modem;
  • DIALPREFIX: chances are that simply putting `T' or `P' won't work in some countries-in Italy, at least. Put `ATDT' or `ATDP' instead;
  • INIT and RESET: these strings contain the initialisers `-i' and `-k', needed by efax. If you want to add an AT command, add it to the appropriate string leaving out `AT' and preceding the rest with either `-i' or `-k'. Example: to add the `ATX3' command to INIT, you'll append `-iX3'.

That done, there are a few permissions to fix to enable non-root users to send and receive faxes. The directories /var/lock and /var/spool/fax must be writable. To do so, create the group faxusers, add users to it, then type:

~# chown root.faxusers /var/lock
~# mkdir /var/spool/fax # if it doesn't exist yet
~# chown root.faxusers /var/spool/fax; chmod g+w /var/spool/fax

As a normal user, you'll issue newgrp faxusers before sendig a fax.

4.9 Ghostscript

This essential tool suffers from a small snag. Owing to to the well-known export regulations in the USA, the utility pdf2ps doesn't work with encrypted .pdf files. Never mind: point your browser to http://www.ozemail.com.au/~geoffk/pdfencrypt, download the file pdf_sec.ps and replace the file with the same name that comes with the Ghostscript distribution.

4.10 TeX and Friends

The ``root'' of a TeX system is the directory $TEXMF, which is /usr/share/texmf in teTeX; other distributions may differ (search for ``texmf'' on your system). You normally add stuff or fiddle with files therein.

Expanding $TEXINPUTS

To include PostScript figures or TeX files that reside in subdirectories, it is convenient to expand TeX's search path to include subdirectories. Put this command in your .bash_profile:

export TEXINPUTS="$HOME/mylib::./figures"

which makes TeX search in $HOME/mylib before the default directories, and the directory ./figures afterwards.

Hyphen Patterns

To configure the hyphenation pattern for your language, edit the file $TEXMF/tex/generic/config/language.dat, then do:

~# texconfig init ; texconfig hyphen

Even if you don't write in English, don't remove the entry ``english''; TeX pukes without it.

Dvips

To tailor dvips, the file to edit is $TEXMF/dvips/config/config.ps. Be aware that the fields regarding the default resolution also affect xdvi's behaviour; if you experience annoying attempts to create fonts each time you run it, put the line

XDvi*mfmode:

in your .Xdefault. This should help.

Adding LaTeX Packages

Additional LaTeX packages are available from your nearest CTAN (Comprehensive TeX Archive Network) mirror site, e.g. ftp://ftp.dante.de/pub/tex. Unpack the package under $TEXMF/tex/latex.

If no .sty file exist, run the command latex newstyle.ins or latex newstyle.dtx to create it, then run the command texhash so that teTeX recognises the new package.

4.11 Avoid PPProblems!

I'll take it for granted that your kernel has PPP + TCP/IP support compiled in, that loopback is enabled, and that you already have the pppd package correctly installed and, if you will, set uid root. Obviously, your ISP must support PPP.

There are now two ways to get PPP to work: a) manual configuration, and b) a configuration program that automagically sees to it. Whichever option you choose, have the following information on hand:

  • your ISP's telephone number;
  • your ISP's name, mail and news server address;
  • your ISP's domain;
  • your username and password.

Manual configuration is a drudgery. It's about editing files and writing scripts; not too much work, but it's easy to make mistakes and newcomers are often intimidated. The PPP HOWTO is there for you. Alternatively, there are tools that ask for the information above and do all the work.

Gnome and KDE include, respectively, gnome-ppp and kppp which are easy enough to set up. Alternatively, I suggest that you have a look at a couple of tty--based tools, wvdial and eznet. You feed them your ISP's phone number, your username, your password, and you're in business. Their home pages are at http://www.worldvisions.ca/wvdial and http://www.hwaci.com/sw/eznet. Both are great, but I prefer the latter.

A Quick Start with eznet

First of all, create an /etc/resolv.conf like this:

nameserver w.x.y.z

where you'll insert the address of your ISP's nameserver. To create an account with eznet, issue the following command:

#~ eznet add service=YOUR_ISP user=NAME password=PASSWORD phone=PHONE

which creates the file /var/eznet/eznet.conf, owned by root.root with permissions 600; chmod it to 666 if you want it to be world readable. Now dial your ISP with eznet up YOUR_ISP. If the modem keeps waiting for the dial tone and won't connect, then try this command:

#~ eznet change YOUR_ISP init0=atx3

To hang up, the command is eznet down. That's all!

A Quick Start with wvdial

wvdial's setup is even shorter. Type wvdialconf /etc/wvdial.conf, then edit the resulting file to include your username, password, and phone number. Try it out with wvdial, and keep your fingers crossed. To hang up, stop it with Ctrl-C.

4.12 POP Client

To retrieve your mail from a POP3 server, you need a POP client. Most such clients require that you run an MTA like sendmail, qmail or postfix; a bit of an overkill on low-spec machines. However, there are clients that work without an MTA. The first kind is well represented by fetchmail; the second by fetchpop or frenchie. Sites: ftp://metalab.unc.edu/pub/Linux/system/mail/pop, http://www.lowcountry.com/~jscottb/tcltk.shtml.

To configure these clients:

  • fetchpop: the first time you run it, you'll be prompted for some information. Answer the questions and you're set. fetchpop must be used with the -r switch if your ISP's POP3 server doesn't implement the command LAST properly.
  • frenchie: as above, edit  /.frenchie/frenchierc;
  • fetchmail: adapt this sample .fetchmailrc:
    # $HOME/.fetchmailrc
    poll mbox.myisp.com with protocol pop3;
      user john there with password _Loo%ny is john here 
    
    One user reported that adding ``smtphost localhost'' to the second line improved performance dramatically. You must set the permissions to this file with the command chmod 600 .fetchmailrc, otherwise fetchmail will rightly refuse to start. This example is very basic; there are endless possibilities of configuration. Check out at http://www.ccil.org/~esr/fetchmail.

4.13 Basic Mail Filtering

You will want to protect yourself from spam or huge mail messages. There are two cases: 1) permanent connection to the net, 2) a POP link. In the first case, you can write a .procmailrc file, while in the second there are tools for checking the mail prior to fetching it.

A very simple .procmailrc that defines a few rules:

# $HOME/.procmailrc

MAILDIR=$HOME/mail # make sure it exists

# Store messages directed to the "foo" mailing list to $HOME/mail/foo
:0
* ^To:.*foo
foo

# Discard messages that are not explicitly sent to me or to one of the
# mailling lists I subscribed to.
:0
* !^TO(guido|jed|lugvr|ldp|nobody)
/dev/null

# ditto, for messages larger than 50k.
:0
* > 50000
/dev/null

man procmailex for further examples.

POP users will want to use poppy, a useful Perl script for checking the mail before fetching it. Get it from ftp://metalab.unc.edu/system/mail/pop.

4.14 X Window System (XFree86)

Setting Up the X Server

Come on, it's no longer as difficult as it used to be... All major distributions include a tool for setting up X11 (e.g. XConfigurator, sax, XF86Setup, or at least xf86config). X configuration is virtually automatic these days, but a few video cards may cause a headache.

First of all, check out at the XFree86 site ( http://www.xfree86.org) whether your video card is supported. If so, then try this procedure:

  • install the plain VGA server;
  • go to ftp://ftp.XFree86.org/pub/XFree86/current/binaries, cd to the proper Linux subdirectory, and download the archives X_version_bin.tgz, X_version_set.tgz, and all the servers. Amongst other programs, the first archive contains the most up-to-date SuperProbe;
  • unpack X_version_bin.tgz to a temporary directory, cd to it, and run ./SuperProbe. If your video card is recognised, chances are that you'll be able to set it up. Otherwise, hard luck;
  • install the servers and X_version_set.tgz from /usr/X11R6/, then run XF86Setup.

This has always worked for me, but your mileage may vary. Please note that most times X11 won't start because you chose wrong specs for your monitor! Start with conservative settings, i.e. 800x600 and 256 colours, then pump it up. Warning: these operations are dangerous and your monitor might be damaged!

If your card isn't supported, you can either: 1) wait for the next version of XFree86; 2) buy a commercial X server; 3) buy a supported video card. Quartum non datur.

Keypad

We have seen above how to make a few special keys work. The sample file .Xmodmap works well if you want to use Xjed, but it makes the keypad unusable. You'll then need another config file, which we'll call .Xmodmap.num:

! Definitions can be found in <X11/keysymdef.h>

keycode 77  = Num_Lock
keycode 112 = KP_Divide
keycode 63  = KP_Multiply
keycode 82  = KP_Subtract
keycode 86  = KP_Add
keycode 79  = KP_7
keycode 80  = KP_8
keycode 81  = KP_9
keycode 83  = KP_4
keycode 84  = KP_5
keycode 85  = KP_6
keycode 87  = KP_1
keycode 88  = KP_2
keycode 89  = KP_3
keycode 90  = KP_0
keycode 91  = KP_Decimal

Make sure that your /etc/X11/XF86Config does not contain these three lines:

  ServerNumLock
  Xleds
  XkbDisable

and in case, comment them out. To re-enable the keypad, you'll issue the command xmodmap .Xmodmap.num.

Graphical Login with xdm

To be greeted by a graphical login, edit the file /etc/inittab, which should include a line like this:

x:5:respawn:/usr/bin/X11/xdm -nodaemon # also kdm or gdm

where 5 is the runlevel corresponding to X11. Modify the line that defines the default runlevel (usually 2 or 3), changing it as above:

id:5:initdefault:

The number of colours is specified in /etc/X11/xdm/Xserver:

:0 local /usr/X11R6/bin/X :0 -bpp 16 vt07  # first X server, 65k colours
:1 local /usr/X11R6/bin/X :1 -bpp 32 vt08  # second X server, true colour

If you already have .xinitrc, copy it to .xsession and make the latter executable with chmod +x .xsession. Now issue the command telinit 5 and you're in business.

Window Manager

Once X works, there are endless possibilities of configuration; it depends on the window manager you use, there are tens to choose from. Mostly, it's all down to editing one or more ASCII files in your home directory; in other cases you don't have to edit a thing, and use an applet or even a menu.

Some examples:

  • the fvwm family: copy /etc/X11/fvwm/system.fvwmrc (or similar) to your home using the appropriate name, browse it and start experimenting. You may waste a lot of time before you get the precise look and feel you like;
  • WindowMaker: it has several config files that live under $HOME/GNUstep, and a cool configuration applet;
  • KDE, Gnome, xfce and others: nothing to edit manually here, everything can be done via the menu.

In short: if you don't mind editing config file, choose something like icewm, fvwm*, blackbox etc; if you do mind, the choice is currently restricted to KDE, Gnome, WindowMaker, and Xfce. Email me if I'm wrong.

It's important to have a good .xinitrc. An example:

#!/bin/sh
# $HOME/.xinitrc

usermodmap=$HOME/.Xmodmap
xmodmap $usermodmap

xset s noblank  # turn off the screen saver
xset s 300 2    # screen saver start after 5 min
xset m 10 5     # set mouse acceleration

rxvt -cr green -ls -bg black -fg white -fn 7x14 \
  -geometry 80x30+57+0 &

if [ "$1" = "" ] ; then  # default
  WINMGR=wmaker
else
  WINMGR=$1
fi

$WINMGR

Although it doesn't appear to be strictly required, make it executable with chmod +x .xinitrc.

The .xinitrc above lets you choose the window manager: try

$ startx startkde # or other w.m.

Defaults for X11 Apps

Find out where the app-defaults directory is (it should be /usr/X11R6/lib/X11/app-defaults). Several apps keep a configuration file there.

Adding Fonts

Recent versions of XFree86 (say, > 3.3.4) use an X Font Server that supports PostScript Type 1 and True Type fonts natively, so you can use the wealth of fonts available on the net. There's a simple procedure to follow.

Suppose that you download a Type 1 font collection, e.g. Freefont ( ftp://ftp.gimp.org/pub/gimp/fonts/freefonts-0.10.tar.gz). To make it visible to the font server, unpack the archive from /usr/X11R6/lib/X11/fonts/. Then edit /etc/X11/fs/config, add an entry for the new directory, and restart the font server.

If you're rolling your own font collection, you'll need to supply the files fonts.dir and fonts.scale; the tool to make them is type1inst, available from http://http://goblet.anu.edu.au/~m9305357/type1inst.html.

As for the True Type fonts, group them in a directory of your choice and create fonts.dir using ttmkfdir > fonts.dir, included in the Freetype archive; http://www.freetype.org. Then proceed as above. For example, if you want to use the Windows fonts you have in, say, /mnt/win/windows/fonts, go to that directory, run ttmkfdir, edit /etc/X11/fs/config and restart the font server.

It all started from the original True Type X font server: http://http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/.

4.15 Users' Configurations

When you're done editing the dot files, copy them to /etc/skel as seen in Section Software Configuration.

4.16 Making .rpms

rpm is such a wonderful method of keeping packages under control that I'm reluctant to install .tar.gz archives but in very few special cases (e.g., security). Whenever you install a tarball, consider turning it into an .rpm archive, then reinstall it; consult the RPM HOWTO. Also, if you use recent gcc versions, it may be advisable to put this in your /etc/rpmrc:

optflags: i386 -O2 -mpentiumpro

4.17 Upgrading

If you upgrade your machine, do your backup as usual and remember to save a few additional files. Some could be /etc/X11/XF86Config, /usr/bin/fax, all the stuff in /usr/local, the kernel configuration, the whole /etc, and all the mail in /var/spool/mail.

Then it's time to upgrade (in rare cases, downgrade!) applications that your distribution ship with, and to add additional packages. Keep a list of these ones.


Next Previous Contents