Configuration HOWTO <author>By Guido Gonzato, <url url="guido ``at'' ibogeo.df.unibo.it"> <date>v1.3.7, 6 September 1999 <abstract> This HOWTO aims at making the fine--tuning of your newly installed Linux box quicker and easier. Here you will find a set of configurations for the most common applications and services. </abstract> <toc> <sect> Introduction <label id="Introduction"> <p> <sect1> Why This HOWTO <p> I have installed Linux on many PCs and noted that current distributions are terrific but, annoyingly, lack some basic configuration. Most applications will work out of the box, but others won't. Moreover, I have noted 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. A few of the examples outlined in this HOWTO depend somehow on the distribution. Currently, I only have access to Red Hat 5.2 machines, kernel 2.0.36; so don't take any of my tips as gospel if you have other distributions. It shouldn't be hard to adapt my tips to other distros, though. This HOWTO can't, and is not meant to, replace others. 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. <url url="news:comp.os.linux.setup">. <em>Please</em>, don't seek help from me because I'm quite overloaded. The official place for this document, including some translations, is available at <url url="http://metalab.unc.edu/mdw/HOWTO">. Here you will also find all other HOWTOs I refer to. The very latest version is available at <url url="http://ibogeo.df.unibo.it/guido/Configuration">. <sect1> What We Will Be Configuring <p> 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. 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. And now, lads, sleeves up. <sect> General System Setup <p> <sect1> A Few Words About Security <p> 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. Security is a vast subject that goes beyond the scope of this HOWTO; two good starting points are the Linux Security Administrator's Guide at <url url="http://www.seifried.org/lasg"> and the Linux Security Guide at <url url="http://nic.com/~dave/Security">. You should consider at least the following steps: using shadow passwords (Shadow Password HOWTO), restricting network access to the machine (Section <ref id="Restricting" name="Restricting Network Access">), using the Secure Shell (<url url="http://www.cs.hut.fi/ssh/">) or the Secure Remote Password (<url url="http://srp.stanford.edu/srp/">). Good luck. <sect1> Start the Logbook! <p> To keep your installation in shape, it's <em>essential</em> 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 <em>every</em> 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 pristine installation. 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! <sect1> Keyboard <p> If you missed this step during installation or have changed your keyboard, you'll have to: <itemize> <item> find a suitable key table starting from <file>/usr/lib/kbd/keymaps/</file>; for example, <tt/it.map/ selects the Italian keyboard; <item> edit the file <file>/etc/sysconfig/keyboard</file> so as it reads: <tt>KEYTABLE="it"</tt>; <item> to set up the keyboard repeat rate and delay time, add this line to <file>/etc/rc.d/rc.sysinit</file> (Red Hat) or <file>/etc/rc.d/rc.boot</file> (Caldera) or <file>/etc/rc.d/boot</file> (S.u.S.E.): <tscreen><verb> /sbin/kbdrate -s -r 16 -d 500 # or whatever you like </verb></tscreen> </itemize> To load the key table, issue <file>/etc/rc.d/init.d/keytable start</file>. Other special keys will be considered in the following sections. To enable NumLock on by default, add these lines to <file>/etc/rc.d/rc.sysinit</file>: <tscreen><verb> for tty in /dev/tty[1-9]*; do setleds -D +num < $tty done </verb></tscreen> <sect1> Boot and Rescue Floppy <p> Make a couple of boot floppies for your newly installed system. Your distribution may include a command for creating such a floppy; if not, these commands will do: <tscreen><verb> #~ dd if=/boot/vmlinuz-2.0.36-0.7 of=/dev/fd0 # use your kernel image #~ rdev /dev/fd0 /dev/hda2 # your Linux partition </verb></tscreen> Also, have at least a couple of rescue disks ready. There's a wide choice of rescue disks at <url url="ftp://metalab.unc.edu/pub/Linux/system/recovery">; if you don't know which one to choose, I suggest you try out Tomsbtrt. <sect1> Kernel Matters <p> 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 <tt/README/ file in <file>/usr/src/linux/</file> or the Kernel HOWTO. Hints: <itemize> <item> 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; <item> if your PC is based on a Cyrix CPU that is not properly recognised as such by the kernel, apply appropriate patches to improve its performance. Information on <url url="http://www.linuxhq.com/patch/20-p0591.html">; <item> notebook users will want to improve their LCD screen legibility. I once suggested that a kernel patch should be applied, but <tt>SVGATextMode</tt> (see Section <ref id="SVGA" name="SVGATextMode">) is probably the best solution. Anyway, the Big Cursor kernel patch is on <url url="http://www.linuxhq.com/patch/20-p0239.html">; <item> again for notebook users, if you plan to use a PCMCIA modem/fax <em/don't/ compile serial support as a module; compile it in the kernel, otherwise your PCMCIA modem won't work; <item> if you use PCMCIA cards, remember to compile those modules as well; also, don't forget to edit <file>/etc/pcmcia/network.opts</file> if you use a PCMCIA network card; <item> if you get those pesky messages from <tt>modprobe</tt> indicating that some modules can't be located, that means that your <file>/etc/conf.modules</file> needs mending. For instance, if you don't use the ipx and appletalk modules, add these lines: <tscreen><verb> alias net-pf-4 off alias net-pf-5 off </verb></tscreen> <item> 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. Beware: if you upgrade your kernel this config file is bound to be useless, because it doesn't contain the features of the new kernel. </itemize> <sect1> Sendmail Lock <p> On some systems, <tt/sendmail</tt> hangs the machine for a couple of minutes at boot time. There are two cases: 1) the machine is not directly connected to the Internet, 2) the machine is connected, and has a permanent IP address. Quick fix for the first case: make sure your <file>/etc/hosts</file> contains a line that reads <tscreen><verb> 127.0.0.1 localhost </verb></tscreen> For the second case: the lock is caused by <file>/etc/hosts</file> containing a line like <tscreen><verb> 127.0.0.1 localhost your_host_name </verb></tscreen> which you will split this way: <tscreen><verb> 127.0.0.1 localhost w.x.y.z your_host_name </verb></tscreen> See also Section <ref id="Hostname" name="Hostname">. <sect1> Hard Disk Performance <p> Your (E)IDE hard disk's performance can be greatly enhanced by <em>carefully</em> using <tt>hdparm</tt>(8). If your Linux distribution doesn't include it, you'll find on <url url="ftp://metalab.unc.edu/pub/Linux/system/hardware">; look for a file called <file>hdparm-X.Y.tar.gz</file>. 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 <em>read the man page carefully</em> before using some of the options. At its simplest, you could add the following line to <file>/etc/rc.d/rc.sysinit</file>: <tscreen><verb> /sbin/hdparm -c1 /dev/hda # first IDE drive assumed </verb></tscreen> which enables (E)IDE 32-bit I/O support. As for the `<tt>-m</tt>' option, this is what <tt>hdparm</tt> author Mark Lord emailed me: <quote> (...) if your system uses components from the past couple of years [< 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> For recent machines, these settings should work fine: <tscreen><verb> /sbin/hdparm -c1 -A1 -m16 -d1 /dev/hda </verb></tscreen> <sect1> Parallel Port Zip Drive <p> To use the parallel port version of the Zip drive you can use the default driver that comes with recent (2.x.x) kernels. During kernel configuration, 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 will want to use kernel modules. There's an alternative <tt/ppa/ driver at <url url="http://www.torque.net/~campbell">. Zip disks are sold preformatted on partition <file>/dev/sda4</file>. To enable the Zip, append this to <file>/etc/rc.d/rc.sysinit</file>: <tscreen><verb> # Enable the Zip drive /sbin/modprobe ppa </verb></tscreen> Zip disks can be mounted via <file>/etc/fstab</file> as shown below, or via Mtools adding this line to your <file>/etc/mtools.conf</file>: <tscreen><verb> drive z: file="/dev/sda4" exclusive </verb></tscreen> besides, the command <tt>mzip</tt> allows you to eject, query the status, write and password protect Zip disks; <tt>man mzip</tt> for details. The Mtools home page is at <url url="http://linux.wauug.org/pub/knaff/mtools">. <sect1> Device Drivers <p> Devices in <tt>/dev</tt> (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: <tscreen><verb> ~# cd /dev /dev# ln -s ttyS0 mouse; ln -s ttyS1 modem; ln -s hdb cdrom; ln -s sda4 zip </verb></tscreen> In most notebooks the mouse device is <file>/dev/psaux</file>: take this into account when configuring X11. If you want, do <tt>chmod 666</tt> to these devices to make them fully accessible by every user. <!-- Security problems ahead! Alternatively, create the ``cdrom'' group, make <tt>/dev/cdrom</tt> owned by <tt>root.cdrom</tt>, then add users to this group. A similar procedure applies to other devices. --> <sect1> Sound Card <p> All I own is an old Sound Blaster 16; even if you've got something different, you may take what follows as guidelines. I compiled the sound card support as a module (<tt>sb.o</tt>). Then I put this in <file>/etc/conf.modules</file>: <tscreen><verb> options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330 alias sound sb </verb></tscreen> To enable the sound, make sure that <tt>modprobe sound</tt> is invoked in <file>/etc/rc.d/rc.sysinit</file>. Alternatively, get the tool <tt>sndconfig</tt> from the RedHat site. <sect1> Login Messages <p> If you wish to customise the login messages, check whether your <file>/etc/rc.d/rc.local</file> overwrites <file>/etc/issue</file> and <file>/etc/motd</file>. (RedHat does.) If so, get on with your editor. If you'd like a colourised login message, you may adapt your <tt>rc.local</tt> inserting lines like these: <tscreen><verb> # 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" > /etc/issue echo "$CLEAR" >> /etc/issue echo "$BLUE Welcome to MyServer (192.168.1.1) " >> /etc/issue echo "$NORMAL " >> /etc/issue echo "" >> /etc/issue </verb></tscreen> <sect1> Hostname <label id="Hostname"> <p> Issuing the command <tt>hostname new_host_name</tt> may not be enough. To avoid the dreaded <tt>sendmail</tt> lock, follow these steps (only valid for a stand--alone machine): <itemize> <item> edit <file>/etc/sysconfig/network</file> and change the hostname therein (e.g. <tt>new_host_name.localdomain</tt>); <item> edit <file>/etc/HOSTNAME</file> appropriately; <item> append the new hostname in the line in <file>/etc/hosts</file>: <tscreen><verb> 127.0.0.1 localhost new_host_name.locadomain </verb></tscreen> </itemize> <sect1> Mouse <p> <tt/gpm/ mouse services are useful to perform cut and paste in tty mode, and to use the mouse in some applications. For Red Hat, check that you have a file called <file>/etc/sysconfig/mouse</file> and that it reads: <tscreen><verb> MOUSETYPE="Microsoft" XEMU3=yes </verb></tscreen> Moreover, you must have a file <file>/etc/rc.d/init.d/gpm</file>, where you'll put additional command line parameters. Mine reads: <tscreen><verb> ... daemon gpm -t $MOUSETYPE -d 2 -a 5 -B 132 # two-button mouse ... </verb></tscreen> Obviously, make sure this configuration is right for your mouse type. In most notebooks, <tt/MOUSETYPE/ is ``<tt>PS/2</tt>''. For Caldera, all you have to do is append this line to <file>/etc/rc.d/rc.boot</file>: <tscreen><verb> /usr/bin/gpm </verb></tscreen> On S.u.S.E., <tt>gpm</tt> options go in <file>/etc/rc.config</file>; on Debian, you'll edit <file>/etc/gpm.conf</file>. If you like to use menus in console with Ctrl-button, then configure <tt>gpm-root</tt>. Edit the default menu in <file>/etc/gpm-root.conf</file>, then launch <tt>gpm-root</tt> from <file>/etc/rc.d/rc.local</file>. <sect1> Mount Points <p> It's handy to have mount points for the floppy, other devices and NFS-exported directories. For example, you can do the following: <tscreen><verb> ~# cd /mnt /mnt# mkdir floppy; mkdir cdrom; mkdir win; mkdir zip; mkdir server </verb></tscreen> This creates mount points for a DOS/Win floppy, an ext2 floppy, the CD--ROM, the Windows partition, the parallel port Zip drive, and a NFS directory. Now edit the file <file>/etc/fstab</file> and add the following entries: <tscreen><verb> /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 </verb></tscreen> Obviously, you must use the correct device in the first field. Recent kernels support fat32 partitions natively; for older ones, there's a kernel patch at <url url="http://bmrc.berkeley.edu/people/chaffee/fat32.html">. <tt>man mount</tt> for further information. Note the ``auto'' filesystem type in the first line; it allows you to mount both ext2 and vfat (DOS/Windows) floppies. You may find <tt>mtools</tt> more convenient. <sect1> lilo(8) and LOADLIN.EXE <p> 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 <file>/dev/hda1</file> contains DOS/Windows and that <file>/dev/hda2</file> contains Linux. <tscreen><verb> ~# fdisk Using /dev/hda as default device! Command (m for help):a Partition number (1-4): 2 Command (m for help):w ~# </verb></tscreen> This makes the Linux partition bootable. Then write this basic <file>/etc/lilo.conf</file> file: <tscreen><verb> boot = /dev/hda2 compact # may conflict with "linear" delay = 100 # 10 seconds linear # gets rid of the "1024 cylinder" problem # 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 = dos </verb></tscreen> Now issue <file>/sbin/lilo</file> and you're done. Being <tt/lilo/ a crucial part of your installation, you're strongly advised to read its documentation anyway. To boot Linux from DOS/Windows without resetting, put <tt/LOADLIN.EXE/ in a directory (in the DOS partition!) included in the DOS path; then copy your kernel to, say, <tt>C:\TEMP\VMLINUZ</tt>. The following simple <tt/.BAT</tt> file will boot Linux: <tscreen><verb> rem linux.bat smartdrv /C loadlin c:\temp\vmlinuz root=/dev/hda2 ro </verb></tscreen> If you use Windows 9x, set the properties of this <tt/.BAT</tt> so as it starts in MS--DOS mode. <sect2> Security Tip <p> Making a backup copy of your MBR before installing Linux is a safe move. Use <tt>restorrb</tt> (included in the <tt>FIPS</tt> package) before installation, or a Linux rescue floppy to issue this command: <tscreen><verb> rescue:~# dd if=/dev/hda of=MBR bs=512 count=1 </verb></tscreen> then make at least two copies of the file <tt>MBR</tt> on floppies. Should disaster strike, you'll be able to restore your old MBR by issuing: <tscreen><verb> rescue:~# dd if=/mnt/MBR of=/dev/hda bs=446 count=1 </verb></tscreen> assuming that a floppy containing <tt>MBR</tt> is mounted under <tt>/mnt</tt>. Alternatively, use a DOS rescue floppy to issue <tt>FDISK /MBR</tt>. <sect1> Mail Capabilities <p> You will want to be able to read mail messages written in HTML or containing exotic file formats. Make sure you have two files: <file>/etc/mime.types</file> and <file>/etc/mailcap</file>. The first one lists file types and related extensions, like: <tscreen><verb> application/postscript ps eps image/jpeg jpe jpeg jpg text/html html </verb></tscreen> while the second one tells the mail client how to display that file type. You may receive mail from people who use Microsoft Outlook, whose messages are in multi--part MIME format. These two lines, put in <file>etc/mailcap</file>, should let you read those messages: <tscreen><verb> text/plain; less %s; needsterminal text/html; lynx -force_html %s; needsterminal </verb></tscreen> <sect1> Printer Configuration <p> All distributions I know have a configuration tool for setting up the printer (<tt>printtool</tt>, <tt>yast</tt>, or <tt>magicfilter</tt>); if you don't have it, this is a basic manual configuration. 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. Setting up the printer involves a few steps: <itemize> <item> find out which one the parallel print device is: try <tscreen><verb> ~# echo "hello, world" > /dev/lp0 ~# echo "hello, world" > /dev/lp1 </verb></tscreen> and take note which one works. <item> make two spool directories: <tscreen><verb> ~# cd /var/spool/lpd /var/spool/lpd/# mkdir raw; mkdir postscript </verb></tscreen> <item> if your printer exibits the ``staircase effect'' (most inkjets do), you'll need a filter. Try to print two lines with <tscreen><verb> ~# echo "first line" > /dev/lp1 ; echo "second line" > /dev/lp1 </verb></tscreen> if the output is like this: <tscreen><verb> first line second line </verb></tscreen> then save this script as <file>/var/spool/lpd/raw/filter</file>: <tscreen><verb> #!/bin/sh # This filter eliminates the "staircase effect" awk '{print $0, "\r"}' </verb></tscreen> and make it executable with <tt>chmod 755 /var/spool/lpd/raw/filter</tt>. <item> make a filter for PostScript emulation. Write the following filter as <file>/var/spool/lpd/postscript/filter</file>: <tscreen><verb> #!/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 </verb></tscreen> (in this example an HP DeskJet printer is assumed. Fix it to suit your printer). <item> finally, add the following entries in <file>/etc/printcap</file>: <tscreen><verb> # /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: </verb></tscreen> </itemize> For more complex or exotic printing configurations, the Printing-HOWTO awaits you. If you use <tt>printtool</tt>, 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 <tt/postscript.cfg</tt>; for instance, I changed GSDEVICE from <tt>cdj500</tt> to <tt>djet500</tt> and now my prints come out much quicker. <sect1> SVGATextMode <label id="SVGA"> <p> This utility, available on <url url="ftp://tsx-11.mit.edu/pub/linux/sources/sbin">, 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. Edit <file>/etc/TextConfig</file> or <file>/etc/TextMode</file>, starting with the default VGA definition. Europeans should be happy with this ``LoadFont'' section: <tscreen><verb> 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 </verb></tscreen> Once you're done, try your configuration with a command like <tt>SVGATextMode "80x34x9"</tt>, and if everything appears to be working fine, remove the warnings from <file>/etc/TextMode</file> and include this line in <file>etc/rc.d/rc.sysinit</file>: <tscreen><verb> # SVGATextMode /usr/sbin/SVGATextMode "80x34x9" </verb></tscreen> Please note that the block cursor only works with some modes; on my notebook, "80x32x9". <sect> Common Administration Tasks <p> So many things to do, so little time! Here is where the fun begins. This section is rather network-centric, though many other tasks await you. 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. 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 services... <sect1> Network configuration <p> 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: <tscreen><verb> #!/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 </verb></tscreen> 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. <sect1> Sharing the Internet <p> 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; <url url="http://www.xos.nl/linux/ipfwadm/">) or ipchains (kernels 2.2.x; <url url="http://www.adelaide.net.au/~rustcorp/ipfwchains/ipfwchains.html">). Remember to enable kernel modules for the services you need, e.g. for ftp you'll add this line to <file>/etc/rc.d/rc.sysconfig</file>: <tscreen><verb> /sbin/modprobe ip_masq_ftp </verb></tscreen> Other modules are usually found in <file>/lib/modules/KERNEL-VERSION/ipv4</file>. Enabling IP masquerading for other machines in your local network is very simple. First, check the network initialisation scripts (<file>/etc/sysconfig/network</file> should be the right place) to see if they contain a line that reads <tt>FORWARD_IPV4=true</tt>. It's used to set <file>/proc/sys/net/ipv4/ip_forward</file> to 1 when the network subsystem comes up. Add these lines to <file>/etc/rc.d/rc.sysinit</file>: <tscreen><verb> # default: packets cannot go 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 </verb></tscreen> If you use a kernel of the 2.2.x series, use <tt>ipfwadm-wrapper</tt> instead of <tt>ipfwadm</tt> to get started quickly. Now you'll want something to let client machines dial the ISP; I use Mserver (<url url="http://cpwright.villagenet.com/mserver/">). Edit <file>etc/mserver.conf</file>; the only entries that you should modify are ``checkhost'', ``shadow'', and ``cname''. Then define your connection(s). Obviously, install one of the available clients on the client machines. <!-- Alternatively, you may use diald; please check out the Setting Up Diald for Linux Page <url url="http://home.pacific.net.sg/~harish/diald.config.html">. Alternatively, use <tt>eznet</tt> (Section <ref id="eznet" name="eznet">) ... --> <sect1> Restricting Network Access <label id="Restricting"> <p> Let's suppose you connect to the Internet via PPP. Once you're connected, your machine may become vulnerable to attacks. Insert this in <file>/etc/hosts.allow</file>: <tscreen><verb> # only allow access to localhost ALL: 127. </verb></tscreen> and this in <file>/etc/hosts.deny</file>: <tscreen><verb> # deny access to everyone ALL: ALL </verb></tscreen> If you belong to a network with direct Internet access, you had better disable finger, telnet, and possibly other services for security reasons; use <tt>ssh</tt> instead of telnet. The file to edit is <file>/etc/inet.conf</file>. Alternatively, you can restrict network access putting this in <file>/etc/hosts.allow</file>: <tscreen><verb> in.telnetd: 192.168.1., .another.trusted.network in.ftpd: 192.168.1., .another.trusted.network </verb></tscreen> and this in <file>/etc/hosts.deny</file>: <tscreen><verb> in.telnetd: ALL in.ftpd: ALL </verb></tscreen> <sect1> NFS Exports <p> It is common to export the 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 equal to 500 on <tt>server</tt> and UID/GID equal to 512 on <tt>client</tt>, a convenient configuration is this: <tscreen><verb> # /etc/exports /tmp my.client.machine(rw) /home/guido my.client.machine(rw,map_static=/etc/nfs/client.map) </verb></tscreen> In <file>/etc/nfs/client.map</file> you'll put this: <tscreen><verb> # /etc/nfs/client.map # NFS mapping for client # remote local uid 512 500 gid 512 500 </verb></tscreen> <!-- Remind!!! --> <sect1> Name Server <p> Not written yet. <sect> Software Configuration <label id="config"> <p> These are the the configuration files we are going to custimise: <file>/etc/profile</file> <file>/etc/bashrc</file> <tt/.bashrc/ <!-- trick to avoid the leading dot problem --> <tt>.bashrc .bash_profile .bash_logout .inputrc .less .lessrc .xinitrc </tt> <tt>.fvwmrc .fvwm2rc95 .Xmodmap .Xmodmap.num .Xdefaults .jedrc </tt> <tt>.abbrevs.sl .joerc .emacs </tt>. Don't add users until you have completed your system configuration; you'll put the dot files in <file>/etc/skel</file>. <sect1> bash(1) <p> Arguably, the most important piece of software after the kernel. To tailor the behaviour of <tt>bash</tt>, these are the main files to edit: <itemize> <item> <file>/etc/bashrc</file> contains system wide aliases and functions; <item> <file>/etc/profile</file> contains system wide environment stuff and startup programs; <item> <tt>$HOME/.bashrc</tt> contains user aliases and functions; <item> <tt>$HOME/.bash_profile</tt> contains user environment stuff and startup programs; <item> <tt>$HOME/.inputrc</tt> contains key bindings and other bits. </itemize> Examples of these files are shown below. First, the most important: <file>/etc/profile</file>. 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! <code> # /etc/profile # System wide environment and startup programs # Functions and aliases go in /etc/bashrc # This file sets up the following features and programs: # # o path # o prompts # o a few environment variables # o colour ls # o less # o rxvt # # Users can override these settings and/or add others in their # $HOME/.bash_profile # set a decent path PATH="$PATH:/usr/X11R6/bin:$HOME/bin:." # notify the user: login or non-login shell. If login, the prompt is # coloured in blue; otherwise in 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" fi ESC="\033" PROMPT='\h' # hostname STYLE=';1m' # bold # PROMPT='\u' # username # STYLE='m' # plain PS1="\[$ESC[$COLOUR;37$STYLE\]$PROMPT:\[$ESC[37;40$STYLE\]\w\\$ " PS2="> " # no core dumps, please ulimit -c 0 # set umask if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then umask 002 else umask 022 fi # 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 # fix the backspace key in rxvt/xterm CTRL_H="\010" NULL_STRING=" $CTRL_H" # space + backspace if [ "$NULL_STRING" != "" ] ; then stty erase ^? else stty erase ^H fi # set xterm title: full path case $TERM in xterm*) 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 </code> This is a sample <file>/etc/bashrc</file>: <code> # /etc/bashrc # System wide functions and aliases # Environment stuff goes in /etc/profile # Insert PS1 definitions here if you experience problems. export CDPATH="$CDPATH:~" # common aliases alias cp='cp -i' alias l=less alias ls="ls $LS_OPTIONS" alias mv='mv -i' alias rm='rm -i' alias rmbk='/bin/rm -f .*~ *~ *aux *bak *log *tmp 2> /dev/null' alias u='cd ..' alias which="type -path" alias x=startx # A few useful functions c () # cd to the new directory and list its contents { cd $1 ; ls } inst() # Install a .tar.gz archive in current directory { if [ $# != 0 ]; then tar zxvf $1; fi } cz() # List the contents of a .zip archive { if [ $# != 0 ]; then unzip -l $*; fi } ctgz() # List the contents of a .tar.gz archive { for file in $* ; do tar ztf ${file} done } tgz() # Create a .tgz archive a la zip. { if [ $# != 0 ]; then name=$1.tar; shift; tar -rvf ${name} $* ; gzip -9 ${name} fi } crpm() # list information on an .rpm file { if [ $# != 0 ]; then rpm -qil $1 | less; fi } </code> This is a sample <tt/.bashrc/: <code> # $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 & } </code> This is a sample <tt/.bash_profile/: <code> # $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" </code> This is a sample <tt/.inputrc/: <code> # $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 </code> To make the backspace and delete keys work correctly in <tt>xterm</tt> and other X11 applications, the following is also needed: <itemize> <item> put this in your <tt>.xinitrc</tt>: <tscreen><verb> usermodmap=$HOME/.Xmodmap xmodmap $usermodmap </verb></tscreen> <item> then your <tt>.Xmodmap</tt> will contain: <tscreen><verb> keycode 22 = BackSpace keycode 107 = Delete </verb></tscreen> this fixes the console. To fix <tt>xterm</tt>: <item> put this in your <tt>.Xdefaults</tt>: <tscreen><verb> xterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\ <Key>Delete: string(0x1b) string("[3~")\n\ <Key>Home: string(0x1b) string("[1~")\n\ <Key>End: string(0x1b) string("[4~")\n\ Ctrl<Key>Prior: string(0x1b) string("[40~")\n\ Ctrl<Key>Next: string(0x1b) string("[41~") nxterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\ <Key>Delete: string(0x1b) string("[3~")\n\ <Key>Home: string(0x1b) string("[1~")\n\ <Key>End: string(0x1b) string("[4~")\n\ Ctrl<Key>Prior: string(0x1b) string("[40~")\n\ Ctrl<Key>Next: string(0x1b) string("[41~") </verb></tscreen> </itemize> <tt>rxvt</tt> is a wee bit more complicated, as some compile--time options influence its behaviour. See the above <file>/etc/profile</file>. More info in <tt>bash</tt>(1) and <tt>readline</tt>(3) man pages. Don't expect every application to work correctly! If you run <tt>joe</tt> in <tt>xterm</tt>, for instance, some keys won't work; the same holds for some versions of <tt>rxvt</tt>. <sect1> ls(1) <p> <tt>ls</tt> can display directory listings using colours to highlight different file types. To enable this feature, you just need a couple of lines in <file>/etc/profile</file> as seen above. However, this won't work with some versions of <tt>rxvt</tt>; use some flavour of <tt>xterm</tt> instead. It looks like some old <tt>rxvt</tt>s have a bug that prevents them from inheriting the environment correctly in some circumstances. Caldera's <tt>ls</tt> doesn't have colours, but there's an equivalent <tt>color-ls</tt>. Add this in <file>/etc/bashrc</file>: <tscreen><verb> alias ls="color-ls $LS_OPTIONS" </verb></tscreen> <sect1> less(1) <p> 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: <itemize> <item> to use it with the movement keys, have this plain ASCII file <tt/.lesskey/ in your home directory: <tscreen><verb> ^[[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 </verb></tscreen> then run the command <tt>lesskey</tt>. (These are escape sequences for vt100-like terminals.) This creates a binary file <tt>.less</tt> containing the key bindings. <!-- pointer to Keyboard and console HOWTO? --> <item> write the following file as <file>/usr/local/bin/lesspipe.sh</file>: <code> #!/bin/sh # This is a preprocessor for 'less'. It is used when this environment # variable is set: LESSOPEN="|lesspipe.sh %s" lesspipe() { case "$1" in *.tar) tar tf $1 2>/dev/null ;; # View contents of .tar and .tgz files *.tgz|*.tar.gz|*.tar.Z|*.tar.z) tar ztf $1 2>/dev/null ;; *.Z|*.z|*.gz) gzip -dc $1 2>/dev/null ;; # View compressed files correctly *.zip) unzip -l $1 2>/dev/null ;; # View archives *.arj) unarj -l $1 2>/dev/null ;; *.rpm) rpm -qpil $1 2>/dev/null ;; *.cpio) cpio --list -F $1 2>/dev/null ;; *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.l|*.man) FILE=`file -L $1` FILE=`echo $FILE | cut -d ' ' -f 2` if [ "$FILE" = "troff" ]; then groff -s -p -t -e -Tascii -mandoc $1 fi ;; *) file $1 | grep text > /dev/null ; if [ $? = 1 ] ; then # it's not some kind of text strings $1 fi ;; esac } lesspipe $1 </code> then make it executable with <tt>chmod 755 lesspipe.sh</tt>. <item> put the necessary variables in <file>/etc/profile</file> as seen above. <!-- CHIARIRE QUALI!!! --> </itemize> <sect1> emacs(1) <p> I rarely use <tt>emacs</tt>, so I have only a couple of tips for you. Some <tt>emacs</tt> distributions don't come preconfigured for colours and syntax highlighting. Put this in your <tt>.emacs</tt>: <tscreen><verb> (global-font-lock-mode t) (setq font-lock-maximum-decoration t) </verb></tscreen> This only works in X11. Moreover, to enable accented characters you'll add this line: <tscreen><verb> (standard-display-european 1) </verb></tscreen> I'll leave it to you to peruse all of <tt>emacs</tt>' documentation to find out how to tailor it to your needs---potentially, it can take months of hacking. The Dotfile generator (Section <ref id="Config sw" name="Configuration Software">) is a good helping hand. <sect1> joe(1) <p> Some versions of <tt>joe</tt> 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: <tscreen><verb> ~$ export TERM=vt100 ~$ joe myfile (edit your file) ~$ export TERM=linux </verb></tscreen> To make the special keys work, all you have to do is edit <tt>.joerc</tt>, <tt>.jstarrc</tt> or your favourite emulation; you can start from the system-wide config files in <file>/usr/lib/joe</file>. Look for the fourth section (key bindings). This enables Home and End: <tscreen><verb> bol ^[ [ 1 ~ Go to beginning of line eol ^[ [ 4 ~ Go to end of line </verb></tscreen> Find out the desired ESC sequences typing <tt>cat</tt> followed by the special keys. <sect1> jed(1) <p> This is my favourite editor: it does what I need, it's lighter and easier to configure than <tt>emacs</tt>, and emulates other editors quite well. Many users at my university use <tt>jed</tt> to emulate <tt>EDT</tt>, VMS' system editor. <tt>jed</tt>'s configuration files are <tt>.jedrc</tt> and <file>/usr/lib/jed/lib/*</file>; the former can be adapted from <tt>jed.rc</tt> in the latter directory. <itemize> <item> to make <tt>jed</tt> use the special keys correctly, write the file <file>/usr/lib/jed/lib/defaults.sl</file> whose only line reads: <tscreen><verb> () = evalfile("linux"); </verb></tscreen> <item> if <tt>xjed</tt> apparently doesn't recognise the DEL key, add these lines to your <tt>.jedrc</tt>: <tscreen><verb> #ifdef XWINDOWS x_set_keysym (0xFFFF, 0, "\e[3~"); setkey (``delete_char_cmd'', "\e[3~"); #endif </verb></tscreen> <item> edit <file>/usr/lib/jed/lib/linux.sl</file> to specify <tt>Info_Directory = "/usr/info";</tt> and <tt>/bin/mail</tt> after <tt>/UCB_Mailer = "/bin/mail";</tt>; <item> to make <tt>jed</tt> emulate <tt>EDT</tt> (or other editors) all you have to do is edit a couple of lines in <tt>.jedrc</tt>. If you want the numeric keypad `<tt>+</tt>' to delete words instead of a single character, add this in <tt>.jedrc</tt>: <tscreen><verb> unsetkey("\eOl"); unsetkey("\eOP\eOl"); setkey("edt_wdel", "\eOl"); setkey("edt_uwdel", "\eOP\eOl"); </verb></tscreen> after the line that reads <tt>() = evalfile("edt")</tt> (or similar); <item> to make <tt>xjed</tt> use the numeric keypad for <tt>EDT</tt> emulation, insert the following in <tt>.Xmodmap</tt>: <tscreen><verb> keycode 77 = KP_F1 keycode 112 = KP_F2 keycode 63 = KP_F3 keycode 82 = KP_F4 keycode 86 = KP_Separator </verb></tscreen> <item> colour customization for <tt>xjed</tt> is done adding lines like these in <tt>.Xdefaults</tt>: <tscreen><verb> xjed*Geometry: 80x32+150+50 xjed*font: 10x20 xjed*background: midnight blue # and so on... </verb></tscreen> <item> the ``abbreviation'' feature is an invaluable timesaver. Write a file like the following as <tt>$HOME/.abbrevs.sl</tt> (you can change this name by inserting <tt>variable Abbrev_File = "/usr/lib/jed/abbrev.sl";</tt> in <tt>.jedrc</tt>): <tscreen><verb> 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... </verb></tscreen> and type <tt>ESC x abbrev_mode</tt> to enable it. To have the abbreviation enabled by default, add entries like these to your <tt>.jedrc</tt>: <tscreen><verb> define text_mode_hook () { set_abbrev_mode (1); } % define fortran_hook () { set_abbrev_mode (1); use_abbrev_table ("Fortran"); } % and so on... </verb></tscreen> </itemize> <sect1> pine(1) <p> Edit the global configuration in <file>/usr/lib/pine.conf</file>, taking care at least of the following fields: <tt>user-domain</tt>, <tt>smtp-server</tt>, and <tt>nntp-server</tt>. Note that <tt>inbox-path</tt> depends on your MTA: if you use <tt>sendmail</tt> or <tt>postfix</tt>, that'll be <tt>var/spool/mail/$USER</tt>; with Qmail, <file>/home/$USER/Mailbox</file> (but root will use <file>/var/qmail/alias/Mailbox</file>. <sect1> minicom(1) <p> Users can't use <tt>minicom</tt> unless a global configuration has been made by root. Remember to make it. <sect1> efax(1) <p> This package is probably the most convenient for simple sending/receiving of faxes. You'll have to tailor the script <file>/usr/bin/fax</file>; easy job, but a couple of quirks caused me quite a headache: <itemize> <item> to find out whether your modem is class 1, 2, or 2.0, use minicom or similar program to issue the command <tt>at+fclass=?</tt>. The reply may be like <tt>0,1,2</tt>; 1 and 2 are the classes supported by your modem; <item> DIALPREFIX: chances are that simply putting `<tt>T</tt>' or `<tt>P</tt>' won't work in some countries (in Italy, at least). Put `<tt>ATDT</tt>' or `<tt>ATDP</tt>' instead; <item> INIT and RESET: these strings contain the initialisers `<tt>-i</tt>' and `<tt>-k</tt>', needed by <tt>efax</tt>. If you want to add an AT command, add it to the appropriate string leaving out `<tt>AT</tt>' and preceding the rest with either `<tt>-i</tt>' or `<tt>-k</tt>'. Example: to add the `<tt>ATX3</tt>' command to INIT, you'll append `<tt>-iX3</tt>'. </itemize> That done, there are a few permissions to fix to enable non-root users to send and receive faxes. The directories <file>/var/lock</file> and <file>/var/spool/fax</file> must be writable. To do so, create the group <tt>faxusers</tt>, add users to it, then type: <tscreen><verb> ~# chown root.faxusers /var/lock ~# mkdir /var/spool/fax ~# chown root.faxusers /var/spool/fax; chmod g+w /var/spool/fax </verb></tscreen> <sect1> Ghostscript <p> This essential tool suffers from a small snag. Owing to to the well-known export regulations in the USA, the utility <tt>pdf2ps</tt> doesn't work on encrypted .pdf files. Never mind: turn your browser to <url url="http://www.ozemail.com.au/~geoffk/pdfencrypt">, download the file <tt>pdf_sec.ps</tt> and put it in place of the file with the same name that comes with the distribution of Ghostscript. <sect1> TeX and Friends <p> I'll assume you have the teTeX distribution. <itemize> <item> download additional LaTeX packages from your nearest CTAN mirror site, e.g. <url url="ftp://ftp.dante.de/pub/tex">. Add the files under <file>/usr/share/texmf/tex/latex</file>, then run the command <tt>texhash</tt> so that teTeX recognises the new package; <item> to configure the hyphenation pattern for your language, edit the file <file>/usr/share/texmf/tex/generic/config/language.dat</file>, then do: <tscreen><verb> ~# texconfig init ; texconfig hyphen </verb></tscreen> <item> to tailor <tt>dvips</tt>, the file to edit is <file>/usr/share/texmf/dvips/config/config.ps</file>. Be aware that the fields regarding the default resolution also affect <tt>xdvi</tt>'s behaviour; if you experience annoying attempts to create fonts each time you run it, put the line <tscreen><verb> XDvi*mfmode: </verb></tscreen> in <tt>.Xdefault</tt>. This should help. <item> to include PostScript figures that reside in subdirectories, you can expand TeX's search path to include subdirectories. Put this command in your <file>.bash_profile</file>: <tscreen><verb> export TEXINPUTS="$HOME/figures::./figures" </verb></tscreen> which makes TeX search in <tt>$HOME/figures</tt> before the default directories, and <tt>./figures</tt> after the default directories. </itemize> <sect1> Avoid PPProblems! <p> 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 <tt>pppd</tt> package correctly installed and, if you will, suid root. Obviously, your ISP must support PPP. There are now two ways to get PPP to work: a) manual configuration, and b) a configuration program that automagically sees to it. Whichever option you choose, have the following information on hand: <itemize> <item> your ISP's telephone number; <item> your ISP's name, mail and news server address; <item> your ISP's domain; <item> your username and password. </itemize> Manual configuration is a drudgery. It's about editing files and writing scripts; not too much work, but it's easy to make mistakes and newcomers are often intimidated. The PPP HOWTO is there for you. Alternatively, there are tools that ask for the information above and do all the work. Gnome and KDE include, respectively, <tt>gnome-ppp</tt> and <tt>kppp</tt> which are easy enough to set up. Alternatively, I suggest that you have a look at a couple of tty--based tools, <tt>wvdial</tt> and <tt>eznet</tt>. You feed them your ISP's phone number, your username, your password, and you're in business. Their home pages are at <url url="http://www.worldvisions.ca/wvdial"> and <url url="http://www.hwaci.com/sw/eznet">. Both are great, but I prefer the latter. <sect2> A Quick Start with eznet <p> First of all, create an <file>/etc/resolv.conf</file> like this: <tscreen><verb> nameserver w.x.y.z </verb></tscreen> where you'll insert the address of your ISP's nameserver. To create an account with <tt>eznet</tt>, issue the following command: <tscreen><verb> #~ eznet add service=YOUR_ISP user=NAME password=PASSWORD phone=PHONE </verb></tscreen> which creates the file <file>/var/eznet/eznet.conf</file>, owned by root.root with permissions 600; chmod it to 666 if you want it to be world readable. Now dial your ISP with <tt>eznet up YOUR_ISP</tt>. If the modem keeps waiting for the dial tone and won't connect, then try this command: <tscreen><verb> #~ eznet change YOUR_ISP init0=atx3 </verb></tscreen> To hang up, the command is <tt>eznet down</tt>. That's all! <sect2> A Quick Start with wvdial <p> <tt>wvdial</tt>'s setup is even shorter. Type <tt>wvdialconf /etc/wvdial.conf</tt>, then edit the resulting file to include your username, password, and phone number. Try it out with <tt>wvdial</tt>, and keep your fingers crossed. To hang up, stop it with Ctrl-C. <sect1> POP Client <p> To retrieve your mail from a POP3 server, you use a POP client like <tt>fetchpop</tt> or <tt>fetchmail</tt>; the latter is more advanced, but requires that you run <tt>sendmail</tt>. This is a bit of an overkill on low-spec machines. They're available on <url url="ftp://metalab.unc.edu/pub/Linux/system/mail/pop">. To configure these clients: <itemize> <item><tt>fetchpop</tt>: the first time you run it, you'll be prompted for some information. Answer the questions and you're set. <tt>fetchpop</tt> must be used with the <tt>-r</tt> switch if your ISP's POP3 server doesn't implement the command LAST properly. <item><tt>fetchmail</tt>: adapt this sample <tt>.fetchmailrc</tt>: <tscreen><verb> # $HOME/.fetchmailrc poll mbox.myisp.com with protocol pop3; user john there with password _Loo%ny is john here </verb></tscreen> 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 <tt>chmod 600 .fetchmailrc</tt>, otherwise <tt>fetchmail</tt> will rightly refuse to start. This example is very basic; there are endless possibilities of configuration. Check out at <url url="http://www.ccil.org/~esr/fetchmail">. </itemize> <sect1> X Window System (XFree86) <p> <sect2> Setting Up the X Server <p> Come on, it's not difficult as it used to be... All major distributions include a tool for setting up X11 (e.g. <tt>XConfigurator</tt>, <tt>sax</tt>, <tt>XF86Setup</tt>, or at least <tt>xf86config</tt>). X configuration is virtually automatic these days, but a few video cards may refuse to work. Each time I experience problems setting up X on a system, I resort to a simple method that has always worked: <itemize> <item> make sure that the plain VGA server is installed; <item> go to <url url="ftp://ftp.XFree86.org/pub/XFree86/current/binaries">, cd to the proper Linux subdirectory, and download the archives <tt>X_version_bin.tgz</tt>, <tt>X_version_set.tgz</tt>, and all the servers. Amongst other programs, the first archive contains the most up-to-date <tt>SuperProbe</tt>; <item> unpack <tt>X_version_bin.tgz</tt> to a temporary directory, cd to it, and run <tt>./SuperProbe</tt>. If your video card is recognised, chances are that you'll be able to set it up. Otherwise, hard luck; <item> install the servers and <tt>X_version_set.tgz</tt> from <file>/usr/X11R6/</file>, then run <tt>XF86Setup</tt>. </itemize> This has always worked for me, but your mileage may vary. Please note that most times X11 won't start because the specs you choose for your monitor were too high! Start with conservative settings, i.e. 800x600 and 256 colours, then pump it up. <em>Warning</em>: these operations are dangerous and your monitor might be damaged! <sect2> Keypad <p> We have seen above how to make a few special keys work. The sample file <tt>.Xmodmap</tt> 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 <tt>.Xmodmap.num</tt>: <tscreen><verb> ! Definitions can be found in <X11/keysymdef.h> keycode 77 = Num_Lock keycode 112 = KP_Divide keycode 63 = KP_Multiply keycode 82 = KP_Subtract keycode 86 = KP_Add keycode 79 = KP_7 keycode 80 = KP_8 keycode 81 = KP_9 keycode 83 = KP_4 keycode 84 = KP_5 keycode 85 = KP_6 keycode 87 = KP_1 keycode 88 = KP_2 keycode 89 = KP_3 keycode 90 = KP_0 keycode 91 = KP_Decimal </verb></tscreen> Make sure that your <file>/etc/X11/XF86Config</file> does not contain these three lines: <tscreen><verb> ServerNumLock Xleds XkbDisable </verb></tscreen> and in case, comment them out. To re-enable the keypad, you'll issue the command <tt>xmodmap .Xmodmap.num</tt>. <sect2> Graphical Login with xdm <p> To be greeted by a graphical login, edit the file <file>/etc/inittab</file>, which should include a line like this: <tscreen><verb> x:5:respawn:/usr/bin/X11/xdm -nodaemon </verb></tscreen> where 5 is the runlevel corresponding to X11 (S.u.S.E. uses 4). Modify the line that defines the default runlevel (usually 2 or 3), changing it as above: <tscreen><verb> id:5:initdefault: </verb></tscreen> The number of colours is specified in <file>/etc/X11/xdm/Xserver</file>: <tscreen><verb> :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 </verb></tscreen> If you already have <tt>.xinitrc</tt>, copy it to <tt>.xsession</tt> and make the latter executable with <tt>chmod +x .xsession</tt>. Now issue the command <tt>telinit 5</tt> and you're in business. <sect2> Window Manager <p> Once X works, there are endless possibilities of configuration; it depends on the window manager you use, there are tens to choose from. Mostly, it's all down to editing one or more ASCII files in your home directory; in other cases you don't have to edit a thing, and use an applet or even a menu. Some examples: <itemize> <item> <bf>the fvwm family</bf>: copy <file>/etc/X11/fvwm/system.fvwmrc</file> (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; <item> <bf>WindowMaker</bf>: it has several config files that live under <tt>$HOME/GNUstep</tt>, and a cool configuration applet; <item> <bf>KDE</bf> and <bf>Gnome</bf>: nothing to edit manually here: everything can be done via the menu. </itemize> In short: if you don't mind editing config file, choose something like <tt>icewm</tt>, <tt>fvwm*</tt>, <tt>blackbox</tt> etc; if you do mind, the choice is currently restricted to KDE, Gnome, WindowMaker, and XFCE. It's important to have a good <tt>.xinitrc</tt>. An example: <tscreen><verb> #!/bin/sh # $HOME/.xinitrc usermodmap=$HOME/.Xmodmap xmodmap $usermodmap xset s noblank # turn off the screen saver xset s 300 2 # screen saver start after 5 min xset m 10 5 # set mouse acceleration rxvt -cr green -ls -bg black -fg white -fn 7x14 \ -geometry 80x30+57+0 & if [ "$1" = "" ] ; then # default WINMGR=wmaker else WINMGR=$1 fi $WINMGR </verb></tscreen> Although it doesn't appear to be strictly required, make it executable with <tt>chmod +x .xinitrc</tt>. This <tt>.xinitrc</tt> lets you choose the window manager: try <tscreen><verb> $ startx startkde # or other w.m. </verb></tscreen> (it doesn't work with some S.u.S.E. versions, though). <sect2> Defaults for X11 Apps <p> Find out where the <file>app-defaults</file> directory is (it should be <file>/usr/X11R6/lib/X11/app-defaults</file>). Several apps keep a configuration file there. <sect1> Users' Configurations <p> When you're done editing the dot files, copy them to <file>/etc/skel</file> as seen in Section <ref id="config" name="Software Configuration">. <sect1> Making .rpms <p> <tt>rpm</tt> 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 modern <tt>gcc</tt> versions like <tt>egcs</tt> or <tt>pgcc</tt>, it may be advisable to put this in your <tt>/etc/rpmrc</tt>: <tscreen><verb> optflags: i386 -O2 -mpentium </verb></tscreen> <sect1> Upgrading <p> If you upgrade your machine, do your backup as usual and remember to save a few additional files. Some could be <file>/etc/X11/XF86Config</file>, <file>/usr/bin/fax</file>, all the stuff in <file>/usr/local</file>, the kernel configuration, the whole <file>/etc</file>, and all the mail in <file>/var/spool/mail</file>. 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. <sect> Configuration Software <label id="Config sw"> <p> 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 <tt>setup</tt>, <tt>printtool</tt>, <tt>netcfg</tt>, <tt>usertool</tt>, etc, while S.u.S.E. ships with a comprehensive configuration program called Yast. Other useful programs are: <itemize> <item> <bf>The Dotfile Generator</bf>: fine X app with modules to configure packages like <tt>emacs</tt>, <tt>bash</tt>, <tt>procmail</tt> and more. Its page is at <url url="http://www.imada.ou.dk/~blackie/dotfile">; <item> <bf>Linuxconf</bf>: the ultimate configuration tool. It can do everything, both in console and under X. Go to <url url="http://www.solucorp.qc.ca/linuxconf"> at once. </itemize> <sect> The End <label id="The End"> <p> <sect1> Copyright <p> Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective authors. Linux HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions. All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at the address given below. In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. If you have questions, please contact Tim Bynum, the Linux HOWTO coordinator, at <url url="linux-howto@metalab.unc.edu"> via email. <sect1> Feedback <p> 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. 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. <sect1> Disclaimer <p> ``Configuration HOWTO'' was written by Guido Gonzato, <url url="REMOVE_MEguido@ibogeo.df.unibo.it">. (Remove ``REMOVE_ME''.) 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. 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. I hope you'll find this work useful, though. Whenever I install a new Linux box, I actually do... Enjoy, Guido <tt/=8-)/ </article>