<?xml version="1.0"?>
<article><artheader><title>Configuration HOWTO</title><author><firstname>Guido</firstname><othername>``goccia''</othername><surname>Gonzato</surname><affiliation><address format="linespecific">      <email>ggonza@tin.it</email>
      </address></affiliation></author><pubdate>    Version 1.99.7. 6 November 2001.
  </pubdate><revhistory><revision><revnumber>v1.99.7</revnumber><date>2001-11-06</date><authorinitials>gg</authorinitials><revremark>            Updated and fixed DocBook tags.
      </revremark></revision><revision><revnumber>v1.99.6</revnumber><date>2000-08-31</date><authorinitials>gg</authorinitials><revremark>      </revremark></revision></revhistory><abstract><para>    This HOWTO aims at making the fine--tuning of your newly installed Linux
    box quicker and easier. Here you will find a set of configuration tips
    for the most common applications and services.
  </para></abstract></artheader><sect1 id="introduction"><title>Introduction</title><sect2><title>Why This HOWTO</title><para>  Current distributions are approaching perfection, but some fine-tuning is
  still needed. Many new users are intimidated by the apparent complexity of
  a Linux system, and as a result I note that the same questions crop up on
  c.o.l.setup over and over again. To try and remedy this situation, and for
  my own convenience, I wrote a to--do list that eventually became this
  HOWTO. Here you will find configuration tips and examples for the most
  common applications, programs, and services, which should save you a fair
  amount of time and work.</para><para>  I realise that this HOWTO is quite RedHat-centric. Currently, I only have
  access to Red Hat and Mandrake machines, kernels ranging from 2.0.36 to
  2.2.15; so don't take any of my tips as gospel if you have other
  distributions. Previous versions of this HOWTO provided some information
  for SuSE, Debian and Caldera; but as I no longer have access to those
  machines, I can't keep the details up-to-date. No information is better
  that inaccurate information, so it's up to you to to adapt my tips to your
  distribution.</para><para>  This HOWTO can't replace others, and it's not meant to. Reading docs and
  HOWTOs always pays, so you're strongly advised to do so if you want to
  know more. Also, no spoon--feeding here: if you realise you don't
  understand something, please refer to the relevant HOWTO. Let me remind
  you that the right place for seeking help with Linux configuration is
  Usenet, i.e. <ulink url="news:comp.os.linux.setup">  <citetitle>news:comp.os.linux.setup</citetitle></ulink>.
  <emphasis>Please</emphasis>, don't seek help from me because I'm quite
  overloaded.</para><para>  The official place for this document, which also hosts all other HOWTOs I
  refer to and some translations, is <ulink url="http://www.linuxdoc.org"><citetitle>http://www.linuxdoc.org
  </citetitle></ulink>.</para></sect2><sect2><title>What We Will Be Configuring</title><para>  There can be endless hardware configurations for a PC, but in my
  experience one is quite common: a PC fitted with a large HD split into
  three partitions (one for DOS/Windows, one for Linux, one for the swap),
  sound card, modem, CD-ROM drive, printer, mouse. A parallel port Zip Drive
  is also very common. This machine is possibly part of a mixed
  Windows-Linux network, where it acts as server.</para><para>  This is the hardware I'll assume you want to configure, but it's easy to
  adapt the following tips to different configurations. It's implicitly
  assumed that you'll be root when editing/fixing/hacking.</para><para>  And now, lads, sleeves up.</para></sect2></sect1><sect1><title>General System Setup</title><sect2><title>A Few Words About Security</title><para>  Even before your system boots, you should decide what level of security
  you want to implement. To begin with, don't connect your machine to the
  network until you have decided what to do.</para><para>  Security is a vast subject that goes beyond the scope of this HOWTO; two
  good starting points are the Linux Security Administrator's Guide <ulink url="http://www.securityportal.com/lasg"><citetitle>  http://www.securityportal.com/lasg</citetitle></ulink> and the Linux
  Security Guide <ulink url="http://nic.com/~dave/SecurityAdminGuide/index.html">  <citetitle>http://nic.com/~dave/SecurityAdminGuide/index.html
  </citetitle></ulink>. You should consider at least the following steps:
  using shadow passwords (Shadow Password HOWTO), restricting network access
  to the machine (Section <xref linkend="restricting"></xref>), using the Secure
  Shell (<ulink url="http://www.openssh.org"><citetitle>http://www.openssh.org
  </citetitle></ulink>) or the Secure Remote Password (<ulink url="http://srp.stanford.edu/srp/"><citetitle>  http://srp.stanford.edu/srp/</citetitle></ulink>). Good luck.</para></sect2><sect2><title>Start the Logbook!</title><para>  To keep your installation in shape, it's <emphasis>essential</emphasis>
  that you know exactly what happened to your machine, which packages you
  installed that day, what you removed or modified, and so on. So, the first
  thing you'll do before you tamper with your machine is start a
  ``logbook''. Therein you'll take note of <emphasis>every</emphasis> move
  you make as root; in my own logbook I also keep a section where I list all
  modified system files, additional .rpms, and .tar.gz I installed.
  Optimally, backtracking your moves you should be able to re-obtain a fresh
  installation.</para><para>  Make a backup copy of the system files you touch. Better still, use RCS;
  you'll be able to backtrack all changes. Never work as root without
  logging your moves!</para></sect2><sect2><title>Keyboard</title><para>  If you missed this step during installation or have changed your keyboard,
  you'll have to:</para><para>
<itemizedlist><listitem><para>  look for a suitable key table starting from
  <filename moreinfo="none">/usr/lib/kbd/keymaps/i386</filename>; for example,
  <filename moreinfo="none">querty/it-latin1.kmap.gz</filename> supports the Italian keyboard;</para></listitem><listitem><para>  edit the file <filename moreinfo="none">/etc/sysconfig/keyboard</filename> so as it reads:
  <filename moreinfo="none">KEYTABLE="it-latin1"</filename>;</para></listitem><listitem><para>  to set up the keyboard repeat rate and delay time, add this line to
  <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>:

<screen format="linespecific">/sbin/kbdrate -s -r 16 -d 500  # or whatever you like</screen>
</para></listitem></itemizedlist>
</para><para>  To load the key table, issue </para><screen format="linespecific">/etc/rc.d/init.d/keytable start</screen><para>  Other special keys will be dealt with in the following sections. To enable
  NumLock on by default, add these lines to
  <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>:</para><screen format="linespecific">for tty in /dev/tty[1-9]*; do
  setleds -D +num ent $tty
done</screen><para>  Normally, the Linux console cannot distinguish between, say, Arrow and
  Shift-arrow, but some applications (namely, the editor <xref linkend="jed"></xref>) do. Normally, these key bindings are only available in
  xterm. The following key map, which you can choose to load at boot time,
  is very handy:</para><screen format="linespecific"># Load this key map with: loadkey shift.map
# Shift + Up
shift keycode 103 = F100
string F100 = "\033[a"
# Shift + Left
shift keycode 106 = F101
string F101 = "\033[c"
# Shift + Right
shift keycode 105 = F102
string F102 = "\033[d"
# Shift + Down
shift keycode 108 = F103
string F103 = "\033[b"
# Ctrl + Ins
control keycode 110 = F104
string F104="\033[2^"
# Shift + Ins
shift keycode 110 = F105
string F105="\033[2$"
# Shift + PgUp
shift keycode 104 = F106
string F106 = "\033[5$"
# Shift + PgDn
shift keycode 109 = F107
string F107 = "\033[6$"
# Shift + Home
shift keycode 102 = F108
string F108 = "\033[1$"
# Shift + End
shift keycode 107 = F109
string F109 = "\033[4$"
# Shift + Del
shift keycode 111 = F110
string F110 = "\033[3$"
# Ctrl + Del
control keycode 111 = F111
string F111 = "\033[3^"</screen></sect2><sect2><title>Boot and Rescue Floppy</title><para>  Make a couple of boot floppies for your newly installed system. Your
  distribution may include a command for creating such a floppy (say,
  <filename moreinfo="none">mkbootdisk</filename> or something like that); if not, these
  commands will do:</para><para>
<screen format="linespecific">#~ dd if=/boot/vmlinuz-2.0.36-0.7 of=/dev/fd0  # use your kernel image
#~ rdev /dev/fd0 /dev/hda2                     # your Linux root partition</screen>
</para><para>  Also, have at least a couple of rescue disks ready. There's a wide choice
  of rescue disks at <ulink url="ftp://metalab.unc.edu/pub/Linux/system/recovery"><citetitle>  ftp://metalab.unc.edu/pub/Linux/system/recovery </citetitle></ulink>; if
  you don't know which one to choose, I suggest you try out Tomsbtrt, whose
  home page is <ulink url="http://www.toms.net/rb"><citetitle>http://www.toms.net/rb
  </citetitle></ulink>. It's very complete, but some utilities seem missing
  at first; for example, <filename moreinfo="none"> ftp</filename> is not there but you get
  <filename moreinfo="none">nc</filename> (netcat) instead. Please read its documentation.</para></sect2><sect2 id="console"><title>Console Colours</title><para>  Why stick to white on black in Linux console? With the
  <command moreinfo="none">setterm</command> command you can choose nicer combinations:</para><screen width="80" format="linespecific">setterm -background blue -foreground red -bold on -store</screen><para>  Type <command moreinfo="none">setterm</command> alone for a list of arguments.</para></sect2><sect2><title>Kernel Matters</title><para>  IMHO, the first thing to do next is build a kernel that best suits your
  system. It's very simple to do but, in any case, refer to the
  <filename moreinfo="none">README</filename> file in <filename moreinfo="none">/usr/src/linux/</filename>
  or the Kernel HOWTO. Hints:</para><para>
<itemizedlist><listitem><para>  consider carefully your needs. Choosing a kernel configuration, applying
  the patches, and compiling it once and for all is more productive than
  reconfiguring and recompiling each month; this is especially true if your
  Linux box is a server. Don't forget to include support for all the
  hardware you might likely add in the future (e.g. SCSI, Zip, network
  cards, etc); using modules is usually the best choice;</para></listitem><listitem><para>  notebook users: if you plan to use a PCMCIA modem/fax, remember to compile
  serial support <emphasis>in the kernel</emphasis>. Don't compile it as a
  module, as this would need more complex configuration;</para></listitem><listitem><para>  remember to compile everything you need; i.e., don't forget the pcmcia
  modules, or the ALSA sound drivers;</para></listitem><listitem><para>  to save time the next time you reconfigure and recompile the kernel, it's
  a good idea to save your configuration on a file and keep it in a safe
  place. If you upgrade the kernel and use ``make oldconfig'', your old
  config file will be taken and any not included features will be prompted
  whether they should be included, resulting in a new, upgraded config file.</para></listitem></itemizedlist>
</para></sect2><sect2><title>Hard Disk Performance</title><para>  Your (E)IDE hard disk's performance can be greatly enhanced by
  <emphasis>carefully</emphasis> using <filename moreinfo="none">hdparm</filename>(8). If
  your Linux distribution doesn't include it, you'll find on <ulink url="ftp://metalab.unc.edu/pub/Linux/system/hardware"><citetitle>  ftp://metalab.unc.edu/pub/Linux/system/hardware </citetitle></ulink>; look
  for a file called <filename moreinfo="none">hdparm-X.Y.tar.gz</filename>.</para><para>  Since many details depend on your hard disk and HD controller, I can't
  give you a general recipe. You risk to toast your filesystem, so
  <emphasis>read the man page carefully</emphasis> before using some of the
  options. At its simplest, you could add the following line to
  <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>:</para><para>
<screen format="linespecific">/sbin/hdparm -c1 /dev/hda  # first IDE drive assumed</screen>
</para><para>  which enables (E)IDE 32-bit I/O support. As for the
  `<filename moreinfo="none">-m</filename>' option, this is what <filename moreinfo="none">hdparm</filename>
  author Mark Lord emailed me:</para><para><quote> (...) if your system uses components from the past couple of years
  entent 1997], it will be fine. Older than that, there *may* be a
  problem (unlikely). The really buggy chips were the CMD0646 and RZ1000
  chips, used *extensively* on 486 and (early) 586 motherboards about 2-3
  years ago.
  </quote></para><para>  For recent machines, these settings should work fine:</para><para>
<screen format="linespecific">/sbin/hdparm -c1 -A1 -m16 -d1 /dev/hda</screen>
</para></sect2><sect2><title>Parallel Port Zip Drive</title><para>  Stock kernels include the driver for both old (ppa) and new (imm) Zip
  drives. If you recompile the kernel, make sure that SCSI support and SCSI
  disk support are enabled. Remember, there can be conflicts between the
  printer and the Zip drive on the same parallel port, so you have better
  use kernel modules.</para><para>  Zip disks are sold preformatted on partition
  <filename moreinfo="none">/dev/sda4</filename>. To enable the Zip, append this to
  <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>:</para><para>
<screen format="linespecific"># Enable the Zip drive
/sbin/modprobe ppa  # imm for recent models</screen>
</para><para>  Zip disks can be mounted via <filename moreinfo="none">/etc/fstab</filename> as shown
  below, or via Mtools adding this line to your
  <filename moreinfo="none">/etc/mtools.conf</filename>:</para><para>
<screen format="linespecific">drive z: file="/dev/sda4" exclusive</screen>
</para><para>  besides, the command <filename moreinfo="none">mzip</filename> allows you to eject, query
  the status, write and password protect Zip disks; <filename moreinfo="none">man
  mzip</filename> for details. The Mtools home page is at <ulink url="http://linux.wauug.org/pub/knaff/mtools"><citetitle>  http://linux.wauug.org/pub/knaff/mtools</citetitle></ulink>.</para></sect2><sect2><title>Device Drivers</title><para>  Devices in <filename moreinfo="none">/dev</filename> (or better, links to the actual
  device drivers) may be missing. Check what devices your mouse, modem, and
  CD--ROM drive correspond to, then do what follows:</para><para>
<screen format="linespecific">~# cd /dev
/dev# ln -s ttyS0 mouse; ln -s ttyS1 modem; ln -s hdb cdrom; ln -s sda4 zip</screen>
</para><para>  In most notebooks the mouse device is <filename moreinfo="none">/dev/psaux</filename>:
  take this into account when configuring X11. If you wish, do
  <filename moreinfo="none">chmod 666</filename> to these devices to make them fully
  accessible by every user.</para></sect2><sect2><title>Sound Card</title><para>  My desktop PC is fitted with an old Sound Blaster 16; even if you've got
  something different, you may take what follows as guidelines.</para><para>  I compiled the sound card support as a module (<filename moreinfo="none">sb.o</filename>).
  Then I put this in <filename moreinfo="none">/etc/conf.modules</filename>:</para><para>
<screen format="linespecific">options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
alias sound sb</screen>
</para><para>  To enable the sound, make sure that <filename moreinfo="none">modprobe sound</filename> is
  invoked in <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>. Alternatively, get the
  tool <filename moreinfo="none">sndconfig</filename> from the RedHat site.</para><para>  Besides the standard kernel sound drivers, the Alsa drivers (<ulink url="http://www.alsa-project.org"><citetitle>  http://www.alsa-project.org</citetitle></ulink>) are an excellent choice.
  Strangely, though, the sound channels are muted by default. You'll want to
  use <filename moreinfo="none">aumix</filename> and this <filename moreinfo="none">/etc/aumixrc</filename>
  to set the volume to 100ent:</para><para>
<screen format="linespecific">vol:100:100:P
synth:100:100:P
pcm:100:100:P
line:100:100:P
mic:100:100:R
cd:100:100:P</screen>
</para></sect2><sect2><title>Login Messages</title><para>  If you wish to customise the login messages, check whether your
  <filename moreinfo="none">/etc/rc.d/rc.local</filename> overwrites
  <filename moreinfo="none">/etc/issue</filename> and <filename moreinfo="none">/etc/motd</filename>.
  (RedHat does.) If so, get on with your editor.</para><para>  If you'd like a colourised login message, you may adapt your
  <filename moreinfo="none">rc.local</filename> inserting lines like these:</para><para>
<screen format="linespecific"># put a real escape character instead of ^[. To do this:
# emacs: ^Q ESC   vi: ^V ESC   joe:  ` 0 2 7   jed: ` ESC
ESC="^["  # a real escape character
BLUE="$ESC[44;37m"
NORMAL="$ESC[40;37m"
CLEAR="$ESC[H$ESC[J"

ent /etc/issue
echo "$CLEAR" entent /etc/issue
echo "$BLUE   Welcome to MyServer (192.168.1.1)   " entent /etc/issue
echo "$NORMAL " entent /etc/issue
echo "" entent /etc/issue</screen>
</para></sect2><sect2 id="hostname"><title>Hostname </title><para>  Issuing the command <filename moreinfo="none">hostname
  new_host_name</filename> may not be enough. To avoid the
  dreaded <filename moreinfo="none">sendmail</filename> lock, follow these steps (only valid
  for a stand--alone machine):</para><para>
<itemizedlist><listitem><para>  edit <filename moreinfo="none">/etc/sysconfig/network</filename> and change the hostname
  therein (e.g. <filename moreinfo="none">new_host_name.your_domain</filename>);
</para></listitem><listitem><para>  edit <filename moreinfo="none">/etc/HOSTNAME</filename> appropriately;
</para></listitem><listitem><para>  append the new hostname in the line in <filename moreinfo="none">/etc/hosts</filename>:

<screen format="linespecific">127.0.0.1       localhost  new_host_name.your_domain</screen>
</para></listitem></itemizedlist>
</para></sect2><sect2><title>Mouse</title><para>  <filename moreinfo="none">gpm</filename> mouse services are useful to perform cut and
  paste in tty mode, and to use the mouse in some applications. Make sure
  that you have a file called <filename moreinfo="none">/etc/sysconfig/mouse</filename> and
  that it reads:</para><para>
<screen format="linespecific">MOUSETYPE="Microsoft"
XEMU3=yes</screen>
</para><para>  Moreover, you must have a file <filename moreinfo="none">/etc/rc.d/init.d/gpm</filename>, where
  you'll put additional command line parameters. Mine reads:</para><para>
<screen format="linespecific">...
       daemon gpm -t $MOUSETYPE -d 2 -a 5 -B 132 # two-button mouse
...</screen>
</para><para>  Obviously, make sure this configuration is right for your mouse type. In
  most notebooks, <filename moreinfo="none">MOUSETYPE</filename> is
  ``<filename moreinfo="none">PS/2</filename>''.</para><para>  If you like to use menus in console with Ctrl-button, then configure
  <filename moreinfo="none">gpm-root</filename>. Edit the default menu in
  <filename moreinfo="none">/etc/gpm-root.conf</filename>, then launch
  <filename moreinfo="none">gpm-root</filename> from
  <filename moreinfo="none">/etc/rc.d/rc.local</filename>.</para></sect2><sect2><title>Mount Points</title><para>  It's handy to have mount points for the floppy, other devices and
  NFS-exported directories. For example, you can do the following:</para><para>
<screen format="linespecific">~# cd /mnt; mkdir floppy cdrom win zip server</screen>
</para><para>  This creates mount points for a DOS/Win floppy, the CD--ROM, the Windows
  partition, the parallel port Zip drive, and an NFS directory.</para><para>Now edit the file <filename moreinfo="none">/etc/fstab</filename> and add the following
entries:</para><para>
<screen format="linespecific">/dev/fd0        /mnt/floppy     auto            user,noauto 0 1
/dev/cdrom      /mnt/cdrom      iso9660         ro,user,noauto 0 1
/dev/zip        /mnt/zip        vfat            user,noauto,exec 0 1
/dev/hda1       /mnt/win        vfat            user,noauto 0 1
server:/export  /mnt/server     nfs             defaults</screen>
</para><para>  Obviously, you must use the correct device in the first field.</para><para>  Note the `auto' filesystem type in the first line; it allows you to mount
  both ext2 and vfat (DOS/Windows) floppies, but you need a recent version
  of <filename moreinfo="none">mount</filename>. You may find <filename moreinfo="none">mtools</filename>
  more convenient.</para></sect2><sect2><title>Automount Points</title><para>  If you don't like the mounting/unmounting thing, consider using
  <filename moreinfo="none">autofs</filename>(5). You tell the autofs daemon what to
  automount and where starting with a file,
  <filename moreinfo="none">/etc/auto.master</filename>. Its structure is simple:</para><para>
<screen format="linespecific">/misc	/etc/auto.misc
/mnt	/etc/auto.mnt</screen>
</para><para>  In this example you tell autofs to automount media in <filename moreinfo="none">/misc</filename>
  and <filename moreinfo="none">/mnt</filename>, while the mountpoints are specified
  in<filename moreinfo="none">/etc/auto.misc</filename> and <filename moreinfo="none">/etc/auto.mnt</filename>. An example
  of <filename moreinfo="none">/etc/auto.misc</filename>:</para><para>
<screen format="linespecific"># an NFS export
server	 	-ro			my.buddy.net:/pub/export
# removable media
cdrom       	-fstype=iso9660,ro	:/dev/hdb
floppy		-fstype=auto		:/dev/fd0</screen>
</para><para>  Start the automounter. From now on, whenever you try to access the
  inexistent mount point <filename moreinfo="none">/misc/cdrom</filename>, il will be
  created and the CD-ROM will be mounted.</para></sect2><sect2><title>lilo(8) and LOADLIN.EXE</title><para>  Many users run both Linux and DOS/Windows on their PC, and want to choose
  at boot time which os to use; this should be done at install time, but in
  case, do what follows. Let's suppose that <filename moreinfo="none">/dev/hda1</filename>
  contains DOS/Windows and that <filename moreinfo="none">/dev/hda2</filename> contains Linux.</para><para>
<screen format="linespecific">~# fdisk
Using /dev/hda as default device!

Command (m for help):a
Partition number (1-4): 2

Command (m for help):w
~#</screen>
</para><para>  This makes the Linux partition bootable. Then write this basic
  <filename moreinfo="none">/etc/lilo.conf</filename> file:</para><para>
<screen format="linespecific">boot = /dev/hda2
compact                # may conflict with "linear"
delay = 100            # 10 seconds
linear                 # gets rid of the "1024 cylinder" problem
#lba32                 # alternative
message = /boot/bootmesg.txt  # write your own, if you will
root = current
image = /boot/vmlinuz  # boot linux by default as this entry comes first
  label = linux
  read-only
#  append="mem=128M"   # to see more memory than 64M
other = /dev/hda1
  table = /dev/hda
  label = win</screen>
</para><para>  Now issue <filename moreinfo="none">/sbin/lilo</filename> and you're done. Being
  <filename moreinfo="none">lilo</filename> a crucial part of your installation, you're
  strongly advised to read its documentation anyway.</para><para>  To boot Linux from DOS/Windows without resetting, put
  <filename moreinfo="none">LOADLIN.EXE</filename> in a directory (in the DOS partition!)
  included in the DOS path; then copy your kernel to, say,
  <filename moreinfo="none">C:entTEMPentVMLINUZ</filename>. The following simple
  <filename moreinfo="none">.BAT</filename> file will boot Linux:</para><para>
<screen format="linespecific">rem   linux.bat
smartdrv /C
loadlin c:\temp\vmlinuz root=/dev/hda2 ro</screen>
</para><para>  If you use Windows 9x, set the properties of this
  <filename moreinfo="none">.BAT</filename> so as it starts in MS--DOS mode.</para><sect3><title>Security Tip</title><para>  Making a backup copy of your MBR before installing Linux is a safe move.
  Prepare a Windows rescue floppy, and make sure it includes
  <filename moreinfo="none">FDISK.EXE</filename>. To restore the MBR, all you have to do is</para><para>
<screen format="linespecific">A:\ent fdisk /mbr</screen>
</para></sect3></sect2><sect2><title>Printer Configuration (lpd)</title><para>  All distributions I know have a configuration tool for setting up the
  printer (<filename moreinfo="none">printtool</filename>, <filename moreinfo="none">yast</filename>, or
  <filename moreinfo="none">magicfilter</filename>); if you don't have it, this is a basic
  manual configuration.</para><para>  Let's suppose you have a non--PostScript (non ``Windows-only'' too!)
  printer you want to use to print raw text (e.g., C source files) and
  PostScript files via Ghostscript, which is assumed to be already
  installed.</para><para>Setting up the printer involves a few steps:</para><para>
<itemizedlist><listitem><para>  find out which one the parallel print device is: try 

<screen format="linespecific">~# echo "hello, world" ent /dev/lp0
~# echo "hello, world" ent /dev/lp1</screen>

and take note which one works.
</para></listitem><listitem><para>  make two spool directories:

<screen format="linespecific">~# cd /var/spool/lpd
/var/spool/lpd/# mkdir raw; mkdir postscript</screen>
</para></listitem><listitem><para>  if your printer exibits the ``staircase effect'' (most inkjets do), you'll
  need a filter. Try to print two lines with


<screen format="linespecific">~# echo "first line" ent /dev/lp1 ; echo "second line" ent /dev/lp1</screen>

if the output is like this:

<screen format="linespecific">first line
          second line</screen>

  then save this script as <filename moreinfo="none">/var/spool/lpd/raw/filter</filename>:

<screen format="linespecific">#!/bin/sh
# This filter eliminates the "staircase effect"
awk '{print $0, "\r"}'</screen>


  and make it executable with <filename moreinfo="none">chmod 755
  /var/spool/lpd/raw/filter</filename>.
</para></listitem><listitem><para>  make a filter for PostScript emulation. Write the following filter as
  <filename moreinfo="none">/var/spool/lpd/postscript/filter</filename>:


<screen format="linespecific">#!/bin/sh

DEVICE=djet500
RESOLUTION=300x300
PAPERSIZE=a4
SENDEOF=

nenscript -TUS -ZB -p- |
if [ "$DEVICE" = "PostScript" ]; then
  cat -
else
  gs -q -sDEVICE=$DEVICE \
    -r$RESOLUTION \
    -sPAPERSIZE=$PAPERSIZE \
    -dNOPAUSE \
    -dSAFER \
    -sOutputFile=- -
fi

if [ "$SENDEOF" != "" ]; then
  printf "\004"
fi</screen>

(in this example an HP DeskJet printer is assumed. Adapt it to your
printer).
</para></listitem><listitem><para> finally, add the following entries in <filename moreinfo="none">/etc/printcap</filename>:

<screen format="linespecific"># /etc/printcap
lp|ps|PS|PostScript|djps:\
        :sd=/var/spool/lpd/postscript:\
        :mx#0:\
        :lp=/dev/lp1:\
        :if=/var/spool/lpd/postscript/filter:\
        :sh:
raw:\
        :sd=/var/spool/lpd/raw:\
        :mx#0:\
        :lp=/dev/lp1:\
        :if=/var/spool/lpd/raw/filter:\
        :sh:</screen>

</para></listitem></itemizedlist>
</para><para>  For more complex or exotic printing configurations, the Printing-HOWTO
  awaits you.</para><para>  If you use <filename moreinfo="none">printtool</filename>, be aware that the GSDEVICE
  chosen by Printtool will work, but not necessarily at its best for your
  printer. You may consider fiddling a bit with the file
  <filename moreinfo="none">postscript.cfg</filename>; for instance, I changed GSDEVICE from
  <filename moreinfo="none">cdj500</filename> to <filename moreinfo="none">djet500</filename> and now my
  prints come out much quicker.</para></sect2><sect2 id="svga"><title>SVGATextMode </title><para>  This utility, available on <ulink url="ftp://tsx-11.mit.edu/pub/linux/sources/sbin"><citetitle>  ftp://tsx-11.mit.edu/pub/linux/sources/sbin</citetitle></ulink>, is useful
  for changing the console screen resolution, font, and cursor shape. Users
  whose language include accented characters will be able to use them in
  console applications, while notebook users may change the cursor shape to
  make it more visible.</para><para>  Edit <filename moreinfo="none">/etc/TextConfig</filename> or
  <filename moreinfo="none">/etc/TextMode</filename>, starting with the default VGA
  definition. Europeans should be happy with this ``LoadFont'' section:</para><para>
<screen format="linespecific">Option "LoadFont"
FontProg "/usr/bin/setfont"
FontPath "/usr/lib/kbd/consolefonts"
FontSelect "lat1u-16.psf"   8x16 9x16 8x15 9x15
FontSelect "lat1u-14.psf"   8x14 9x14 8x13 9x13
FontSelect "lat1u-12.psf"   8x12 9x12 8x11 9x11
FontSelect "lat1u-08.psf"   8x8  9x8  8x7  9x7</screen>
</para><para>  Once you're done, try your configuration with a command like
  <filename moreinfo="none">SVGATextMode "80x34x9"</filename>, and if everything appears to
  be working fine, remove the warnings from
  <filename moreinfo="none">/etc/TextMode</filename> and include this line in
  <filename moreinfo="none">etc/rc.d/rc.sysinit</filename>:</para><para>
<screen format="linespecific"># SVGATextMode
/usr/sbin/SVGATextMode "80x34x9"</screen>
 </para><para>Please note that the block cursor only works with some modes; on my
notebook, "80x30x9".</para></sect2></sect1><sect1><title>Common Administration Tasks</title><para>  Here is where the fun begins. This section is rather network-centric,
  though many other tasks await you.</para><para>  Networking is a vast subject which cannot be fully covered here. The
  reference is the NET-3 HOWTO, and most distributions provide documentation
  on setting up network services. Only a few points will be recalled here.</para><para>  A quick to-do list for the services you may want to install: cron and
  timed tasks like calendar or reminder, Http, Samba, telnet/ssh access,
  anonymous ftp, POP/IMAP server, NFS...</para><sect2><title>Network Configuration</title><para>  If your network card wasn't recognised at install time, don't worry: in
  most cases it's either NE2000 or 3c59x compatible. Issue the command
  <filename moreinfo="none">modprobe ne</filename> or <filename moreinfo="none">modprobe 3c59x</filename>
  and see if the relevant module is loaded, then add this line in
  <filename moreinfo="none">/etc/conf.modules</filename>:</para><para>
<screen format="linespecific">alias eth0 ne  # or 3c59x</screen>
</para><para>  Now you're ready to use <filename moreinfo="none">netcfg</filename> or similar tool to set
  up the network configuration. The relevant files are
  <filename moreinfo="none">/etc/HOSTNAME</filename>, <filename moreinfo="none">etc/hosts</filename>,
  <filename moreinfo="none">/etc/resolv.conf</filename>,
  <filename moreinfo="none">/etc/sysconfig/network</filename>, and
  <filename moreinfo="none">/etc/sysconfig/network-scripts/ifcfg-eth0</filename>; services
  should be started with scripts in <filename moreinfo="none">/etc/rc.d/init.d</filename>.</para><para>This is a sample <filename moreinfo="none">etc/hosts</filename>:</para><para>
<screen format="linespecific">127.0.0.1               localhost
192.168.1.1             paleo.eocene.net        paleo
192.168.1.2             nautilus.eocene.net     nautilus</screen>
</para><para>This is <filename moreinfo="none">/etc/resolv.conf</filename>:</para><para>
<screen format="linespecific">search df.unibo.it,eocene.net
nameserver 195.210.91.100</screen>
</para><para>This is <filename moreinfo="none">/etc/sysconfig/network</filename> (Red Hat-dependent):</para><para>
<screen format="linespecific">NETWORKING=false
FORWARD_IPV4=true
HOSTNAME=nautilus.eocene.net
DOMAINNAME=eocene.net</screen>
</para><para>And finally, <filename moreinfo="none">/etc/sysconfig/network-scripts/ifcfg-eth0</filename>.
This one, too, is Red Hat-dependent; it must be executable.</para><para>
<screen format="linespecific">DEVICE=eth0
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=no</screen>
</para><para>  Although the actual method of starting network services of your
  distribution may be much more complex, the following script should be
  enough to get you started:</para><para>
<screen format="linespecific">#!/bin/sh

# net-up.sh: set up network access

DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1

ifconfig $DEVICE $IPADDR netmask $NETMASK up
route add -net $NETWORK netmask $NETMASK $DEVICE
route add default gw $GATEWAY</screen>

If you'd like to do networking experiments with the loopback interface, all
you have to do is:

<screen width="80" format="linespecific">ifconfig lo 127.0.0.1
route add -host 127.0.0.1 lo</screen>

</para><para>  This script is handy for enabling network access when you use a rescue
  disk. Obviously, this lets you only ping, ftp and telnet to the outside;
  it won't start any daemon.</para></sect2><sect2><title>Network for Notebooks</title><para>  When you plug the network PC card in, the script
  <filename moreinfo="none">/etc/pcmcia/network</filename> will be run. All it needs is a
  properly set up
  <filename moreinfo="none">/etc/sysconfig/network-scripts/ifcfg-eth0</filename>.</para><para>  Setting up the network can become a bit trickier, though. In fact, you
  must provide the right settings for each network you connect to, as well
  as settings for the notebook when it's not connected.</para><para>  I rolled up a rough but functional solution. I use my notebook as a
  stand-alone machine, connecting to the net via PPP; at home, IP address
  192.168.1.2; and at university, IP 137.204.x.y. So, I created a set of
  configuration files for each network; all these are kept in
  <filename moreinfo="none">/etc/mobnet</filename>. A script is then used to select the
  working environment. For instance, this is
  <filename moreinfo="none">/etc/mobnet/home.cfg</filename>:</para><para>
<screen format="linespecific"># /etc/mobnet/home.conf

HOSTNAME=nautilus.eocene.net	# complete hostname
DOMAINNAME=eocene.net		# your domain
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
FORWARD_IPV4=true
NAMESERVER=195.210.91.100	# required
SEARCH=df.unibo.it,eocene.net	# optional
SERVICES="inet httpd smb sshd"</screen>
</para><para>  This is <filename moreinfo="none">mnet</filename>, the script I use to choose the network
  profile:</para><para>
<screen format="linespecific">#!/bin/sh
# mnet: script to set up the "mobile network" configuration.
# Last modified: 15 July 2000

# start or stop services
activate_services()
{
  for service in $(echo $SERVICES) ; do
    [ -x /etc/rc.d/init.d/$service ] entent /etc/rc.d/init.d/$service $1
  done
}

# usage
if [ $# = 0 ] ; then
  echo "Usage: mnet entconfig nameent"
  echo "Example: mnet office"
  exit 1
fi

# check if the configuration exists
if [ ! -e /etc/mobnet/$1.conf ]; then
  echo "This configuration doesn't exist."
  exit 1
fi

# read the configuration
. /etc/mobnet/$1.conf

# set up the host name
echo $HOSTNAME ent /etc/HOSTNAME
/bin/hostname $HOSTNAME

# set up the name server(s)
cat ententEOF ent /etc/resolv.conf
# /etc/resolv.conf
search $SEARCH
nameserver $NAMESERVER
EOF

# stop previous services, if any
if [ -f /etc/mobnet/services.prev ]; then
  NEWSERVICES=$SERVICES
  . /etc/mobnet/services.prev
  activate_services stop
  SERVICES=$NEWSERVICES
fi

if [ $1 != "none" ]; then
# set up the network parameters
  cat ententEOF ent /etc/sysconfig/network
  NETWORKING=yes
  FORWARD_IPV4=true
  HOSTNAME=$HOSTNAME
  DOMAINNAME=$DOMAINNAME
  GATEWAY=$GATEWAY
  GATEWAYDEV=eth0
EOF

  cat ententEOF ent /etc/sysconfig/network-scripts/ifcfg-eth0
  DEVICE=eth0
  IPADDR=$IPADDR
  NETMASK=$NETMASK
  NETWORK=$NETWORK
  BROADCAST=$BROADCAST
  ONBOOT=no
EOF
  /bin/chmod +x /etc/sysconfig/network-scripts/ifcfg-eth0
  
  # copy the other config files
  /bin/cp -f /etc/mobnet/hosts.$1	/etc/hosts
  /bin/cp -f /etc/mobnet/smb.conf.$1	/etc/smb.conf
  
  echo -n "Insert the network PC card and press ententerent when done: "
  read
    
  # OK, now start services
  activate_services start
  echo "SERVICES=\"$SERVICES\"" ent /etc/mobnet/services.prev

else # it's not "none"

  cat ententEOF ent /etc/sysconfig/network
  NETWORKING=false
  FORWARD_IPV4=false
  HOSTNAME=$HOSTNAME
  DOMAINNAME=$DOMAINNAME
EOF
  /bin/rm -f /etc/sysconfig/network-scripts/ifcfg-eth0*
  /sbin/ifconfig eth0 down
  echo "SERVICES=$SERVICES" ent /etc/mobnet/services.prev
  echo "Now you may remove the PC card."
  exit 0

fi

# end of mnet.</screen>
</para><para>  As I said, it is rough and even not complete: other files may depend on
  the network, like <filename moreinfo="none">/etc/fstab</filename>,
  <filename moreinfo="none">/etc/exports</filename>, and <filename moreinfo="none">/etc/printcap</filename>.
  Think about network printers and NFS shares. Feel free to adapt this
  bare-bone solution to your needs.</para></sect2><sect2><title>Sharing the Internet</title><para>  One of the most useful tasks for a Linux server. Currently, most stock
  kernels come with IP firewalling, masquerading and forwarding enabled by
  default; if in doubt, consult the IP-Masquerade mini-HOWTO to learn how to
  enable them. Then install ipfwadm (kernels 2.0.x; <ulink url="http://www.xos.nl/linux/ipfwadm/"><citetitle>  http://www.xos.nl/linux/ipfwadm/</citetitle></ulink>) or ipchains (kernels
  2.2.x; <ulink url="http://www.adelaide.net.au/~rustcorp/ipfwchains/ipfwchains.html">  <citetitle>  http://www.adelaide.net.au/~rustcorp/ipfwchains/ipfwchains.html
  </citetitle></ulink>). Remember to enable kernel modules for the services
  you need, e.g. for ftp you'll add this line to
  <filename moreinfo="none">/etc/rc.d/rc.sysconfig</filename>:</para><para>
<screen format="linespecific">/sbin/modprobe ip_masq_ftp</screen>
</para><para>Other modules are usually found in 
<filename moreinfo="none">/lib/modules/KERNEL-VERSION/ipv4</filename>.</para><para>  Enabling IP masquerading for other machines in your local network is very
  simple. First, check the network initialisation scripts
  (<filename moreinfo="none">/etc/sysconfig/network</filename> should be the right place) to
  see if they contain a line that reads
  <filename moreinfo="none">FORWARD_IPV4=true</filename>. It's used to set
  <filename moreinfo="none">/proc/sys/net/ipv4/ip_forward</filename> to 1 when the network
  subsystem comes up.</para><para>Add these lines to <filename moreinfo="none">/etc/rc.d/rc.sysinit</filename>:</para><para>
<screen format="linespecific"># default: packets cannot reach the outside
/sbin/ipfwadm -F -p deny
# allow all machines on the local network to reach the Internet
/sbin/ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0
# alternatively, allow only these two machines
# /sbin/ipfwadm -F -a m -S 192.168.1.100/24 -D 0.0.0.0/0
# /sbin/ipfwadm -F -a m -S 192.168.1.101/24 -D 0.0.0.0/0</screen>
</para><para>  If you use a kernel of the 2.2.x series, use
  <filename moreinfo="none">ipfwadm-wrapper</filename> instead of
  <filename moreinfo="none">ipfwadm</filename> to get started quickly. More information at
  <ulink url="http://ipmasq.cjb.net"><citetitle><citetitle>  http://ipmasq.cjb.net</citetitle></citetitle></ulink>.</para><para>  Now you'll want something to let client machines dial the ISP; I use
  Mserver (<ulink url="http://cpwright.villagenet.com/mserver/"><citetitle>  http://cpwright.villagenet.com/mserver/</citetitle></ulink>). Edit
  <filename moreinfo="none">etc/mserver.conf</filename>; the only entries that you should
  modify are ``checkhost'', ``shadow'', and ``cname''. Then define your
  connection(s). Obviously, install a suitable client on the client
  machines.</para></sect2><sect2 id="restricting"><title>Restricting Network Access </title><para>Let's suppose you connect to the Internet via PPP. Once you're connected,
your machine may become vulnerable to attacks. Insert this in
<filename moreinfo="none">/etc/hosts.allow</filename>:</para><para>
<screen format="linespecific"># only allow access to localhost
ALL: 127.</screen>
</para><para>and this in <filename moreinfo="none">/etc/hosts.deny</filename>:</para><para>
<screen format="linespecific"># deny access to everyone
ALL: ALL</screen>
</para><para>If you belong to a network with direct Internet access, you had better
disable finger, telnet, and possibly other services for security reasons;
use <filename moreinfo="none">ssh</filename> instead of telnet. The file to edit is
<filename moreinfo="none">/etc/inet.conf</filename>. Alternatively, you can restrict network
access putting this in <filename moreinfo="none">/etc/hosts.allow</filename>:</para><para>
<screen format="linespecific">in.telnetd: 192.168.1., .another.trusted.network
in.ftpd: 192.168.1., .another.trusted.network</screen>
</para><para>and this in <filename moreinfo="none">/etc/hosts.deny</filename>:</para><para>
<screen format="linespecific">in.telnetd: ALL
in.ftpd: ALL</screen>
</para></sect2><sect2><title>NFS Exports</title><para> </para><para>It is common to export home directories on the server; a problem arises if a
user's UID and GID are not consistent across different machines. If user
`guido' has UID/GID = 500 on <filename moreinfo="none">server</filename> and UID/GID = 512
on <filename moreinfo="none">client</filename>, a convenient configuration is this:</para><para>
<screen format="linespecific"># /etc/exports
/tmp            my.client.machine(rw)
/home/guido     my.client.machine(rw,all_squash,anonuid=512,anongid=512)</screen>
</para></sect2><sect2><title>Samba</title><para>Almost trivial, but there's always a little bit to do. If you want to
connect Windows 98/NT clients, did you remember to read the docs and, in
case, enable clear text passwords? The distribution includes .reg files for
Win9x/NT/2000; if your clients can't connect to the Linux server, load them
on every client.</para><para>Samba comes with a fairly complete sample
<filename moreinfo="none">/etc/smb.conf</filename>, but strangely it lacks a section showing
how to (un)mount removable media. The clauses <filename moreinfo="none">preexec</filename>
and <filename moreinfo="none">postexec</filename> do the trick:</para><para>
<screen format="linespecific">[cdrom]
  comment = CD-ROM
  path = /mnt/cdrom
  public = yes
  read only = yes
; you might need to use "root preexec/postexec"
  preexec = mount /mnt/cdrom
  postexec = umount /mnt/cdrom</screen>
</para><para>Also: you know what Swat is, don't you? Enable it adding this line in your
<filename moreinfo="none">/etc/inetd.conf</filename>:</para><para>
<screen format="linespecific">swat      stream  tcp     nowait.400      root /usr/sbin/swat swat</screen>
</para><para>and this in <filename moreinfo="none">/etc/services</filename>:</para><para>
<screen format="linespecific">swat            901/tcp</screen>
</para><para>Restart <filename moreinfo="none">inetd</filename> with SIGHUP, and point your browser to
<filename moreinfo="none">http://localhost:901</filename>.</para></sect2></sect1><sect1 id="config"><title>Software Configuration </title><para>These are the the configuration files we are going to custimise:
<filename moreinfo="none">/etc/profile</filename> <filename moreinfo="none">/etc/bashrc</filename>
<filename moreinfo="none">.bashrc</filename> <filename moreinfo="none">.bashrc .bash_profile .bash_logout
.inputrc .less .lessrc .xinitrc </filename> <filename moreinfo="none">.fvwmrc .fvwm2rc95
.Xmodmap .Xmodmap.num .Xdefaults .jedrc </filename> <filename moreinfo="none">.abbrevs.sl
.joerc .emacs </filename>. Don't add users until you have completed your
system configuration; you'll put the dot files in
<filename moreinfo="none">/etc/skel</filename>.</para><sect2><title>bash (1)</title><para>Arguably, the most important piece of software after the kernel. To tailor
the behaviour of <filename moreinfo="none">bash</filename>, these are the main files to edit:</para><para>
<itemizedlist><listitem><para> <filename moreinfo="none">/etc/bashrc</filename> contains system wide aliases and
 functions;
</para></listitem><listitem><para> <filename moreinfo="none">/etc/profile</filename> contains system wide environment stuff
 and startup programs;
</para></listitem><listitem><para> <filename moreinfo="none">entHOME/.bashrc</filename> contains user aliases and functions;
</para></listitem><listitem><para> <filename moreinfo="none">entHOME/.bash_profile</filename> contains user environment 
stuff and startup programs;
</para></listitem><listitem><para> <filename moreinfo="none">entHOME/.inputrc</filename> contains key bindings and other
 bits.
</para></listitem></itemizedlist>
</para><para>Examples of these files are shown below. First, the most important:
<filename moreinfo="none">/etc/profile</filename>. 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!</para><para>
<programlisting format="linespecific"># /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="ent "

# 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</programlisting>
</para><para>This is a sample <filename moreinfo="none">/etc/bashrc</filename>:</para><para>
<programlisting format="linespecific"># /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 2ent /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
}</programlisting>
</para><para>This is a sample <filename moreinfo="none">.bashrc</filename>:</para><para>
<programlisting format="linespecific"># $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 ent
}</programlisting>
</para><para>This is a sample <filename moreinfo="none">.bash_profile</filename>:</para><para>
<programlisting format="linespecific"># $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"</programlisting>
</para><para>This is a sample <filename moreinfo="none">.inputrc</filename>:</para><para>
<programlisting format="linespecific"># $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</programlisting>
</para><para>To make the backspace and delete keys work correctly in
<filename moreinfo="none">xterm</filename> and other X11 applications, the following is also
needed:</para><para>
<itemizedlist><listitem><para> put this in your <filename moreinfo="none">.xinitrc</filename>:


<screen format="linespecific">usermodmap=$HOME/.Xmodmap
xmodmap $usermodmap</screen>

</para></listitem><listitem><para> then your <filename moreinfo="none">.Xmodmap</filename> will contain:


<screen format="linespecific">keycode 22 = BackSpace
keycode 107 = Delete</screen>


this fixes the console. To fix <filename moreinfo="none">xterm</filename>:
</para></listitem><listitem><para> put this in your <filename moreinfo="none">.Xdefaults</filename>:


<screen format="linespecific">xterm*VT100.Translations: #override entKeyentBackSpace: string(0x7F)\n\
        entKeyentDelete:        string(0x1b) string("[3~")\n\
        entKeyentHome:          string(0x1b) string("[1~")\n\
        entKeyentEnd:           string(0x1b) string("[4~")\n\
        CtrlentKeyentPrior:     string(0x1b) string("[40~")\n\
        CtrlentKeyentNext:      string(0x1b) string("[41~")

nxterm*VT100.Translations: #override entKeyentBackSpace: string(0x7F)\n\
        entKeyentDelete:        string(0x1b) string("[3~")\n\
        entKeyentHome:          string(0x1b) string("[1~")\n\
        entKeyentEnd:           string(0x1b) string("[4~")\n\
        CtrlentKeyentPrior:     string(0x1b) string("[40~")\n\
        CtrlentKeyentNext:      string(0x1b) string("[41~")</screen>

</para></listitem></itemizedlist>
</para><para><filename moreinfo="none">rxvt</filename> is a wee bit more complicated, as some
compile--time options influence its behaviour. See the above
<filename moreinfo="none">/etc/profile</filename>.</para><para>More info in <filename moreinfo="none">bash</filename> (1) and
<filename moreinfo="none">readline</filename> (3) man pages.</para><para>Don't expect every application to work correctly! If you run
<filename moreinfo="none">joe</filename> in <filename moreinfo="none">xterm</filename>, for instance, some
keys won't work; the same holds for some versions of
<filename moreinfo="none">rxvt</filename>.</para></sect2><sect2><title>I18n</title><para>(This section doesn't apply to native English speakers.)</para><para>A.k.a. ``internationalisation''. Gasp. This long word means ``to adapt Linux
to your local conventions: language, format of date, currency etc.''.</para><para>Although Red Hat has its own method for setting up i18n
(<filename moreinfo="none">/etc/sysconfig/i18n</filename>), you may want to enable your
language only in some cases. I, for one, enabled i18n in
<filename moreinfo="none">kdm</filename> (via <filename moreinfo="none">kdmconfig</filename>) and
<filename moreinfo="none">xfce</filename>, but want to read English messages when I work in
console or xterm.</para><para>Consider these lines:</para><para>
<screen format="linespecific">LANG=it # choose your language: fr, de, es, ...
LANGUAGE=it
LC_ALL=it
export LANG LANGUAGE LC_ALL</screen>
</para><para>If you insert them in your <filename moreinfo="none">.xinitrc</filename> or
<filename moreinfo="none">.xsession</filename> 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
<filename moreinfo="none">.bash_profile</filename>.</para></sect2><sect2><title>ls (1)</title><para><filename moreinfo="none">ls</filename> can display directory listings using colours to
highlight different file types. To enable this feature, you just need a
couple of lines in <filename moreinfo="none">/etc/profile</filename> as seen above. However,
this won't work with old versions of <filename moreinfo="none">rxvt</filename>; use some
flavour of <filename moreinfo="none">xterm</filename> instead. It looks like some old
<filename moreinfo="none">rxvt</filename>s have a bug that prevents them from inheriting the
environment correctly in some circumstances.</para></sect2><sect2><title>less (1)</title><para>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:</para><para>
<itemizedlist><listitem><para> to use it with the movement keys, have this plain ASCII 
file <filename moreinfo="none">.lesskey</filename> in your home directory:

 


<screen format="linespecific">^[[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</screen>


then run the command <filename moreinfo="none">lesskey</filename>. (These are escape
sequences for vt100-like terminals.) This creates a binary file
<filename moreinfo="none">.less</filename> containing the key bindings.

</para></listitem><listitem><para> write the following file as <filename moreinfo="none">/usr/bin/lesspipe.sh</filename>:


<programlisting format="linespecific">#!/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 2ent/dev/null ;; # View contents of .tar and .tgz files
  *.tgz|*.tar.gz|*.tar.Z|*.tar.z) tar ztf $1 2ent/dev/null ;;
  *.Z|*.z|*.gz) gzip -dc $1  2ent/dev/null ;; # View compressed files correctly
  *.tar.bz2) bzip2 -dc $1 | tar tf - ;;
  *.bz2) bzip2 -dc $1  2ent/dev/null ;;
  *.zip) unzip -l $1 2ent/dev/null ;; # View archives
  *.arj) unarj -l $1 2ent/dev/null ;;
  *.rpm) rpm -qpil $1 2ent/dev/null ;;
  *.cpio) cpio --list -F $1 2ent/dev/null ;;
  *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.l|*.man) 
    file $1 | grep roff ent /dev/null
    if [ $? = 0 ]; then
      groff -Tascii -mandoc $1
    fi ;;
  *) file $1 | grep "te[sx]t" ent /dev/null ;
    if [ $? = 1 ] ; then # it's not some kind of text
      strings $1
    fi ;;
  esac
}

# treat link targets, not links themselves
file $1 | grep symbolic ent /dev/null
if [ $? = 0 ]; then
  TARGET=$(file $1 | awk '{print $NF}')
  lesspipe $TARGET
else
  lesspipe $1
fi</programlisting>

then make it executable with <filename moreinfo="none">chmod 755 lesspipe.sh</filename>.
</para></listitem><listitem><para> put the variables that affect <filename moreinfo="none">less</filename> in
<filename moreinfo="none">/etc/profile</filename> as seen above.
</para></listitem></itemizedlist>
</para></sect2><sect2><title>Editor</title><para>Only the most popular will be covered here.</para><sect3><title>emacs (1)</title><para>I rarely use <filename moreinfo="none">emacs</filename>, so I have only a couple of tips for
you. Some <filename moreinfo="none">emacs</filename> distributions don't come preconfigured
for colours and syntax highlighting. Put this in your
<filename moreinfo="none">.emacs</filename>:</para><para>
<screen format="linespecific">(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)</screen>
</para><para>This only works in X11. Moreover, to enable accented characters you'll add
this line:</para><para>
<screen format="linespecific">(standard-display-european 1)</screen>
</para><para>I'll leave it to you to peruse all of <filename moreinfo="none">emacs</filename>'
documentation to find out how to tailor it to your needs---potentially, it
can take months of hacking.  The Dotfile generator (Section <xref linkend="config-sw"></xref>) is a good helping hand.</para></sect3><sect3><title>joe (1)</title><para>  (Why use <filename moreinfo="none">joe</filename> when <filename moreinfo="none">jed</filename> is so
  small and powerful? Duh.)</para><para>Some versions of <filename moreinfo="none">joe</filename> 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:</para><para>
<screen format="linespecific">~$ export TERM=vt100
~$ joe myfile
   (edit your file)
~$ export TERM=linux</screen>
</para><para>To make the special keys work, all you have to do is edit
<filename moreinfo="none">.joerc</filename>, <filename moreinfo="none">.jstarrc</filename> or your favourite
emulation; you can start from the system-wide config files in
<filename moreinfo="none">/usr/lib/joe</filename>. Look for the fourth section (key
bindings). This enables Home and End:</para><para>
<screen format="linespecific">bol ^[ [ 1 ~    Go to beginning of line
eol ^[ [ 4 ~    Go to end of line</screen>
</para><para>Find out the desired ESC sequences typing <filename moreinfo="none">cat</filename> followed
by the special keys.</para></sect3><sect3 id="jed"><title>jed (1) </title><para>This is my favourite editor: it does what I need, it's lighter and easier to
configure than <filename moreinfo="none">emacs</filename>, and emulates other editors quite
well. Many users at my university use <filename moreinfo="none">jed</filename> to emulate
<filename moreinfo="none">EDT</filename>, VMS' system editor.</para><para><filename moreinfo="none">jed</filename>'s configuration files are
<filename moreinfo="none">.jedrc</filename> and <filename moreinfo="none">/usr/lib/jed/lib/*</filename>; the
former can be adapted from <filename moreinfo="none">jed.rc</filename> in the latter
directory.</para><para>
<itemizedlist><listitem><para> if <filename moreinfo="none">xjed</filename> apparently doesn't recognise the DEL key, add
 or comment out these lines in your <filename moreinfo="none">.jedrc</filename>:

<screen format="linespecific">#ifdef XWINDOWS
  x_set_keysym (0xFFFF, 0, "\e[3~");
  setkey (``delete_char_cmd'', "\e[3~");
#endif</screen>
</para></listitem><listitem><para> to make <filename moreinfo="none">jed</filename> emulate <filename moreinfo="none">EDT</filename> (or other
editors) all you have to do is edit a couple of lines in
<filename moreinfo="none">.jedrc</filename>. If you want the numeric keypad
`<filename moreinfo="none">+</filename>' to delete words instead of a single character, add
this in <filename moreinfo="none">.jedrc</filename>:

<screen format="linespecific">unsetkey("\eOl");
unsetkey("\eOP\eOl");
setkey("edt_wdel", "\eOl");
setkey("edt_uwdel", "\eOP\eOl");</screen>

after the line that reads <filename moreinfo="none">() = evalfile("edt")</filename> (or
similar);
</para></listitem><listitem><para> to make <filename moreinfo="none">xjed</filename> use the numeric keypad for
 <filename moreinfo="none">EDT</filename> emulation, insert the following in
 <filename moreinfo="none">.Xmodmap</filename>:


<screen format="linespecific">keycode 77  = KP_F1
keycode 112 = KP_F2
keycode 63  = KP_F3
keycode 82  = KP_F4
keycode 86  = KP_Separator</screen>

</para></listitem><listitem><para> colour customization for <filename moreinfo="none">xjed</filename> is done adding lines
 like these in <filename moreinfo="none">.Xdefaults</filename>:


<screen format="linespecific">xjed*Geometry: 80x32+150+50
xjed*font: 10x20
xjed*background: midnight blue
# and so on...</screen>

</para></listitem><listitem><para> the ``abbreviation'' feature is an invaluable timesaver. Write a file like
the following as <filename moreinfo="none">entHOME/.abbrevs.sl</filename> (you can
change this name by inserting <filename moreinfo="none">variable Abbrev_File =
"/usr/lib/jed/abbrev.sl";</filename> in <filename moreinfo="none">.jedrc</filename>):


<screen format="linespecific">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...</screen>


and type <filename moreinfo="none">ESC x abbrev_mode</filename> to enable it. To enable the
abbreviation by default, add entries like these to your
<filename moreinfo="none">.jedrc</filename>:


<screen format="linespecific">define text_mode_hook ()
{
  set_abbrev_mode (1);
}
%
define fortran_hook ()
{
  set_abbrev_mode (1);
  use_abbrev_table ("Fortran");
}
% and so on...</screen>
</para></listitem></itemizedlist>
</para></sect3></sect2><sect2><title>pine (1)</title><para>Edit the global configuration in <filename moreinfo="none">/usr/lib/pine.conf</filename>,
taking care at least of the following fields:
<filename moreinfo="none">user-domain</filename>, <filename moreinfo="none">smtp-server</filename>, and
<filename moreinfo="none">nntp-server</filename>. Note that <filename moreinfo="none">inbox-path</filename>
depends on your MTA: if you use <filename moreinfo="none">sendmail</filename> or
<filename moreinfo="none">postfix</filename>, that'll be
<filename moreinfo="none">var/spool/mail/$USER</filename>; with Qmail,
<filename moreinfo="none">/home/$USER/Mailbox</filename> (but root will use
<filename moreinfo="none">/var/qmail/alias/Mailbox</filename>.</para></sect2><sect2><title>minicom (1)</title><para>Users can't use <filename moreinfo="none">minicom</filename> unless a global configuration
has been made by root. Remember to make it.</para></sect2><sect2><title>efax (1)</title><para>This package is probably the most convenient for simple sending/receiving of
faxes. You'll have to tailor the script <filename moreinfo="none">/usr/bin/fax</filename> or
(mandrake) <filename moreinfo="none">/etc/fax.config</filename>; easy job, but a couple of
quirks caused me quite a headache:</para><para>
<itemizedlist><listitem><para> to find out whether your modem is class 1, 2, or 2.0, use minicom or
similar program to issue the command <filename moreinfo="none">at+fclass=?</filename>. The
reply may be like <filename moreinfo="none">0,1,2</filename>; 1 and 2 are the classes
supported by your modem;
</para></listitem><listitem><para> DIALPREFIX: chances are that simply putting `<filename moreinfo="none">T</filename>' or 
`<filename moreinfo="none">P</filename>' won't work in some countries-in Italy, at least. Put
`<filename moreinfo="none">ATDT</filename>' or `<filename moreinfo="none">ATDP</filename>' instead;
</para></listitem><listitem><para> INIT and RESET: these strings contain the initialisers
 `<filename moreinfo="none">-i</filename>' and `<filename moreinfo="none">-k</filename>', needed by
 <filename moreinfo="none">efax</filename>. If you want to add an AT command, add it to the
 appropriate string leaving out `<filename moreinfo="none">AT</filename>' and preceding the 
 rest with either `<filename moreinfo="none">-i</filename>' or `<filename moreinfo="none">-k</filename>'.
 Example: to add the `<filename moreinfo="none">ATX3</filename>' command to INIT, you'll
 append `<filename moreinfo="none">-iX3</filename>'.
</para></listitem></itemizedlist>
</para><para>That done, there are a few permissions to fix to enable non-root users to
send and receive faxes. The directories <filename moreinfo="none">/var/lock</filename> and
<filename moreinfo="none">/var/spool/fax</filename> must be writable. To do so, create the
group <filename moreinfo="none">faxusers</filename>, add users to it, then type:</para><para>
<screen format="linespecific">~# 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</screen>
</para><para>As a normal user, you'll issue <filename moreinfo="none">newgrp faxusers</filename> before
sendig a fax.</para></sect2><sect2><title>Ghostscript</title><para>This essential tool suffers from a small snag. Owing to to the well-known
export regulations in the USA, the utility <filename moreinfo="none">pdf2ps</filename>
doesn't work with encrypted .pdf files. Never mind: point your browser to
<ulink url="http://www.ozemail.com.au/~geoffk/pdfencrypt"><citetitle>http://www.ozemail.com.au/~geoffk/pdfencrypt</citetitle></ulink>, download
the file <filename moreinfo="none">pdf_sec.ps</filename> and replace the file with the same
name that comes with the Ghostscript distribution.</para></sect2><sect2><title>TeX and Friends</title><para>The ``root'' of a TeX system is the directory entTEXMF, which is
<filename moreinfo="none">/usr/share/texmf</filename> in teTeX; other distributions may
differ (search for ``texmf'' on your system). You normally add stuff or
fiddle with files therein.</para><sect3><title>Expanding entTEXINPUTS</title><para>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 <filename moreinfo="none">.bash_profile</filename>:</para><para>
<screen format="linespecific">export TEXINPUTS="$HOME/mylib::./figures"</screen>
</para><para>which makes TeX search in <filename moreinfo="none">$HOME/mylib</filename>
<emphasis>before</emphasis> the default directories, and the directory
<filename moreinfo="none">./figures</filename> <emphasis>afterwards</emphasis>.</para></sect3><sect3><title>Hyphen Patterns</title><para>To configure the hyphenation pattern for your language, edit the file
<filename moreinfo="none">entTEXMF/tex/generic/config/language.dat</filename>, then do:</para><para>
<screen format="linespecific">~# texconfig init ; texconfig hyphen</screen>
</para><para>Even if you don't write in English, don't remove the entry ``english''; TeX
pukes without it.</para></sect3><sect3><title>dvips (1)</title><para>To tailor <filename moreinfo="none">dvips</filename>, the file to edit is
<filename moreinfo="none">entTEXMF/dvips/config/config.ps</filename>. Be aware that the
fields regarding the default resolution also affect
<filename moreinfo="none">xdvi</filename>'s behaviour; if you experience annoying attempts
to create fonts each time you run it, put the line</para><para>
<screen format="linespecific">XDvi*mfmode:</screen>
</para><para>in your <filename moreinfo="none">.Xdefault</filename>. This should help.</para></sect3><sect3><title>Adding LaTeX Packages</title><para>Additional LaTeX packages are available from your nearest CTAN
(Comprehensive TeX Archive Network) mirror site, e.g. <ulink url="ftp://ftp.dante.de/pub/tex"><citetitle>ftp://ftp.dante.de/pub/tex</citetitle></ulink>. Unpack the package under
<filename moreinfo="none">entTEXMF/tex/latex</filename>.</para><para>If no .sty file exist, run the command <filename moreinfo="none">latex
newstyle.ins</filename> or <filename moreinfo="none">latex newstyle.dtx</filename> to create
it, then run the command <filename moreinfo="none">texhash</filename> so that teTeX
recognises the new package.</para></sect3></sect2><sect2 id="docbook"><title>Docbook</title><para>  LaTeX is the best choice for typesetting, Docbook for multiformat
  documents (This HOWTO is written in Docbook.) Once you get all of the
  tools in place, you'll want to use simple scripts to avoid the complex
  command line. If these are not provided with the distribution, use the
  following <filename moreinfo="none">db2pdf</filename> as template:</para><programlisting format="linespecific">#!/bin/sh

if [ $# = 0 ]; then
  echo "Usage: db2pdf entfile.sgmlent [file2.sgml ...]"
  exit 1
fi

# Standard Mandrake location:
DSSSL=/usr/share/sgml/docbook/dsssl-stylesheets-1.57/print/docbook.dsl
# Standard RedHat location:
# /usr/lib/sgml/stylesheets/nwalsh-modular/print/docbook.dsl

if [ ! -f $DSSSL ]; then
  DSSSL=$(find /usr/ -name "docbook.dsl" | grep print)
fi

for FILE in $*
do
  NAME=$(echo $FILE | awk -F'.' '{print $1}')
  echo "Processing $FILE..."
  jade -t tex -d $DSSSL $NAME.sgml
  pdfjadetex $NAME.tex
done

# End of db2pdf</programlisting><para>  If you find that your PostScript od .PDF looks very bad, the file to hack
  is <filename moreinfo="none">dbparams.dsl</filename>. In my Mandrake system, it's located
  in <filename moreinfo="none" id="directory">  /usr/share/sgml/docbook/dsssl-stylesheets-1.57/print/</filename>.</para></sect2><sect2><title>Avoid PPProblems!</title><para>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
<filename moreinfo="none">pppd</filename> package correctly installed and, if you will, set
uid root. Obviously, your ISP must support PPP.</para><para>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:</para><para>
<itemizedlist><listitem><para> your ISP's telephone number;
</para></listitem><listitem><para> your ISP's name, mail and news server address;
</para></listitem><listitem><para> your ISP's domain;
</para></listitem><listitem><para> your username and password.
</para></listitem></itemizedlist>
</para><para>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.</para><para>Gnome and KDE include, respectively, <filename moreinfo="none">gnome-ppp</filename> and
<filename moreinfo="none">kppp</filename> which are easy enough to set up. Alternatively, I
suggest that you have a look at a couple of tty--based tools,
<filename moreinfo="none">wvdial</filename> and <filename moreinfo="none">eznet</filename>. You feed them
your ISP's phone number, your username, your password, and you're in
business. Their home pages are at <ulink url="http://www.worldvisions.ca/wvdial"><citetitle>http://www.worldvisions.ca/wvdial</citetitle></ulink> and <ulink url="http://www.hwaci.com/sw/eznet"><citetitle>http://www.hwaci.com/sw/eznet</citetitle></ulink>. Both are great, but I
prefer the latter.</para><sect3><title>A Quick Start with eznet</title><para>First of all, create an <filename moreinfo="none">/etc/resolv.conf</filename> like this:</para><para>
<screen format="linespecific">nameserver w.x.y.z</screen>
</para><para>where you'll insert the address of your ISP's nameserver. To create an
account with <filename moreinfo="none">eznet</filename>, issue the following command:</para><para>
<screen format="linespecific">#~ eznet add service=YOUR_ISP user=NAME password=PASSWORD phone=PHONE</screen>
</para><para>which creates the file <filename moreinfo="none">/var/eznet/eznet.conf</filename>, owned by
root.root with permissions 600; chmod it to 666 if you want it to be world
readable. Now dial your ISP with <filename moreinfo="none">eznet up YOUR_ISP</filename>. If
the modem keeps waiting for the dial tone and won't connect, then try this
command:</para><para>
<screen format="linespecific">#~ eznet change YOUR_ISP init0=atx3</screen>
</para><para>To hang up, the command is <filename moreinfo="none">eznet down</filename>. That's all!</para></sect3><sect3><title>A Quick Start with wvdial</title><para><filename moreinfo="none">wvdial</filename>'s setup is even shorter. Type
<filename moreinfo="none">wvdialconf /etc/wvdial.conf</filename>, then edit the resulting
file to include your username, password, and phone number. Try it out with
<filename moreinfo="none">wvdial</filename>, and keep your fingers crossed. To hang up, stop
it with Ctrl-C.</para></sect3></sect2><sect2><title>POP Client</title><para>To retrieve your mail from a POP3 server, you need a POP client. Most such
clients require that you run an MTA like <filename moreinfo="none">sendmail</filename>,
<filename moreinfo="none">qmail</filename> or <filename moreinfo="none">postfix</filename>; 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
<filename moreinfo="none">fetchmail</filename>; the second by <filename moreinfo="none">fetchpop</filename>
or <filename moreinfo="none">frenchie</filename>. Sites: <ulink url="ftp://metalab.unc.edu/pub/Linux/system/mail/pop"><citetitle>ftp://metalab.unc.edu/pub/Linux/system/mail/pop</citetitle></ulink>, <ulink url="http://www.lowcountry.com/~jscottb/tcltk.shtml"><citetitle>http://www.lowcountry.com/~jscottb/tcltk.shtml</citetitle></ulink>.</para><para>To configure these clients:</para><para>
<itemizedlist><listitem><para> <filename moreinfo="none">fetchpop</filename>: the first time you run it, you'll be
 prompted for some information. Answer the questions and you're set.
 <filename moreinfo="none">fetchpop</filename> must be used with the <filename moreinfo="none">-r</filename>
 switch if your ISP's POP3 server doesn't implement the command LAST
 properly. 
</para></listitem><listitem><para> <filename moreinfo="none">frenchie</filename>: as above, edit
<filename moreinfo="none">ent/.frenchie/frenchierc</filename>;
</para></listitem><listitem><para> <filename moreinfo="none">fetchmail</filename>: adapt this sample
 <filename moreinfo="none">.fetchmailrc</filename>:


<screen format="linespecific"># $HOME/.fetchmailrc
poll mbox.myisp.com with protocol pop3;
  user john there with password _Loo%ny is john here </screen>


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 <filename moreinfo="none">chmod
600 .fetchmailrc</filename>, otherwise <filename moreinfo="none">fetchmail</filename> will
rightly refuse to start. This example is very basic; there are endless
possibilities of configuration. Check out at <ulink url="http://www.ccil.org/~esr/fetchmail"><citetitle>http://www.ccil.org/~esr/fetchmail</citetitle></ulink>.
</para></listitem></itemizedlist>
</para></sect2><sect2><title>Basic Mail Filtering</title><para>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 <filename moreinfo="none">.procmailrc</filename> file, while in the
second there are tools for checking the mail prior to fetching it.</para><para>A very simple <filename moreinfo="none">.procmailrc</filename> that defines a few rules:</para><para>
<screen format="linespecific"># $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
* ent 50000
/dev/null</screen>
</para><para><filename moreinfo="none">man procmailex</filename> for further examples.</para><para>POP users will want to use <filename moreinfo="none">poppy</filename>, a useful Perl script
for checking the mail before fetching it. Get it from <ulink url="ftp://metalab.unc.edu/system/mail/pop"><citetitle>ftp://metalab.unc.edu/system/mail/pop</citetitle></ulink>.</para></sect2><sect2><title>X Window System (XFree86)</title><sect3><title>Setting Up the X Server</title><para>  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.
  <filename moreinfo="none">XConfigurator</filename>, <filename moreinfo="none">sax</filename>,
  <filename moreinfo="none">XF86Setup</filename>, or at least
  <filename moreinfo="none">xf86config</filename>). X configuration is virtually automatic
  these days, but a few video cards may cause a headache.</para><para>  First of all, check out at the XFree86 site (<ulink url="http://www.xfree86.org"><citetitle>  ftp://metalab.unc.edu/system/mail/pop</citetitle></ulink>) whether your
  video card is supported. If so, then try this procedure:</para><para>
<itemizedlist><listitem><para>  install the plain VGA server;</para></listitem><listitem><para>  go to <ulink url="ftp://ftp.XFree86.org/pub/XFree86/current/binaries"><citetitle>  ftp://ftp.XFree86.org/pub/XFree86/current/binaries</citetitle></ulink>, cd
  to the proper Linux subdirectory, and download the archives
  <filename moreinfo="none">X_version_bin.tgz</filename>,
  <filename moreinfo="none">X_version_set.tgz</filename>, and all the servers. Amongst other
  programs, the first archive contains the most up-to-date
  <filename moreinfo="none">SuperProbe</filename>;
</para></listitem><listitem><para>  unpack <filename moreinfo="none">X_version_bin.tgz</filename> to a temporary directory, cd
  to it, and run <filename moreinfo="none">./SuperProbe</filename>. If your video card is
  recognised, chances are that you'll be able to set it up. Otherwise, hard
  luck;</para></listitem><listitem><para>  install the servers and <filename moreinfo="none">X_version_set.tgz</filename> from
  <filename moreinfo="none">/usr/X11R6/</filename>, then run <filename moreinfo="none">XF86Setup</filename>.</para></listitem></itemizedlist>
</para><para>  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. <emphasis>Warning</emphasis>: these operations are dangerous and
  your monitor might be damaged!</para><para>  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.
  <emphasis>Quartum non datur.</emphasis></para></sect3><sect3><title>The X Startup Sequence</title><para>  There are two ways to launch X11: from the console via
  <command moreinfo="none">startx</command>, or directly via
  <filename moreinfo="none">/etc/inittab</filename>.</para></sect3><sect3><title>Keypad</title><para>  We have seen above how to make a few special keys work. The sample file 
  <filename moreinfo="none">.Xmodmap</filename> 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 <filename moreinfo="none">.Xmodmap.num</filename>:</para><para>
<screen format="linespecific">! Definitions can be found in entX11/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</screen>
</para><para>  Make sure that your <filename moreinfo="none">/etc/X11/XF86Config</filename> does not
  contain these three lines:</para><para>
<screen format="linespecific">  ServerNumLock
  Xleds
  XkbDisable</screen>
</para><para>  and in case, comment them out. To re-enable the keypad, you'll issue the
  command <filename moreinfo="none">xmodmap .Xmodmap.num</filename>.</para></sect3><sect3><title>Graphical Login with xdm</title><para>  To be greeted by a graphical login, edit the file
  <filename moreinfo="none">/etc/inittab</filename>, which should include a line like this:</para><para>
<screen format="linespecific">x:5:respawn:/usr/bin/X11/xdm -nodaemon # also kdm or gdm</screen>
</para><para>  where 5 is the runlevel corresponding to X11. Modify the line that defines
  the default runlevel (usually 2 or 3), changing it as above:</para><para>
<screen format="linespecific">id:5:initdefault:</screen>
</para><para>  The number of colours is specified in
  <filename moreinfo="none">/etc/X11/xdm/Xserver</filename>:</para><para>
<screen format="linespecific">: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</screen>
</para><para>  If you already have <filename moreinfo="none">.xinitrc</filename>, copy it to
  <filename moreinfo="none">.xsession</filename> and make the latter executable with
  <filename moreinfo="none">chmod +x .xsession</filename>. Now issue the command
  <filename moreinfo="none">telinit 5</filename> and you're in business.</para></sect3><sect3><title>Window Manager</title><para>  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.</para><para>Some examples:</para><para>
<itemizedlist><listitem><para>  <emphasis remap="bf">the fvwm family</emphasis>: copy
  <filename moreinfo="none">/etc/X11/fvwm/system.fvwmrc</filename> (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;</para></listitem><listitem><para>  <emphasis remap="bf">WindowMaker</emphasis>: it has several config files
  that live under <filename moreinfo="none">$HOME/GNUstep</filename>, and a cool
  configuration applet;
</para></listitem><listitem><para> <emphasis remap="bf">KDE</emphasis>, <emphasis remap="bf">Gnome</emphasis>,
 <emphasis remap="bf">xfce</emphasis> and others: nothing to edit manually
 here, everything can be done via the menu.</para></listitem></itemizedlist>
</para><para>  In short: if you don't mind editing config file, choose something like
  <filename moreinfo="none">icewm</filename>, <filename moreinfo="none">fvwm*</filename>,
  <filename moreinfo="none">blackbox</filename> etc; if you do mind, the choice is currently
  restricted to KDE, Gnome, WindowMaker, and Xfce. Email me if I'm wrong.</para><para>  It's important to have a good <filename moreinfo="none">.xinitrc</filename>. An example:</para><para>
<screen format="linespecific">#!/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 ent

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

$WINMGR</screen>
</para><para>  Although it doesn't appear to be strictly required, make it executable
  with <filename moreinfo="none">chmod +x .xinitrc</filename>.</para><para>  The <filename moreinfo="none">.xinitrc</filename> above lets you choose the window
  manager: try 

<screen format="linespecific">$ startx startkde # or other w.m.</screen>
</para></sect3><sect3><title>Defaults for X11 Apps</title><para>  Find out where the <filename moreinfo="none">app-defaults</filename> directory is (it
  should be <filename moreinfo="none">/usr/X11R6/lib/X11/app-defaults</filename>). Several
  apps keep a configuration file there.</para></sect3><sect3><title>Adding Fonts</title><para>  Recent versions of XFree86 (say, ent 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.</para><para>  Suppose that you downloaded a Type 1 font collection, e.g. Freefont
  (<ulink url="ftp://ftp.gimp.org/pub/gimp/fonts/freefonts-0.10.tar.gz">  <citetitle>ftp://ftp.gimp.org/pub/gimp/fonts/freefonts-0.10.tar.gz
  </citetitle></ulink>). To make it visible to the font server, unpack the
  archive from <filename moreinfo="none">/usr/X11R6/lib/X11/fonts/</filename>. Then edit
  <filename moreinfo="none">/etc/X11/fs/config</filename>, add an entry for the new
  directory, and restart the font server.</para><para>  If you're rolling your own font collection, you'll need to supply the
  files <filename moreinfo="none">fonts.dir</filename> and <filename moreinfo="none">fonts.scale</filename>;
  the tool to make them is <filename moreinfo="none">type1inst</filename>, available from
  <ulink url="http://http://goblet.anu.edu.au/~m9305357/type1inst.html"><citetitle>  http://http://goblet.anu.edu.au/~m9305357/type1inst.html
  </citetitle></ulink>.</para><para>  As for the True Type fonts, group them in a directory of your choice and
  create <filename moreinfo="none">fonts.dir</filename> using
  <filename moreinfo="none">ttmkfdirfonts.dir</filename>, included in the Freetype archive;
  <ulink url="http://www.freetype.org"><citetitle>http://www.freetype.org
  </citetitle></ulink>. Then proceed as above. For example, if you want to
  use the Windows fonts you have in, say,
  <filename moreinfo="none">/mnt/win/windows/fonts</filename>, go to that directory, run
  <filename moreinfo="none">ttmkfdir</filename>, edit
  <filename moreinfo="none">/etc/X11/fs/config</filename> and restart the font server.</para><para>  It all started from the original True Type X font server: <ulink url="http://http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/">  <citetitle>http://http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/
  </citetitle></ulink>.
</para></sect3></sect2><sect2><title>Users' Configurations</title><para>  When you're done editing the dot files, copy them to
  <filename moreinfo="none">/etc/skel</filename> as seen in Section <xref linkend="config"></xref>.</para></sect2><sect2><title>Making .rpms</title><para>  <filename moreinfo="none">rpm</filename> 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 <filename moreinfo="none">gcc</filename> versions, it
  may be advisable to put this in your <filename moreinfo="none">/etc/rpmrc</filename>:</para><para>
<screen format="linespecific">optflags: i386 -O2 -mpentiumpro</screen>
</para></sect2><sect2><title>Upgrading</title><para>  If you upgrade your machine, do your backup as usual and remember to save
  a few additional files. Some could be
  <filename moreinfo="none">/etc/X11/XF86Config</filename>,
  <filename moreinfo="none">/usr/bin/fax</filename>, all the stuff in
  <filename moreinfo="none">/usr/local</filename>, the kernel configuration, the whole
  <filename moreinfo="none">/etc</filename>, and all the mail in
  <filename moreinfo="none">/var/spool/mail</filename>.</para><para>  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.</para></sect2></sect1><sect1 id="config-sw"><title>Configuration Software + Docs </title><para>  There are several programs that make Linux easy to setup and configure.
  Some are becoming sort of standard: Red Hat, Caldera and other
  distributions ship with apps like <filename moreinfo="none">setup</filename>,
  <filename moreinfo="none">printtool</filename>, <filename moreinfo="none">netcfg</filename>,
  <filename moreinfo="none">usertool</filename>, etc, while S.u.S.E. ships with a
  comprehensive configuration program called Yast. Other useful programs
  are:</para><para>
<itemizedlist><listitem><para>  <emphasis remap="bf">The Dotfile Generator</emphasis>: fine X app with
  modules to configure packages like <filename moreinfo="none">emacs</filename>,
  <filename moreinfo="none">bash</filename>, <filename moreinfo="none">procmail</filename> and more. Its
  page is at <ulink url="http://www.imada.ou.dk/~blackie/dotfile"><citetitle>  http://www.imada.ou.dk/~blackie/dotfile</citetitle></ulink>;</para></listitem><listitem><para>  <emphasis remap="bf">Linuxconf</emphasis>: the ultimate configuration
  tool. It can do everything, both in console and under X. Go to <ulink url="http://www.solucorp.qc.ca/linuxconf"><citetitle>  http://www.solucorp.qc.ca/linuxconf</citetitle></ulink> at once.
</para></listitem></itemizedlist>
</para><para>  Documents on Linux configuration are popping up everywhere. One of the
  most complete is TrinityOS, <ulink url="http://www.ecst.csuchico.edu/~dranch/LINUX/index-linux.html">  <citetitle> http://www.ecst.csuchico.edu/~dranch/LINUX/index-linux.html
  </citetitle></ulink>. Bug the author to have him turn the document in
  nicer formats.</para><para>  A jolly good page is <ulink url="http://dotfiles.com"><citetitle>  http://dotfiles.com</citetitle></ulink>. Just what it says - a collection
  of configuration files.</para></sect1><sect1 id="the-end"><title>The End </title><sect2><title>Copyright</title><para>  Copyright (c) by Guido Gonzato, <filename moreinfo="none">ggonza at tin.it</filename>.
  This document may be distributed only subject to the terms and conditions
  set forth in the LDP License at <ulink url="http://www.linuxdoc.org/COPYRIGHT.html"><citetitle>  http://www.linuxdoc.org/COPYRIGHT.html</citetitle></ulink>, except that
  this document must not be distributed in modified form without the
  author's consent.</para><para>  If you have questions, please refer to the Linux Documentation Project
  home page, <ulink url="http://www.linuxdoc.org"><citetitle>  http://www.linuxdoc.org</citetitle></ulink>.</para></sect2><sect2><title>Feedback</title><para>  Perhaps even more than other HOWTOs, this one needs and welcomes your
  suggestions, criticisms, and contributions. Not only is feedback welcome:
  it's necessary. If you think something is missing or wrong, please email
  me. If you have a distribution other than Red Hat/Mandrake and your config
  files are different or placed in other directories, please tell me and
  I'll include your tips. My aim is making life with Linux as easy as
  possible.</para><para>  Linux has a huge number of packages, so it's impossible to include
  directions for all of them. Please keep your requests/suggestions
  pertinent to the ``most reasonable'' programs---I'll leave it to your
  common sense.</para></sect2><sect2><title>Disclaimer</title><para>  This document is provided ``as is''. I put great effort into writing it as
  accurately as I could, but you use the information contained in it at your
  own risk. In no event shall I be liable for any damages resulting from the
  use of this work.</para><para>  Many thanks to all other HOWTO authors and man pages writers/maintainers,
  whose work I've shamelessly pilfered; and to all people who provided me
  with feedback.</para><para>  I hope you'll find this work useful, though. Whenever I install a new
  Linux box, I actually do...</para><para>  Enjoy,</para><para>  Guido <filename moreinfo="none">=8-)</filename></para></sect2></sect1></article>

