THE advanced linux
POCKETBOOK
4
pocketbooks
Editorial
Hello and welcome to the 2003 Edition of the Advanced Linux Pocketbook. Last
month we gave you the updated Linux Pocketbook, so by now you should be an old
hand when it comes to the basics; installing software, configuring settings, and
connecting to other machines. You should be at least savvy when it comes to the
command line, even if you can’t do much more than manipulate files. Grep should
be in your bag of tricks, and your fingers should gravitate to the ‘l’ and ‘s’ keys
automatically when you sit idle at the console. If you’re keen to learn how to make
the most out of Linux, you’re in the right place. While the first book dealt with how
to get Linux up and running on your system, this Advanced Pocketbook develops
your skills from there. Remember back to when you installed your first Linux
distribution and looked up to the geeks that seemed to know so much more about
this obscure yet powerful operating system. They dazzled you with talk of Python
scripts, pages built using PHPNuke, and staying up late at night, fuelled by litres
of Jolt cola, to recompile their kernels. Well, here’s your chance to become one
of those geeks. The APC Advanced Linux Pocketbook 2003 edition will raise your
level of Linux awaredness to a higher plane. If you’re after enlightenment, read
on. Yes, that really was a bad Linux pun. As always, may the source be with you.
Matt Overington
First published May 2001.
Material contained within The Advanced Linux Pocketbook 2003
edition is protected under the Commonwealth Copyright Act 1968.
No material may be reproduced in part or in whole without the
written consent of the copyright holders.
The Advanced Linux Pocketbook is published by ACP Tech, a
division of ACP Publishing Pty Ltd (ACN 053 273 546).
THE 2003 edition linux
POCKETBOOK
This Pocketbook is for Advanced users of Linux. If you
nd the information over your head, we recommend that
you look at the 2003 Edition Linux Pocketbook, which
can be found on last month’s cover CD. If you missed out,
then don’t worry... we can help you! Call 136 116 or visit
www.magshop.com.au to order your back issue for
$9.80 + $6.50 for postage within Australia.
May the source be with you!
6
pocketbooks
7
pocketbooks
CHAPTER 5
MAXIMISING LINUX 117
Top 10 handy habits 118
Top 10 programs 125
Customising the shell 131
Filesystems and drives 136
Optimisation tips 142
CHAPTER 6
DEVELOPING LINUX 145
Shell scripting 146
Introduction to Python 155
How do programs run? 160
Keeping up to date 163
Why open source? 166
CHAPTER 7
HELPING THE CAUSE 169
The Linux community 170
EDITORIAL 5
Contents 6
The next step 8
CHAPTER 1
INTRODUCING DEBIAN 11
Welcome to Debian
GNU/Linux 12
Installing Debian 16
Getting comfy with
Debian 19
CHAPTER 2
HANDLING HARDWARE 25
Modularising hardware 26
Graphics cards 30
Network cards 35
Digital versatile disc 37
CD burning 41
Soundcards 44
CPUs and SMP 46
CHAPTER 3
NETWORK SERVICES 53
Networking 54
Webmin 58
Web serving 61
Database serving 67
Dynamic Web content
generation 69
FTP serving 74
Proxy caching 77
Email hosting 80
DHCP serving 88
Network filesystem 90
Telnet 92
Secure shell 94
Virtual network
computing 97
NTP 99
Firewalling and
masquerading 100
CHAPTER 4
SECURITY PRACTICES 105
Security is a state of
mind 106
Cracked . . . 111
Extending permissions 113
Contents
8
pocketbooks
how to edit configuration files or start the X window system from the command
line, then you might find yourself quickly lost in Debian. Also, because this is the
advanced book, the install guide we’ve provided is brief; we’re assuming you are
already familiar with the basics of installing a new distribution.
You can pick it up from Debian.org or everythinglinux. If you think you’re
geek enough to give it a try, we strongly recommend you set up a new partition in
which to install Debian. This way you can try it out and see if you like it. Be warned
though that if your only experience of Linux is Red Hat or Mandrake, Debian will
be a challenge for you — some directory structures differ in Debian, and it has
a completely different (but very powerful) package management system. Hence,
you can see why we chose it for this Pocketbook — an experienced distribution
for experienced users!
If you find it too hard at first, stick with it a while. There’s a reason develop-
ers of distributions such as Caldera and some embedded Linux derivatives chose
Debian as their base: it delivers on what it promises — stability, security
and consistency across the distribution and installed programs.
The next step
The Advanced Linux Pocketbook is, as its title suggests, the follow-up to The Linux Pocketbook.
In this edition we’ll cover a variety of advanced topics, including how to configure new hardware
and set up a multitude of network services, an introduction to the power of scripting, some handy
optimisation tips and basic good security habits.
Being an advanced book, however, there is a certain amount of knowledge we assume you
already have. You should know how to install, configure and tailor Linux to your liking, as well as
how to edit configuration files and install new programs — all the information that was featured in
the previous Linux Pocketbook. We don’t explain how to do simple tasks in this book; rather we aim
to build on your current knowledge. This means covering a far broader range of Linux’s capabilities
and getting right to the core of our subjects.
Moreover, because we don’t go over the basic knowledge you learned in The Linux Pocketbook,
much of which was based around getting Linux up and running, we can dedicate the whole book to
helping you get the most out of Linux.
If, however, you consider yourself still fairly new to Linux, just keep The Linux Pocketbook 2003
edition handy as a reference guide.
Since The Advanced Linux Pocketbook follows on from its predecessor, much of the content
in this Pocketbook focuses on the Red Hat and Mandrake distributions. Many commands and pro-
grams will operate the same way on other distributions, but you still may find the odd Red Hat and
Mandrake-specific quirk here and there. If you’re wondering why Mandrake and Red Hat operate
in such a similar way remember that Mandrake started out based on Red Hat so they set up the
system in a similar way.
A NEW DISTRIBUTION
The print versions of the Linux Pocketbook series provided an introduction to a variety of distribu-
tions — multiple versions of Red Hat, Caldera OpenLinux and Mandrake Linux. The Advanced Linux
Pocketbook introduces you to one more — Debian.
Debian is a very well respected and popular distribution, but it doesn’t get quite the same
amount of press as distributions like Red Hat or Mandrake. Part of the reason for this is that
its insistence on stability and security means it adopts new technologies more slowly than the
mainstream distributions, which doesn’t endear it to new users who want the latest and greatest.
Additionally, Debian currently uses a traditional text mode installation procedure, which again isn’t
as inviting to new users as the graphical installation mechanisms provided by Red Hat, Mandrake
and others.
That said, Debian — like this Pocketbook — assumes you already have a grounding in Linux.
It’s an advanced, clean and professional distribution for advanced users. If you don’t already know
As stated above, however, this book focuses primarily on Red Hat and
Mandrake distributions, as these are the distributions we’ve shown you how to
configure and use from the start. All the packages mentioned in this book can
be found online easily using Debian’s inbuilt package management tool, which
can find and fetch programs for you and for which we provide an overview in
Chapter 1. And, aside from the location of a configuration file or two (which the
Debian package of an application will install to the correct location for you) you
will, as an experienced user, be able to apply all of the information contained in
this book to Debian.
If Debian doesn’t seem your cup of herbal tea right now, keep an eye on it
(and all other distributions) and check it out at a later date. As distributions evolve
you may find yourself growing fond of a new distribution. Choice is, as always, a
wonderful thing!
10
pocketbooks