Debian GNU/Linux Desktop Survival Guide
Graham Williams
ii The procedures and applications presented in this book have been included for their instructional value. They have been tested but are not guaranteed for any particular purpose. The publisher does not offer any warranties or representations, nor does it accept any liabilities with respect to the programs and applications. This book is a work in progress (and probably will always be so!). Please send me comments, suggestions, updates, criticisms.
Printed 9 March 2004
c 2003-2004 by Graham Williams Copyright mailto:[email protected] Permission is granted to copy and distribute this book but not for commercial gain with the exception that this document may be included with any distribution of Debian GNU/Linux, without limitation.
Contents Preface
xxix
1 Quick Start
1
2 Advocacy
3
2.1
Linux Adopters . . . . . . . . . . . . . . . . . . . . . . . . . .
3 History: Unix, GNU, Gnome
3 7
3.1
Unix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2
GNU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3
Linux
3.4
Gnome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5
Free and Open Source Software . . . . . . . . . . . . . . . . . 15
3.6
Free Documentation . . . . . . . . . . . . . . . . . . . . . . . 17
3.7
Freedom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.8
General Resources
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
. . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.1
Books . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.8.2
Internet . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4 Distributions 4.1
8
21
Debian GNU/Linux Distributions . . . . . . . . . . . . . . . . 22 iii
iv
CONTENTS 4.2
Advantages of the Debian Distribution . . . . . . . . . . . . . 23
4.3
Debian Distributions . . . . . . . . . . . . . . . . . . . . . . . 25
4.4
Debian Packages . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.5
Debian Releases . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.5.1
Naming The Releases . . . . . . . . . . . . . . . . . . . 27
4.5.2
Recording Your Choice . . . . . . . . . . . . . . . . . . 28
4.5.3
Other Flavours . . . . . . . . . . . . . . . . . . . . . . 29
4.5.4
Package Basics . . . . . . . . . . . . . . . . . . . . . . 29
4.6
Using dselect . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.7
Debian on CD . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8
4.7.1
Build or Download the CD Image? . . . . . . . . . . . 32
4.7.2
Obtain The Debian Pseudo-Image Kit . . . . . . . . . 33
4.7.3
Listing of CD Image Contents . . . . . . . . . . . . . . 33
4.7.4
Download Debian Packages . . . . . . . . . . . . . . . 34
4.7.5
CD-ROM Packages from APT . . . . . . . . . . . . . . 35
Other Distributions . . . . . . . . . . . . . . . . . . . . . . . . 35 4.8.1
Moving From Red Hat . . . . . . . . . . . . . . . . . . 35
5 Installation
37
5.1
Hardware Compatibility . . . . . . . . . . . . . . . . . . . . . 38
5.2
Getting the Installation Media . . . . . . . . . . . . . . . . . . 39
5.3
5.2.1
Floppy Distribution . . . . . . . . . . . . . . . . . . . . 39
5.2.2
CD-ROM Distribution . . . . . . . . . . . . . . . . . . 39
5.2.3
LiveCD Distributions . . . . . . . . . . . . . . . . . . . 40
Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.3.1
SPARCStation Boot . . . . . . . . . . . . . . . . . . . 41
CONTENTS
v
5.3.2
BIOS Not Supporting CD-ROM . . . . . . . . . . . . . 41
5.4
5.5
5.6
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.4.1
Debian Install . . . . . . . . . . . . . . . . . . . . . . . 41
5.4.2
PGI Install . . . . . . . . . . . . . . . . . . . . . . . . 42
Base Install . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.5.1
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.5.2
Partitions . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.5.3
Configure Devices . . . . . . . . . . . . . . . . . . . . . 43
5.5.4
Networking . . . . . . . . . . . . . . . . . . . . . . . . 44
5.5.5
Time Zone . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.5.6
Floppy Boot Disk . . . . . . . . . . . . . . . . . . . . . 44
5.5.7
Reboot and User Accounts . . . . . . . . . . . . . . . . 45
5.5.8
Package Selections . . . . . . . . . . . . . . . . . . . . 45
5.5.9
EMail: Setup Exim . . . . . . . . . . . . . . . . . . . . 45
Installing Packages . . . . . . . . . . . . . . . . . . . . . . . . 46 5.6.1
Update To Newest Distribution . . . . . . . . . . . . . 46
5.6.2
Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.6.3
New Packages . . . . . . . . . . . . . . . . . . . . . . . 46
5.7
Kernel Upgrade: 2.2 to 2.4 . . . . . . . . . . . . . . . . . . . . 49
5.8
Initial Configurations . . . . . . . . . . . . . . . . . . . . . . . 49
5.9
Target Machines
. . . . . . . . . . . . . . . . . . . . . . . . . 50
5.9.1
Build (Wayfare) . . . . . . . . . . . . . . . . . . . . . . 50
5.9.2
Dell Latitude C600 (Inci)
5.9.3
Compaq Evo N610c (Axel) . . . . . . . . . . . . . . . . 57
5.9.4
Compaq Presario 5740AP (Friends) . . . . . . . . . . . 60
5.9.5
Dell Precision 650 (Caravan) . . . . . . . . . . . . . . . 63
. . . . . . . . . . . . . . . . 54
vi
CONTENTS 5.9.6
Dell OptiPlex GX270 (Modern) . . . . . . . . . . . . . 66
5.9.7
Dell OptiPlex GX150 (Fairmond) . . . . . . . . . . . . 70
5.9.8
Dell OptiPlex GX240 (Bigdaddy) . . . . . . . . . . . . 73
5.9.9
Dell OptiPlex GX260 (Vince) . . . . . . . . . . . . . . 75
5.9.10 Dell Optiplex GX260 (Festival) . . . . . . . . . . . . . 78 5.9.11 Dell Optiplex GX260 (Uramys1) . . . . . . . . . . . . . 82 5.9.12 Optima (Vivaldi) . . . . . . . . . . . . . . . . . . . . . 85 5.9.13 Dell Precision 620 (Brick) . . . . . . . . . . . . . . . . 89 5.9.14 Dell Precision 620 (Atom) . . . . . . . . . . . . . . . . 91 5.9.15 Optima WorkPro (Bach) . . . . . . . . . . . . . . . . . 93 5.9.16 Dell OptiPlex GXi 523M (Prefect) . . . . . . . . . . . 97 5.9.17 Dell Precision 420 MT (Cleveland) . . . . . . . . . . . 99 5.9.18 Dell Optiplex GX240 (Cultus) . . . . . . . . . . . . . . 100 5.9.19 Optima Super Vizon II 3600 Customised (Bartok) . . . 102 5.9.20 Dell Precision WorkStation 530 MT (Altrop) . . . . . . 108 5.9.21 Sun SPARCstation 5 (sun4m) (Cepheus) . . . . . . . . 111 5.9.22 Toshiba Satellite 1800 (HAX) . . . . . . . . . . . . . . 112 5.9.23 IBM ThinkPad (Hukz) . . . . . . . . . . . . . . . . . . 114 5.9.24 Dell Latitude C600 (Inco) . . . . . . . . . . . . . . . . 116 5.9.25 Dell OptiPlex GX1p (Plymouth) . . . . . . . . . . . . 119 5.9.26 Dell Precision WorkStation 420 MT (Velox) . . . . . . 121 5.9.27 Dell OptiPlex GX110 (Mint) . . . . . . . . . . . . . . . 123 5.9.28 Dell Latitude CPiD300XT (Inka) . . . . . . . . . . . . 125 5.9.29 Dell Latitude XPi (Rose) . . . . . . . . . . . . . . . . . 131 5.9.30 Generic 486/DX66 (Roast) . . . . . . . . . . . . . . . . 133 5.10 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
CONTENTS
vii
5.10.1 Books . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 6 Basic Survival 6.1
6.2
135
Basic Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 6.1.1
File and Directory Protections . . . . . . . . . . . . . . 135
6.1.2
Background Jobs . . . . . . . . . . . . . . . . . . . . . 135
System Information . . . . . . . . . . . . . . . . . . . . . . . . 136
7 Wajig: Administering Debian
137
7.0.1
History: Motivations For Wajig . . . . . . . . . . . . . 137
7.0.2
Installing Wajig . . . . . . . . . . . . . . . . . . . . . . 138
7.0.3
The Basic Debian Tools . . . . . . . . . . . . . . . . . 138
7.0.4
Wajig Overview . . . . . . . . . . . . . . . . . . . . . . 139
7.0.5
Getting Started with SUDO . . . . . . . . . . . . . . . 140
7.0.6
Available Packages . . . . . . . . . . . . . . . . . . . . 141
7.0.7
Finding Packages . . . . . . . . . . . . . . . . . . . . . 142
7.0.8
Installing Packages . . . . . . . . . . . . . . . . . . . . 144
7.0.9
Checking What’s Changed Before Installing . . . . . . 145
7.0.10 Installing Alien Packages . . . . . . . . . . . . . . . . . 145 7.0.11 Putting Packages on Hold . . . . . . . . . . . . . . . . 146 7.0.12 Building Packages . . . . . . . . . . . . . . . . . . . . . 146 7.0.13 Managing A Local Package Archive . . . . . . . . . . . 147 7.0.14 Mirroring With APT . . . . . . . . . . . . . . . . . . . 148 7.0.15 Pinning Distributions . . . . . . . . . . . . . . . . . . . 148 7.0.16 Cache Packages Locally
. . . . . . . . . . . . . . . . . 149
7.0.17 Reconfigure Packages . . . . . . . . . . . . . . . . . . . 149 7.0.18 Setting Default Applications . . . . . . . . . . . . . . . 149
viii
CONTENTS 7.0.19 Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 7.0.20 Managing Daemons or Services . . . . . . . . . . . . . 150 7.1
Other Commands . . . . . . . . . . . . . . . . . . . . . . . . . 151 7.1.1
Maintaining a Distribution Archive . . . . . . . . . . . 151
7.1.2
Synchronising Two Installations . . . . . . . . . . . . . 153
7.2
Package Information . . . . . . . . . . . . . . . . . . . . . . . 153
7.3
Alternative Applications . . . . . . . . . . . . . . . . . . . . . 154
7.4
Building Debian Packages . . . . . . . . . . . . . . . . . . . . 155
7.5
Packages: Roll Your Own . . . . . . . . . . . . . . . . . . . . 156 7.5.1
Prepackaging Development Environment . . . . . . . . 156
7.5.2
Initiating the Debian Package . . . . . . . . . . . . . . 158
7.5.3
Building the Debian Package: First Time . . . . . . . . 159
7.5.4
Adding the Package to Your Archive . . . . . . . . . . 159
7.5.5
Updating the Debian Package . . . . . . . . . . . . . . 160
8 Audio
163
8.1
Configuring Your Audio Chip . . . . . . . . . . . . . . . . . . 163
8.2
Audio Not Working . . . . . . . . . . . . . . . . . . . . . . . . 164
8.3
Audio File Information . . . . . . . . . . . . . . . . . . . . . . 164
9 AbiWord: Word Processor 9.1
165
Export to LaTeX . . . . . . . . . . . . . . . . . . . . . . . . . 165
10 APM: Power Management
167
11 Backup
171
11.1 Backup To Other Computers . . . . . . . . . . . . . . . . . . . 171 11.2 Legato NetWorker
. . . . . . . . . . . . . . . . . . . . . . . . 173
CONTENTS
ix
12 Command Line: Bash
177
13 Booting
179
13.1 Lilo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 13.1.1 Large Disks . . . . . . . . . . . . . . . . . . . . . . . . 180 13.1.2 Kernel Images . . . . . . . . . . . . . . . . . . . . . . . 180 13.2 GRUB: The Grand Unified Boot Loader . . . . . . . . . . . . 181 13.3 Secure Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 13.4 Dual Boot: Multiple Operating Systems . . . . . . . . . . . . 183 13.4.1 Dual Boot with MS-Windows/NT . . . . . . . . . . . . 183 13.4.2 Boot NT from LILO . . . . . . . . . . . . . . . . . . . 185 13.5 MS-Windows/NT or MS-Windows/2000 . . . . . . . . . . . . 185 13.6 The Booting From Floppy Alternative . . . . . . . . . . . . . 186 14 Cameras
187
14.1 Setup of HP Photosmart 320 . . . . . . . . . . . . . . . . . . . 187 14.2 Accessing Photos . . . . . . . . . . . . . . . . . . . . . . . . . 187 15 CD-ROM
189
15.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 15.1.1 CD Writer as a SCSI Device . . . . . . . . . . . . . . . 191 15.1.2 Docking Station CD-ROM . . . . . . . . . . . . . . . . 193 15.1.3 LG CED-8080B Problems . . . . . . . . . . . . . . . . 193 15.1.4 cdrecord Problem: Cannot . . . Bytes on /dev/zero . . . 194 15.2 CD Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 15.2.1 cdrdao . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 15.2.2 gcdmaster . . . . . . . . . . . . . . . . . . . . . . . . . 196
x
CONTENTS 15.2.3 xcdroast . . . . . . . . . . . . . . . . . . . . . . . . . . 197 15.2.4 MP3 Encoders
. . . . . . . . . . . . . . . . . . . . . . 197
15.3 CD Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 15.3.1 Duplicate Audio CD Using cdrdao 15.3.2 Duplicate Audio CD Using cdrecord
. . . . . . . . . . . 197 . . . . . . . . . . 199
15.3.3 Audio CD From Collection of MP3s . . . . . . . . . . . 199 15.4 Copy a CD image to Disk . . . . . . . . . . . . . . . . . . . . 200 15.5 CD Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 15.5.1 Intermediate Image . . . . . . . . . . . . . . . . . . . . 201 15.5.2 No Intermediate Image . . . . . . . . . . . . . . . . . . 201 15.5.3 Direct Copy Data CD from /dev/cdrom to SCSI burner 202 15.5.4 Copy Video CD . . . . . . . . . . . . . . . . . . . . . . 202 15.6 CD Mixed Data Audio . . . . . . . . . . . . . . . . . . . . . . 202 15.7 CD-RW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 15.8 Multi Session CDs . . . . . . . . . . . . . . . . . . . . . . . . 203 15.9 CD Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 16 Chinese
205
17 ChRoot: Multiple Distributions
207
18 Clock: An Explanation
209
18.0.1 Timezones . . . . . . . . . . . . . . . . . . . . . . . . . 209 18.0.2 System Clock Drift . . . . . . . . . . . . . . . . . . . . 209 18.0.3 chrony . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 18.0.4 Hardware Clock Drift . . . . . . . . . . . . . . . . . . . 213
CONTENTS 19 Commercial
xi 215
19.1 Corel WPO Office Alternative . . . . . . . . . . . . . . . . . . 215 20 Configuration
217
20.1 System Configuration in /etc . . . . . . . . . . . . . . . . . . . 217 21 CRON: Regular Tasks
219
22 CVS: Concurrent Versioning
221
22.1 Managing a Project . . . . . . . . . . . . . . . . . . . . . . . . 221 22.1.1 Initialising your own Repository . . . . . . . . . . . . . 221 22.1.2 Creating a New Project . . . . . . . . . . . . . . . . . 222 22.1.3 Adding Files to a Project . . . . . . . . . . . . . . . . 223 22.1.4 Updating Your Project Copy . . . . . . . . . . . . . . . 223 22.1.5 Identifying Changes . . . . . . . . . . . . . . . . . . . . 224 22.1.6 Removing Files from a Project . . . . . . . . . . . . . . 224 22.1.7 Committing Changes . . . . . . . . . . . . . . . . . . . 225 22.1.8 Tagging a Release . . . . . . . . . . . . . . . . . . . . . 225 22.2 Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 22.2.1 Location of Repository . . . . . . . . . . . . . . . . . . 225 22.2.2 Using ssh Rather Than rsh . . . . . . . . . . . . . . . . 226 22.2.3 Notify Users of Changes . . . . . . . . . . . . . . . . . 226 22.2.4 Ignoring Files . . . . . . . . . . . . . . . . . . . . . . . 226 22.3 CVS for NT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 23 Desktop
229
xii
CONTENTS
24 DIA: Charts and Diagrams
231
24.1 Basic Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 232 24.2 Walkthrough: Creating Simple Diagrams . . . . . . . . . . . . 232 24.3 Reference: Command Line Options . . . . . . . . . . . . . . . 234 24.4 Reference: The Tools Windows . . . . . . . . . . . . . . . . . 235 24.4.1 Pointer, View, and Text Objects . . . . . . . . . . . . . 235 24.4.2 Standard Shapes . . . . . . . . . . . . . . . . . . . . . 236 24.4.3 Handles and Connection Points . . . . . . . . . . . . . 236 24.4.4 Sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 24.4.5 Pen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 24.4.6 Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 24.5 Reference: The Right Mouse Button Menu . . . . . . . . . . . 238 24.5.1 The File Menu . . . . . . . . . . . . . . . . . . . . . . 238 24.5.2 The Edit Menu . . . . . . . . . . . . . . . . . . . . . . 242 24.5.3 The View Menu . . . . . . . . . . . . . . . . . . . . . . 242 24.5.4 The Select Menu . . . . . . . . . . . . . . . . . . . . . 242 24.5.5 The Objects Menu . . . . . . . . . . . . . . . . . . . . 243 24.5.6 The Tools Menu . . . . . . . . . . . . . . . . . . . . . . 243 24.5.7 The Dialogs Menu . . . . . . . . . . . . . . . . . . . . 244 24.6 Reference: Sample Sheets . . . . . . . . . . . . . . . . . . . . 244 24.6.1 Chronogram . . . . . . . . . . . . . . . . . . . . . . . . 244 24.6.2 Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 24.6.3 ER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 24.6.4 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . 245 24.6.5 FS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 24.6.6 GRAFCET . . . . . . . . . . . . . . . . . . . . . . . . 246
CONTENTS
xiii
24.6.7 Ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 24.6.8 Networks
. . . . . . . . . . . . . . . . . . . . . . . . . 247
24.6.9 Pneumatic/Hydraulic . . . . . . . . . . . . . . . . . . . 247 24.6.10 SADT . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 24.6.11 Sybase . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 24.6.12 UML . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 24.7 Walkthrough: Creating Your Own Shapes . . . . . . . . . . . 249 24.7.1 Simple Example . . . . . . . . . . . . . . . . . . . . . . 249 24.7.2 Shape Elements . . . . . . . . . . . . . . . . . . . . . . 250 24.7.3 SVG Support . . . . . . . . . . . . . . . . . . . . . . . 252 24.7.4 Sheet Elements . . . . . . . . . . . . . . . . . . . . . . 252 24.7.5 Installing New Sheets . . . . . . . . . . . . . . . . . . . 252 24.8 Reference: The dia Save Format . . . . . . . . . . . . . . . . . 252 24.9 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 252 25 Directories: Linux Folders
255
25.1 The Standard Linux Directory Structure . . . . . . . . . . . . 255 26 Disks
257
26.1 New Disk Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 257 26.2 Ext2 to Ext3 . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 26.3 Disk Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 257 27 Documentation
261
27.1 Debian doc-central . . . . . . . . . . . . . . . . . . . . . . . . 261 28 Email
263
28.1 Setting up EMail . . . . . . . . . . . . . . . . . . . . . . . . . 263
xiv
CONTENTS 28.1.1 Exim . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 28.2 Retrieving and Filtering Email . . . . . . . . . . . . . . . . . . 264 28.2.1 Fetchmail: Collect Mail from Remote Hosts . . . . . . 264 28.2.2 Procmail to Filter and Split Email . . . . . . . . . . . 266 28.2.3 IMAP: Mail Server . . . . . . . . . . . . . . . . . . . . 267 28.2.4 POP Mail Server . . . . . . . . . . . . . . . . . . . . . 267 28.3 Reading Email
. . . . . . . . . . . . . . . . . . . . . . . . . . 268
28.3.1 Mutt . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 28.3.2 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 28.4 Email Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 28.4.1 Grepmail: Search mail archives . . . . . . . . . . . . . 269 28.4.2 EMail Attachments . . . . . . . . . . . . . . . . . . . . 270 28.4.3 MS-TNEF attachments . . . . . . . . . . . . . . . . . . 270 28.4.4 Uuencode and Uudecode in Mail
. . . . . . . . . . . . 270
28.4.5 Mailing Lists . . . . . . . . . . . . . . . . . . . . . . . 270 28.5 Spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 28.6 SMTP Direct . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 29 Eye of Gnome: Image Viewer
273
30 Evolution: GNU Personal Information Manager
275
30.1 Managing Email . . . . . . . . . . . . . . . . . . . . . . . . . . 275 30.1.1 Using Virtual Folders . . . . . . . . . . . . . . . . . . . 275 30.2 Contacts and Address Book . . . . . . . . . . . . . . . . . . . 276 30.3 Managing Your Calendar . . . . . . . . . . . . . . . . . . . . . 276 30.4 Tracking Your Tasks . . . . . . . . . . . . . . . . . . . . . . . 276
CONTENTS
xv
31 File Systems
277
32 Firewalls
279
32.1 IPMASQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 32.2 IPCHAINS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 33 Floppy Disks
283
33.1 Floppy Drive Access Permissions . . . . . . . . . . . . . . . . 283 33.2 Format a Floppy . . . . . . . . . . . . . . . . . . . . . . . . . 283 33.3 Using DOS-Like Commands . . . . . . . . . . . . . . . . . . . 284 33.4 Mounting Floppy Disk Device . . . . . . . . . . . . . . . . . . 284 34 Fonts: X Window System
287
34.1 Setting Up Fonts in X . . . . . . . . . . . . . . . . . . . . . . 287 34.2 Fonts are too Large . . . . . . . . . . . . . . . . . . . . . . . . 289 35 Ghemical: Chemical Modelling
291
36 GIMP: Image and Photo Manipulation
293
36.1 Remove Red Eye . . . . . . . . . . . . . . . . . . . . . . . . . 293 36.2 Image Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 36.3 Gimp Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 295 37 Glade: GUI Builder
297
37.1 Using Glade . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 37.2 Glade Walkthroughs . . . . . . . . . . . . . . . . . . . . . . . 299 37.2.1 Building the GUI . . . . . . . . . . . . . . . . . . . . . 299 37.2.2 Building the C Code . . . . . . . . . . . . . . . . . . . 307 37.2.3 Using Libglade C . . . . . . . . . . . . . . . . . . . . . 309
xvi
CONTENTS 37.2.4 Using Libglade with Python . . . . . . . . . . . . . . . 309 37.2.5 Using Libglade with Perl . . . . . . . . . . . . . . . . . 310 37.3 Glade Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.3.1 Writing Your Code . . . . . . . . . . . . . . . . . . . . 311 37.3.2 Command Line Options . . . . . . . . . . . . . . . . . 312 37.3.3 The Menus and Toolbar . . . . . . . . . . . . . . . . . 313 37.3.4 Project Options . . . . . . . . . . . . . . . . . . . . . . 317 37.3.5 Widget Properties . . . . . . . . . . . . . . . . . . . . 320 37.3.6 Widget Palettes . . . . . . . . . . . . . . . . . . . . . . 320 37.3.7 The Glade Save Format . . . . . . . . . . . . . . . . . 321 37.4 Glade Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 321 37.5 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 322 37.6 Using Napster . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 37.7 Gnome Hack . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
38 Gnome: The Desktop
327
38.1 Using Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 38.1.1 Tear-Off Menus . . . . . . . . . . . . . . . . . . . . . . 328 38.1.2 Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . 329 38.2 Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 38.2.1 Floating Toolbars . . . . . . . . . . . . . . . . . . . . . 330 38.3 Dialogues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 38.3.1 Filename Completion and Hidden Files . . . . . . . . . 330 38.4 Gnome Applications . . . . . . . . . . . . . . . . . . . . . . . 330 38.4.1 Other Applications . . . . . . . . . . . . . . . . . . . . 332 38.5 Desktop Managers . . . . . . . . . . . . . . . . . . . . . . . . 334
CONTENTS
xvii
38.6 Window Managers . . . . . . . . . . . . . . . . . . . . . . . . 334 38.7 Other Desktops . . . . . . . . . . . . . . . . . . . . . . . . . . 334 38.7.1 KDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 38.7.2 XFCE . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 38.8 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . 336 38.8.1 Locked File . . . . . . . . . . . . . . . . . . . . . . . . 336 38.9 Gnome Resources . . . . . . . . . . . . . . . . . . . . . . . . . 336 38.9.1 Gnome Books . . . . . . . . . . . . . . . . . . . . . . . 336 39 GnuCash: Finances
337
40 Gnumeric: Spreadsheet
339
40.1 Other Spreadsheets . . . . . . . . . . . . . . . . . . . . . . . . 341 40.1.1 The StarOffice Calc . . . . . . . . . . . . . . . . . . . . 341 40.1.2 KSpread . . . . . . . . . . . . . . . . . . . . . . . . . . 341 40.1.3 ApplixWare Spreadsheet . . . . . . . . . . . . . . . . . 341 41 GQView: Viewing Images
345
42 Graphics
347
42.1 Graphics Editors . . . . . . . . . . . . . . . . . . . . . . . . . 347 42.1.1 Xfig: Vector Graphics Editor
. . . . . . . . . . . . . . 348
42.2 Common Operations . . . . . . . . . . . . . . . . . . . . . . . 349 42.2.1 Charts and Plots . . . . . . . . . . . . . . . . . . . . . 349 42.2.2 Screen Capture . . . . . . . . . . . . . . . . . . . . . . 350 42.2.3 Thumbnails . . . . . . . . . . . . . . . . . . . . . . . . 351 42.2.4 Transparent PNG Images . . . . . . . . . . . . . . . . 351 42.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
xviii
CONTENTS 42.3.1 PostScript . . . . . . . . . . . . . . . . . . . . . . . . . 351
43 Grip: CD Audio Extraction
353
44 Groups: Managing Access Permissions
359
45 HTML Editors
363
45.1 Bluefish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 46 ImageMagick
365
47 Initialisations on Booting
367
47.1 Run Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 47.2 Initialisation Scripts . . . . . . . . . . . . . . . . . . . . . . . 369 47.3 CTRL-ALT-DEL: The Three Finger Salute . . . . . . . . . . . 370 47.4 Terminals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 48 Java
373
48.1 Install Sun Java . . . . . . . . . . . . . . . . . . . . . . . . . . 373 48.2 Java Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . 374 48.2.1 Mozilla Java Plugin . . . . . . . . . . . . . . . . . . . . 374 49 Jigdo: Build CD-ROM Images
377
50 KDE: Desktop Management
379
51 Kernel: Rolling Your Own
381
51.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . 382 51.2 Kernel Configuration . . . . . . . . . . . . . . . . . . . . . . . 383 51.3 Kernel Modules . . . . . . . . . . . . . . . . . . . . . . . . . . 385
CONTENTS
xix
51.4 Compiling the Kernel . . . . . . . . . . . . . . . . . . . . . . . 385 51.5 Installing the Kernel . . . . . . . . . . . . . . . . . . . . . . . 385 51.6 Lilo Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 387 51.7 Kernel Versions . . . . . . . . . . . . . . . . . . . . . . . . . . 387 51.8 Latest Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 51.9 Why make-kpkg? . . . . . . . . . . . . . . . . . . . . . . . . . 388 51.10Loading Kernel Modules . . . . . . . . . . . . . . . . . . . . . 389 52 Keyboard
391
52.1 Mapping a Key . . . . . . . . . . . . . . . . . . . . . . . . . . 391 53 Konqueror: The KDE File Manager
393
54 LaTeX
395
54.1 LaTeX Documentation . . . . . . . . . . . . . . . . . . . . . . 395 54.2 Generating LaTeX . . . . . . . . . . . . . . . . . . . . . . . . 395 54.3 Creating LaTeX Documents . . . . . . . . . . . . . . . . . . . 396 54.3.1 Using LyX . . . . . . . . . . . . . . . . . . . . . . . . . 396 54.3.2 Using Emacs . . . . . . . . . . . . . . . . . . . . . . . 396 54.4 Processing a LaTeX Document
. . . . . . . . . . . . . . . . . 396
54.5 LaTeX Tips and Tricks . . . . . . . . . . . . . . . . . . . . . . 397 54.5.1 Bibliography Starts on a New Page . . . . . . . . . . . 397 54.6 TeX Capacity Exceeded . . . . . . . . . . . . . . . . . . . . . 397 55 Login 55.1 All Capitals Login
399 . . . . . . . . . . . . . . . . . . . . . . . . 399
55.2 Login Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 55.3 Midnight Commander . . . . . . . . . . . . . . . . . . . . . . 401
xx
CONTENTS 55.4 Gnome Memory Blocks . . . . . . . . . . . . . . . . . . . . . . 401
56 Magellan: KDE Personal Information Manager
403
57 Modems
405
57.1 Silence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 57.2 No Dial Tone . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 57.3 Chat Script Giving up Too Early . . . . . . . . . . . . . . . . 406 58 MSWindows
407
58.1 Wine: Emultaing MS-Windows . . . . . . . . . . . . . . . . . 407 58.2 Citrix: MSWindows Under Linux . . . . . . . . . . . . . . . . 407 58.2.1 Screenshot . . . . . . . . . . . . . . . . . . . . . . . . . 408 58.2.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . 408 59 Music
411
60 MySQL
413
60.0.3 MySQL Root Password . . . . . . . . . . . . . . . . . . 414 60.0.4 Creating New Database . . . . . . . . . . . . . . . . . 414 60.0.5 Create a New User . . . . . . . . . . . . . . . . . . . . 416 60.0.6 Remote Host Access . . . . . . . . . . . . . . . . . . . 417 60.0.7 Remote User Permissions . . . . . . . . . . . . . . . . . 417 60.0.8 Basic MySQL . . . . . . . . . . . . . . . . . . . . . . . 418 61 Nautilus: Navigating Folders—Near and Far
421
61.1 Finding Your Way . . . . . . . . . . . . . . . . . . . . . . . . 421 61.2 Browsing HTML Documents . . . . . . . . . . . . . . . . . . . 422 61.3 Nautilus CD Creator . . . . . . . . . . . . . . . . . . . . . . . 423
CONTENTS
xxi
61.4 Browsing Remote Sites . . . . . . . . . . . . . . . . . . . . . . 423 62 Networks
425
62.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 62.2 Network Configuration . . . . . . . . . . . . . . . . . . . . . . 426 62.2.1 Graphical Tools . . . . . . . . . . . . . . . . . . . . . . 426 62.2.2 Manual Setup . . . . . . . . . . . . . . . . . . . . . . . 426 62.2.3 Neighborhood Table Overflow . . . . . . . . . . . . . . 427 62.2.4 Example Configurations . . . . . . . . . . . . . . . . . 427 62.3 Wireless Network . . . . . . . . . . . . . . . . . . . . . . . . . 429 62.4 Domain Name Searching . . . . . . . . . . . . . . . . . . . . . 430 62.5 Hostname Changes . . . . . . . . . . . . . . . . . . . . . . . . 431 62.6 Ports and Services . . . . . . . . . . . . . . . . . . . . . . . . 431 62.7 Getting the Cabling Right . . . . . . . . . . . . . . . . . . . . 433 62.8 IP Forwarding: Home Networks . . . . . . . . . . . . . . . . . 433 62.9 Multiple Ethernet Cards . . . . . . . . . . . . . . . . . . . . . 436 63 NFS: Network File System
437
63.1 Setting Up NFS . . . . . . . . . . . . . . . . . . . . . . . . . . 437 63.2 Export Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 63.3 Root Access On NFS . . . . . . . . . . . . . . . . . . . . . . . 439 64 NT File System
441
65 OpenOffice
443
65.1 OpenOffice Writer
. . . . . . . . . . . . . . . . . . . . . . . . 443
65.2 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 65.3 OpenOffice Impress . . . . . . . . . . . . . . . . . . . . . . . . 445
xxii
CONTENTS
66 Oracle: Commercial Database
447
66.1 Obtaining the Distribution . . . . . . . . . . . . . . . . . . . . 447 66.2 Oracle User and Groups . . . . . . . . . . . . . . . . . . . . . 447 66.3 Oracle Installation . . . . . . . . . . . . . . . . . . . . . . . . 448 67 Partitions
449
67.1 Sample Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 67.2 Suggested Partitioning . . . . . . . . . . . . . . . . . . . . . . 450 67.3 Repartitioning MS-Windows . . . . . . . . . . . . . . . . . . . 452 68 Passwords
455
68.1 Password File Sharing . . . . . . . . . . . . . . . . . . . . . . 455 68.1.1 Using rdist . . . . . . . . . . . . . . . . . . . . . . . . . 456 68.1.2 Simple tar . . . . . . . . . . . . . . . . . . . . . . . . . 456 68.1.3 Using NIS . . . . . . . . . . . . . . . . . . . . . . . . . 457 69 PPP: Networking Over Modems
459
69.1 modemlights applet . . . . . . . . . . . . . . . . . . . . . . . . 460 70 Presentations
461
70.1 Beamer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 70.2 Prosper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 70.3 OpenOffice Impress . . . . . . . . . . . . . . . . . . . . . . . . 461 70.4 KPresenter
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
71 Printing 71.1 CUPS - Common Unix Printing System
463 . . . . . . . . . . . . 463
71.1.1 Add Printing to New Host . . . . . . . . . . . . . . . . 463
CONTENTS
xxiii
71.1.2 Using the Web Interface . . . . . . . . . . . . . . . . . 464 71.1.3 Installing a HP PSC 2210 . . . . . . . . . . . . . . . . 465 71.1.4 Enabling a Printer . . . . . . . . . . . . . . . . . . . . 465 71.1.5 CUPS Command Line Interfaces . . . . . . . . . . . . 465 71.2 Using lprng to Print on Remote Hosts . . . . . . . . . . . . . 466 71.3 Using rlpr to Print on Remote Hosts . . . . . . . . . . . . . . 467 72 Python
469
72.1 Python Documentation . . . . . . . . . . . . . . . . . . . . . . 469 72.2 Python and R: Python Interfaces to R . . . . . . . . . . . . . 470 72.2.1 Installing RSPython . . . . . . . . . . . . . . . . . . . 470 72.2.2 Installing RPy . . . . . . . . . . . . . . . . . . . . . . . 471 73 R: Statistical Software
475
73.1 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 74 Rsync: Remote Files
481
74.1 Rsync Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 75 Samba
483
76 Scanning
485
76.1 Setup HP PSC 2210 . . . . . . . . . . . . . . . . . . . . . . . 485 76.2 Scanning Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 486 77 Science
487
77.1 Chemistry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 77.1.1 Periodic Tables . . . . . . . . . . . . . . . . . . . . . . 487
xxiv 78 Security
CONTENTS 489
78.1 Booting Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 78.2 Checking Security with Nessus . . . . . . . . . . . . . . . . . . 489 78.3 Check Security with Chkrootkit . . . . . . . . . . . . . . . . . 490 78.4 Identify Portscanners . . . . . . . . . . . . . . . . . . . . . . . 494 78.5 Packages to Avoid . . . . . . . . . . . . . . . . . . . . . . . . . 494 78.6 OpenPGP and Keys . . . . . . . . . . . . . . . . . . . . . . . 496 78.7 Securing Your Network . . . . . . . . . . . . . . . . . . . . . . 499 78.8 Identifying Your System? . . . . . . . . . . . . . . . . . . . . . 501 79 Sketch
503
80 Sound Recording
505
80.1 Required Software . . . . . . . . . . . . . . . . . . . . . . . . . 505 80.2 Hardware Connections . . . . . . . . . . . . . . . . . . . . . . 506 80.3 Mixer Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 80.4 Using Gramofile . . . . . . . . . . . . . . . . . . . . . . . . . . 507 80.5 Recommended Recording Process . . . . . . . . . . . . . . . . 508 80.6 Recordings Using the Gnome Sound Recorder . . . . . . . . . 509 80.7 Using Command Line Sound-Recorder . . . . . . . . . . . . . 509 80.8 Using Command Line Sox . . . . . . . . . . . . . . . . . . . . 509 81 Spell
511
82 SPlus: Statistical Software
513
83 Spruce: Email
515
CONTENTS
xxv
84 SSH: Secure Communications
517
84.1 Versions of SSH . . . . . . . . . . . . . . . . . . . . . . . . . . 517 84.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 84.3 Remote Host Authentication . . . . . . . . . . . . . . . . . . . 518 84.4 Simple Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 84.5 Public and Private Keys . . . . . . . . . . . . . . . . . . . . . 519 84.6 SSH Agents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 84.7 DSA Key Generation . . . . . . . . . . . . . . . . . . . . . . . 521 84.8 Changing Your Passphrase . . . . . . . . . . . . . . . . . . . . 521 84.9 SSH and Rsync . . . . . . . . . . . . . . . . . . . . . . . . . . 522 84.10SSH and the X Window System . . . . . . . . . . . . . . . . . 522 84.11SSH Tunnelling . . . . . . . . . . . . . . . . . . . . . . . . . . 523 84.12SSH Access Denied . . . . . . . . . . . . . . . . . . . . . . . . 524 84.13SSH Terminal in a Browser . . . . . . . . . . . . . . . . . . . . 524 84.14SSH Version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 85 SUDO: Root Access
527
86 Swap
529
87 Themes
531
87.1 Enlightenment . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 88 USB
533
88.1 Mass Storage Devices . . . . . . . . . . . . . . . . . . . . . . . 534 88.1.1 HP Photosmart 320 . . . . . . . . . . . . . . . . . . . . 535 88.2 Mass Storage Devices (DVD Writer) . . . . . . . . . . . . . . 535 88.3 USB Printer: HP LaserJet 1200 . . . . . . . . . . . . . . . . . 537
xxvi
CONTENTS
88.4 USB Printer: HP PSC2210 . . . . . . . . . . . . . . . . . . . . 537 89 Video
539
89.1 Viewing Video . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 89.2 DVD Videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 89.2.1 Xine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 89.2.2 Ogle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 89.2.3 DVD Sound Track . . . . . . . . . . . . . . . . . . . . 540 89.3 Video Backups . . . . . . . . . . . . . . . . . . . . . . . . . . 542 89.4 Command Line Video Tools . . . . . . . . . . . . . . . . . . . 543 89.5 DVD-AUDIO . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 89.6 Video from Photos . . . . . . . . . . . . . . . . . . . . . . . . 545 89.7 nVidia Video Driver . . . . . . . . . . . . . . . . . . . . . . . 545 90 Web: Serving, Accessing, and Mirroring
549
90.1 Browsing the Web . . . . . . . . . . . . . . . . . . . . . . . . . 549 90.1.1 Epiphany . . . . . . . . . . . . . . . . . . . . . . . . . 549 90.1.2 Galeon . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 90.1.3 Mozilla . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 90.1.4 Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 90.2 Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 90.2.1 User Web Pages . . . . . . . . . . . . . . . . . . . . . . 552 90.2.2 Bad Behaviour on Missing / . . . . . . . . . . . . . . . 552 90.2.3 Password Protect Web Files . . . . . . . . . . . . . . . 552 90.2.4 Renew SSL Certificate . . . . . . . . . . . . . . . . . . 554 90.2.5 Compressed HTML . . . . . . . . . . . . . . . . . . . . 554 90.2.6 Web Log Summaries . . . . . . . . . . . . . . . . . . . 554
CONTENTS
xxvii
90.2.7 Server Side Includes . . . . . . . . . . . . . . . . . . . 555 90.2.8 Identifying the Web Server . . . . . . . . . . . . . . . . 556 90.3 Mirror Websites . . . . . . . . . . . . . . . . . . . . . . . . . . 556 91 Word: Processing and Printing
557
92 X: The Window System
559
92.1 Hand Crafting your XF86Config . . . . . . . . . . . . . . . . . 560 92.2 The Basic X Window System Architecture . . . . . . . . . . . 562 92.3 Multiple X Window System Users, One Console . . . . . . . . 567 92.4 Getting Started with Gnome . . . . . . . . . . . . . . . . . . . 567 92.5 GDM Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 92.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 92.7 Wheel Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 92.8 Window Managers . . . . . . . . . . . . . . . . . . . . . . . . 569 92.9 XFree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 93 XML
571
93.1 XSLT Processors . . . . . . . . . . . . . . . . . . . . . . . . . 571
xxviii
CONTENTS
Preface Welcome to the world of GNU/Linux, liberating the computing desktop from the shackles of proprietary interests. The aim of this book is to get you up to speed with GNU/Linux and to deliver a fun and productive environment. It guides you through the many different regions of a GNU/Linux system with a focus on getting your desktop environment to do what you want it to do. It is comprehensive with basic support for the user who installs and maintains the system themselves (whether in the home, office, club, or school). It provides insights and stepby-step procedures that deal with specific tasks in setting your system up and maintaining it. The book covers many of the core features of a GNU/Linux system and you will gain the knowledge to enjoy and use one of the most comprehensive and useful developments in the history of computing. The details in this book are presented in the context of Debian GNU/Linux— the most open of the GNU/Linux distributions and the distribution setting the standards for free software and collaborative developments. In general the details translate directly to RedHat and other standard distributions of GNU/Linux. A growing number of the applications (including StarOffice, AbiWord, The Gimp, Dia and gPhoto, to name just a few) are cross-platform developments and run also under MS-Windows. The chapters that cover these applications in this book will also generally apply to those versions. The structure of this on-line version of the book is basically alphabetical. Each individual chapter aims to be a standalone reference. The book includes an overview of GNU/Linux and its history, a guide to installing GNU/Linux, introductions to the suite of GNU/Linux desktop productivity tools, and recipes for tuning specific parts of a GNU/Linux system. The book begins with an introduction to the world of GNU/Linux, Free Software, and the Open Source Software movement. Free software equals, and often surpasses, the commercial offerings for the same or equivalent functionxxix
xxx
Preface
ality. We present historical and philosophical perspectives. Chapter 4 briefly reviews GNU/Linux, the various distributions, the licensing issues, and the freedom that GNU/Linux delivers. There are many ways of obtaining GNU/Linux and we only cover the most common approaches. Chapter 5 provides an overview of installing Debian with detailed examples for a number of hardware platforms. Chapter 6 is a brief introduction to some of the essential GNU/Linux utilities that you are likely to come across soon. The Debian packaging system used to manage (and take all of the hard work out of maintaining) packages is described in Chapter 4.4. Setting up the X Window System is covered in Chapter 92. By this stage you will have a system ready to take full advantage of. On a more technical level Chapter 51 shows how simple it is to compile your own kernel to suit your hardware requirements. The remaining alphabetical chapters cover the Desktop Environment and Debian GNU/Linux administration. All of the major classes of desktop tools are covered, including word processing, spreadsheets, personal information management, graphics, databases and, of course, games. Also included are chapters covering some of the tools for developers, including emacs and glade. The aim is to set you well on the road to using these tools at a level that is sufficient for many users. Of course, each tool itself deserves, and often has available for it, a book or extensive manuals. The administration chapters cover very many different topics that let you tune your GNU/Linux system to suit your needs. Not everything here is relevant to everybody, but it brings together many recipes for many of the typical tasks that users sometimes need to know about, again without going into exhaustive detail (which is available elsewhere if you need it or are interested). So sit back and enjoy the freedom of free software and become part of the community that is making computers and the applications they run a benefit to society world wide, rather than a costly privilege. Conventions Used Throughout The Book Typography Screen shots from the Galeon web browser are based on Galeon at 700x600. What’s In A Name
xxxi The phrase Microsoft Windows (and less informatively just Windows) usually refers to the whole of the popular operating systems, irrespective of which version of Microsoft Windows is being run, unless the version is important. But Microsoft Windows is just one of many windowing systems available, and indeed, Microsoft Windows came on to the screen rather later than the pioneering Apple Macintosh windowing system and the Unix windowing systems. We will simply refer to all varieties of Microsoft’s windowing systems (Windows 95/98/NT/2000/XP) as MS-Windows. If the particular version is important it will be referred to as MS-Windows/XP, for example. We use the phrase GNU/Linux to refer to the GNU environment and the GNU and other applications running in that environment on top of the Linux operating system kernel. Similarly, GNU/Hurd refers to the GNU environment and the GNU and other applications running in that environment on top of the GNU Hurd operating system kernel. Debian is a complete distribution which includes many applications based around a particular choice of operating system kernel (usually either GNU/Linux or GNU/Hurd). Where the particular kernel is not important we will refer to whole system as Debian. The common windowing system used in Debian is a separate, but integral, component that we will refer to as the X Window System. Screen Shots Through out the document screen shots are presented using a variety of Gnome and KDE themes. The theme specifies what things look like inside the windows that an application displays, and now also tend to specify what the window frame looks like—that is, the area immediately surrounding the application’s window. There is an endless variety of themes to suit your own preferences. Some favourites include the E-efm-GTK+ Gnome theme and the QN-X11 and Crux Sawfish themes. Refer to the discussion of themes in Chapter 87 for details, if interested. About This Book The book is copyright by the author ([email protected]) but released under a license which allows it to be available somewhat freely. You are welcome to read it on-line and even to download and print the whole book yourself. You can also download the book (either PDF or HTML) to have a local copy of the book on your system and make it available for others to access either locally or even globally. However, you are required to retain the
xxxii
Preface
copyright attributions and you are required to give appropriate attribution for any material you use from the book. Also, by taking a copy, or even simply using the book, you should feel obliged to contribute to the book in some way, by sending corrections, comments, updates, suggestions, or even whole new chapters, to me at mailto:Graham. [email protected]. Citations Debian Weekly News pointed to this book in their 8th July 2003 edition.
Chapter 1 Quick Start It is quite reasonable to want to skip all the details and to simply get started with GNU/Linux. In this chapter we will get you up and running with GNU/Linux real soon! The first step is to obtain a LiveCD distribution, such as Morphix, from http://www.morphix.org. See Section 5.2.3 for details and Section 4.1 for other distributions of Debian GNU/Linux. Boot your computer from this CD and you will have a running system (but not yet installed). Then ask Morphix to install itself. You will end up with an installed Debian GNU/Linux system.
1
2
Quick Start
Chapter 2 Advocacy Why bother with open source software when Microsoft has the market sewn up? The cost of GNU/Linux (it is freely available to whoever wants it) is not always the primary issue! Usability, reliability, security, and developerability are often just as, and for different users even more, important issues. GNU/Linux offers a value proposition that money can not buy. vestment in GNU/Linux is really an investment in human beings to bring a better and coordinated solution to the organisation. A that in the long run delivers more for less, without the traditional proprietary systems.
The inworking solution tie-in of
We begin with a review of major decisions by governments and organisations the world over, then review some of the key benefits.
2.1
Linux Adopters
The Swiss taxation office distribute a CDROM with the open source office suite called Open Office. On the CDROM is an Open Office version of the Tax form. Tax payers fill in the form and lodge their returns electronically. In June 2003, at the Net World Order conference, held at the CeBIT trade show in New York City, and sponsored by the Business Council for the United Nations, Bruno Lanvin from the World Bank said These countries need cheap and efficient technology to make the giant leaps necessary to catch up with the rest of the world. Many 3
4
Advocacy are now using Linux, which looks to become the No. 1 operating system in China and India soon.
As of October, 2003, many local governments in Germany are taking the step toward GNU/Linux
Usability Usability has been a problem for GNU/Linux for a long time. It has not been comparable to the ease of use of the MS-Windows system in terms of being a common desktop environment. As we demonstrate in this book though this issue has been well addressed and the time is now right for Debian GNU/Linux on the desktop.
Reliability GNU/Linux is a very stable operating system and system crashes are virtually unknown. GNU/Linux, like Unix before it, is designed to be a multi-user, shared system. Simply because one user of the system runs an application that crashes, other users of the same system should not be affected. Also, most GNU/Linux applications have been in open development for many years with many developers working on and looking over the code. Bugs of course are not unknown, but they are usually quickly fixed within GNU/Linux, leading to a very reliable system.
Security The issue of security is crucial and will continue to grow as an important concern for users. An article in the 27 August 2001 issue of Interactive Week by Rob Fixmer recalls a 1998 interview with then Symantec CEO Gordon Eubanks: Everybody can see what’s under the hood, so we’re on equal footing with hackers. With proprietary systems intruders often
2.1 Linux Adopters
5
have illegal means of learning things about the underlying code that are superior to the legal information at our disposal—even though we get excellent cooperation and support from Microsoft. Gartner Group’s John Pescatore on 19 September 2001 had the following to say in an advisory from the Gartner web site1 (emphasis is mine): Gartner recommends that enterprises hit by both Code Red and Nimda immediately investigate alternatives to IIS, including moving Web applications to Web server software from other vendors, such as iPlanet and Apache. Although these Web servers have required some security patches, they have much better security records than IIS and are not under active attack by the vast number of virus and worm writers. Gartner remains concerned that viruses and worms will continue to attack IIS until Microsoft has released a completely rewritten, thoroughly and publicly tested, new release of IIS. Sufficient operational testing should follow to ensure that the initial wave of security vulnerabilities every software product experiences has been uncovered and fixed. This move should include any Microsoft .NET Web services, which requires the use of IIS. Gartner believes that this rewriting will not occur before year-end 2002 (0.8 probability) Any one can scan the GNU/Linux code for vulnerabilities (and for inefficiencies and bugs) and as they are discovered the solutions quickly become available for all to access. Of course, the unscrupulous can also scan the code for opportunities to attack a system, unlike proprietary code where only a few have access to the source code. But would you prefer security by obscurity or security by peer review? It is a choice!
Developerability MS-Windows provides many good environments for the development of software. However, GNU/Linux, and Unix before it, has a long tradition of providing powerful environments for software development. Sophisticated graphical interactive development environments (IDEs) were developed on 1
Actual document obtained from http://www3.gartner.com/DisplayDocument?doc_ cd=101034
6
Advocacy
Unix but took of on the Apple Macintosh and particularly on MS-Windows. However, the focus is beginning to again turn to GNU/Linux as the most flexible open source, free software, and commercial development environment.
Chapter 3 History: Unix, GNU, Gnome A brief review of the history of Unix will place in context much of the terminology and philosophy of this operating system. Terms like Linux, GNU, Unix, Gnome, Free Software, and Open Source Software get bandied around, often with little understanding and usually with much misunderstanding. A fundamental misunderstanding is the relationship between Linux and operating systems. Linux is the low level code that interacts with and controls the hardware of the computer (whether it is an Intel 486, Pentium, Sun Sparc, or a Merced). This is the kernel of the operating system, providing routines to help applications talk to each other, allowing many applications to share the CPU at the same time, and managing the use of memory, allowing many different applications to run at the same time without interfering with other applications. Linus Torvalds wrote the first Linux kernel in 1991 and it continues to be actively developed today by Linus and a core team of international developers. While the kernel is crucial, it is the larger suite of software that sits on top of the kernel that provides the functional operating system. Most of the software applications at this level come from the GNU Project. These tools include the command line utilities like ls, cp, find, bash, and the compilers like gcc. This collection of applications is usually considered to be the actual operating system and hence we refer to the operating system as GNU/Linux in recognition of the GNU software coupled with the Linux kernel. GNU/HURD is an alternative operating system using the GNU software with the HURD kernel being developed by the GNU Project. Sitting on top of this command-line level of the operating system is what we 7
8
History: Unix, GNU, Gnome
might refer to as the end user level of the operating system. This is typically a graphical user interface (GUI) aiming to provide an intuitive, easy to use system for both the general, non-technical user and the power user. Such an interface is typically an application that sits on top of and makes considerable use of the operating system. For GNU/Linux this is the X Window System. The Window System provides a platform for GUI-based applications. Other applications sit on top of the Window System to provide integrated platforms with a common look and feel. Gnome, another GNU project, is one such popular platform. All Gnome applications have a similar look and share many components and can communicate with each other. KDE is a popular alternative to Gnome and while it is not one I use, I will try to include information about it whenever I can. In this chapter we briefly review the history of Unix, GNU Software, the GNU/Linux Operating System, Gnome, and Free and Open Source Software and Documentation.
3.1
Unix
GNU/Linux is fashioned on Unix. Unix dates from 1969 when Ken Thompson at Bell Telephone Laboratories initiated work on this new operating system. Others involved in the project included Dennis Ritchie and Brian Kernighan. The name Unix is a pun on an alternative operating system of the time called MULTICS (MULTiplexed Information and Computing Service). MULTICS was developed by The Massachusetts Institute of Technology, General Electric and Bell Labs. Unix was originally spelt UNICS, an acronym for UNiplexed Information and Computing Service! Some of the basic ideas introduced by Multics and then Unix were the tree structured file system, a program for command interpretation (called the shell), the structure and nature of text files and the semantics of I/O operations. Some of the philosophy that rose with the development of Unix included the desire to write programs that performed one task and to do it well, to write programs that worked together to perform larger tasks, and to write programs that communicated with each other using text from one program to the other. The advantages of Unix were quickly identified by many and quite a few varieties of Unix emerged over time. Sun Microsystems have pioneered many of
3.1 Unix
9
the developments in Unix, followed by such greats as the old Digital Equipment Corporation (DEC, which was swallowed by Compaq, which was swallowed by Hewlett-Packard), Silicon Graphics Incorporated (SGI), International Business Machines (IBM), and Hewlett-Packard (HP). A variety of flavours have existed, including SunOS, Solaris, Ultrix, Irix, BSD, System V, HPUX, and so on. Although computer programs written for one version of Unix could sometimes be ported to other versions, it was not always an easy task. The diversity of Unix implementations (more so than the proprietary nature of most of them) made it difficult for Unix to become a commodity operating system. The GNU project worked hard to free software development from nuances of each of the different Unix versions through providing a common programming language environment (GNU C) and a sophisticated packaging tool (autoconf and automake) to carefully hide the differences. GNU/Linux has now become the most popular Unix variant and all the major Unix players support GNU/Linux in some way. A particularly touted feature of Unix comes from a tools philosophy where complex tasks are performed by bringing together a collection of simpler tools. This is contrasted with the philosophy of providing monolithic applications that in one fell swoop solve all your problems, supposedly. The reality is often different. Most operating systems supply a collection of basic utility programs for managing your files (things like arranging your files into folders, trashing files, and copying files from one place to another). Large applications then provide the word processing, spreadsheet, and web browsing functionality. Unix places less emphasis on the monolithic applications. Instead, tools provide simple functionality, focusing on doing well what they are designed to do. They simply pass their results on to another tool once they’re done. Unix pipes provide the mechanism for doing this: one tool pipes its output on to another tool. This allows complex actions to be performed by piping together a collection of simpler commands. A typical example is to determine the number of users logged on to your system:
> who | wc -l
The who command will list, one per line, each user logged on. The wc command will count the number of characters, words, and lines that it comes
10
History: Unix, GNU, Gnome
across, with the -l option only counting the number of lines. (GNU tools, like Unix, introduce options with the minus sign.) For various reasons though this tools philosophy was often overlooked when large monolithic applications arose that did not adhere to the philosophy— they did not share components. Common tools such as Netscape, ghostview, Acrobat, FrameMaker, and Star Office essentially share very little. Compare that with the Microsoft community where, for example, an application like Internet Explorer is component-based. This is now changing in the GNU world with the operating system software and the Gnome project encouraging component-based architectures. Another feature of Unix is that Unix applications tend to use open file formats allowing a variety of tools to collaborate to work on those open formats. Indeed, this has been a key in recent developments to remove the stranglehold of Microsoft proprietary formats. Rather than electronic document storage providing a longer term solution to the archival of documents, it is delivering an even shorter lifetime than paper-based archives! How can that be so? The formats created by proprietary software are often binary and not fully publicly specified. How many packages today can read old Word Perfect and Microsoft Word documents? The standardisation on open formats, often text-based formats like XML that allow anyone to read them, provides a solution to this problem. So why Unix? It is a conceptually simple operating system facilitating creativity by not restricting the developer. Many have found it to be a fun operating system to work with allowing many innovative developments to be combined in new and even more innovative ways to deliver powerful ideas. A very large world wide group of people willingly provide excellent, free support over the Internet. Anyone can learn more about the operating system by studying the code itself. Anyone can contribute to porting the operating system to their favourite computer. And finally, the much touted stability. There is very little doubt that GNU and Linux are extremely stable. The habit of rebooting your computer every time you come back to it is something Microsoft seems to encourage because of it’s notorious instability and tendency for the operating system not to carefully manage its use of memory. Also, install a new package under MS-Windows and chances are you need to reboot the computer. Most Unix users rarely need to reboot their machine. Check the uptime and you will generally find the machine has not been rebooted for months or years. Installing packages invariably does not require rebooting. Indeed, the only
3.2 GNU
11
time it does is when you upgrade your Linux kernel!
3.2
GNU
The GNU Project1 was begun in 1984 by Richard Stallman of MIT with the aim to develop a complete free (meaning free for everyone to look at, to learn from, and to build upon) software operating system. In 1989 he codified the terms under which this free software was released, producing the GNU Public License (GPL) which is the basis on which much of the GNU/Linux operating system is released. The license is often referred to as the copyleft license in contrast to the restrictive practise of copyright. By 1991 when Linus Torvalds wrote his Linux kernel GNU provided the operating system. By combining the GNU operating system with the Linux kernel the seeds for this most popular free operating system were sown. Many users installed the GNU tools on many different computers as replacements for vendor supplied tools. This provided these users with a consistency across the many different platforms they used. The tools even eventually appeared under MS-Windows, providing a Unix-like environment on a very different operating system.2 The tools developed by the GNU project include such essential utilities as the GNU file management utilities and the GNU text file processing utilities. The GNU file management utilities include fundamental command line tools like ls (to list information about files/documents), mkdir (to create new directories/folders), mv (to move directories and files around), rm (to remove files), and many more. The GNU text file processing commands include cat (to concatenate files together), head (to preview the top few lines of a file), sort (to sort the contents of a file), and wc (to count the number of lines, words, and bytes in a file). The toolkits developed by the GNU project are comprehensive. The following table lists just some of the 200 or more packages that you can obtain freely from http://www.gnu.org/software/software.html: Package aspell 1 2
Description An interactive spell checker that suggests ‘near misses’ to replace unrecognised words.
GNU stands for the recursive “GNU is Not Unix.” http://www.cygwin.com
12 Package awk bash
binutils
chess cvs emacs
enscript fileutils findutils
gcc
gdb ghostscript gimp gnome
gnumeric gphoto
gnupg gtk+ gzip
History: Unix, GNU, Gnome Description A powerful yet simple pattern-based scripting language. The Bourne Again SHell is compatible with the traditional Unix sh and offers many extensions found in csh and ksh. It is similar in concept to DOS. Consists of programs used to assemble, link, and manipulate binary and object files. It is used in conjunction with a compiler and various libraries to build programs for Linux. A state-of-the-art chess-playing program. The Concurrent Versioning System used for version control and management of software projects. An extensible, customisable real-time display editor and computing environment. This editor is widely used by developers and is more than just an editor. Emacs is capable of reading email, of providing integrated development environments, and spreadsheets, to name just a few. An ASCII file formatter generating PostScript for printing of text documents on PostScript printers. File management utilities. The ‘find’ utility is frequently used both interactively and in shell scripts to find files which match certain criteria and perform arbitrary operations on them. A free compiler collection for C, C++, Objective C and other languages. This compiler is used widely, on multiple platforms, including MS-Windows. A source-level debugger for C, C++ and Fortran. An interpreter for the Postscript and PDF graphics languages. A sophisticated graphical image manipulation application. The GNU desktop which provides a consistent graphical user interface for common applications including everything from spreadsheets to mail clients, and more. A spreadsheet. A graphical application for retrieving, organising, and publishing images in various graphics formats, from a range of supported digital cameras. A complete implementation of the OpenPGP Internet standard for providing pretty good protection through encryption. A GUI toolkit for the X Window System. All Gnome packages use this toolkit for their consistent look and feel. GNU’s program for compressing and decompressing files.
3.3 Linux Package kde
less
mtools r shellutils
tar textutils time wget
13 Description An alternative, and very popular desktop which provides a consistent graphical user interface for common applications including everything from spreadsheets to mail clients, and more. A display paginator similar to ‘more’ and ‘pg’, but with various features (such as the ability to scroll backwards) that most pagers lack. Programs to allow Unix systems to read, write, and manipulate files on a DOS file system (typically a diskette). A system for statistical computation and graphics. Useful command line utilities including ‘basename’, ‘date’, ‘dirname’, ‘echo’, ‘groups’, ‘hostname’, ‘printf’, ‘pwd’, ‘uname’, ‘uptime’, ‘users’, ‘who’, and ‘whoami’. An archive utility. A set of utilities for manipulating text. A utility to report on the time taken to execute other programs. A non-interactive web browser to retrieve files from the Internet using HTTP and FTP. See Chapter 90.3 for details.
Many of these GNU tools are command line tools but a growing number of them are now also GUI-based, including Gnome, KDE, The Gimp, and Gnumeric.
3.3
Linux
Unix was popular because, originally, the source code was practically free. For various reasons the Unix license began to forbid the Universities from using the source code in their teaching. This lead Andy Tannenbaum to write MINIX which then inspired Linus Torvalds to write the Linux kernel for his Intel 386. Unix has a long heritage and the new GNU/Linux has the luxury of learning from the success and failings of both Unix and MS-Windows. Of particular importance is the component-based architecture that facilitates the sharing of components among many applications. These are the focus of much modern development for GNU/Linux. Gnome, for example, uses Bonobo (built on
14
History: Unix, GNU, Gnome
top of the international CORBA standard) for its component architecture to support sharing. CORBA is an object model defined by the Object Management Group. Its use by Bonobo is based on ORBit, a thin and fast implementation of the CORBA specification. Bonobo is then the Gnome architecture for creating reusable software components and compound documents. It was designed and implemented to support the needs of the free software community to facilitate component reuse and to allow new applications to build on the shoulders of those that went before them. Don’t be too concerned about the technicalities. You will see reference to these terms so it is wise to be aware of them. The details are not so important to the end user.
3.4
Gnome
Unix lead to the development of the GNU Project which needed a kernel that was supplied by Linux to produce the GNU/Linux Operating System. GNU/Linux and Unix are generally criticised for being hard to use for the common user—all those command line tools and all that fiddling with configurations placed them back in the MS-DOS days. The demand is for modern intuitive interfaces similar to those pioneered by the Macintosh back in 1984. Unix has had graphical user interfaces for a long time. The problem was that Unix was provided by multiple vendors and those vendors had difficulty agreeing on a common way of doing things in the graphical user interface. There were systems like NeWS, OpenWindows, Display PostScript, and the X Window System. There was also a multitude of windowing systems available for the X Window System, including CDE, Motif, OpenLook, etc. They offered tremendous flexibility which lead to great diversity! And great confusion. Developers could chose different toolkits and get very different behaviours. Different ways of interacting with applications lead to much confusion and certainly no consistency: different ways of moving to the next text field; different defaults for keyboard shortcuts; different mechanisms for cut and paste between applications; etc. Apple, with the Macintosh, had a lot of control on how things should be done and developed guidelines for developers to do things the right way. Later, Microsoft with MS-Windows/95 and beyond also dictated standards for others to follow. This meant that once the user had learnt the nuances of the interface they were “set for life.”
3.5 Free and Open Source Software
15
The Gnome Project pioneered by Miguel de Icaza in 1997 and progressed by the free software company he founded with Nat Friedman in early 2000, originally called HelixCode and then Ximian, has set the standards. The traditional Unix players, including Sun Microsystems, IBM, Hewlett-Package, and Compaq joined the Gnome Foundation in August 2000 to help that standard become, well, standard. Gnome is not the only standard. KDE, begun by Matthias Ettrich in 1996, is a very respectable and popular alternative. KDE suffered in the early days of its development by being dependent on a toolkit, Qt, that did not meet the licensing criteria for Free Software. This one unfortunate blemish lead to the development of the Gnome project. The fact that there are two standard desktops is not a particular concern, despite the above discussion. The friendly (but at times heated) competition drives the enthusiasts in both camp. What we have to be careful about is that we learn from the past and not allow this competition to destroy the common goals. Perhaps one will live on, or perhaps both will live on. Either way, both are excellent products developing easier to use GNU/Linux systems, and leaving the choice to the user.
3.5
Free and Open Source Software
There is much confusion over the terms free software and open source. They are not the same thing. Open source software is not necessarily free software. Indeed, some open source software places considerable restrictions on what you can do with the source code, thus rendering it non-free. GNU software is open source software that is also free in the sense of freedom. This software allows everyone to redistribute and modify the software, without restriction. We contrast open and free software with proprietary software that we have become familiar with—the software that we buy on trust from a vendor, trust that it will work, but for which the vendor disowns any responsibility. When you find it has bugs and is not fit for purpose you must buy the next version to get something that works for you. Proprietary applications for word processing, spreadsheets, presentations, Web browsing and so on abound. In general they work pretty well today, providing sophisticated functionality. However, probably because of their proprietary nature, they generally do not work well together, particularly products from different vendors. There is little motivation for vendors to
16
History: Unix, GNU, Gnome
make it easy for you to move away from their product to a competitors product. What makes this situation rather sad is that each of these proprietary applications have a lot of functionality in common. Today we have a pretty good understanding of the common features we require in a product: open and save files, cut and paste, spell checking, etc. They all provide this, often over and over again. There will always be opportunity to innovate and do things in different and possibly better ways, but why are we wasting resources on the most basic of operations instead of innovating with new functionality? This has been addressed on the major modern platforms by sharing toolkits. But sharing of more substantial functionality has been slower to develop. Another aspect is that open source software makes development cheaper because more people are involved, the work load is shared, people with very different skill levels can collaborate and help increase the overall skill level of the whole community, bugs are caught quicker because there are more people looking over the source and bugs are fixed quicker because of this. Free software demands that the user be granted four kinds of freedom: freedom to run the program, for any purpose; freedom to study how the program works, and adapt it to your own needs; freedom to redistribute copies so you can help your neighbour; and freedom to improve the program, and release your improvements to the public, so that the whole community benefits. A pre-condition for this is the availability of the entire source code, so that along with the freedom comes the responsibility to share your “discoveries” with others. Free software open source projects still need to be structured. Usually they are conducted under the watchful eye of a project leader, commonly referred to as the maintainer. Anyone can contribute to the project and decisions are often discussed openly and decided by consensus after discussion of the technical merits. Sometimes the project leader will need to cast the ‘deciding vote’. Finally, in addition to founding the GNU Project Richard Stallman founded the Free Software Foundation to pioneer the cause of free software—free software that gives individuals the opportunity to share their innovations and through this to allow others to learn and to contribute their discoveries.
3.6 Free Documentation
3.6
17
Free Documentation
In March 2000 Richard Stallman (with Eben Moglen, a professor at Columbia Law School) introduced the GNU Free Documentation License (GFDL). Stallman identifies the GFDL as a means to enlist commercial publishers to fund free document writing without surrendering any vital liberty. The GFDL identifies the conditions relating to the copying and revision of documents. Documents are more complicated than simply placing source code on the Internet. The GFDL is consequently more complex, covering the mass copying of the document, inclusion in collections, and specific issues relating to the covers. Two important concepts relating to the availability of the document are introduced: transparent copies of the document and opaque copies of the document. A GFDL document must be transparent—that is, available in a format whose specification is available to the general public and which can be read using free software. Formats such as LATEX (used for this book) and XML (using publicly available DTDs) are fine. But making your document available only in PostScript or PDF or Microsoft Word is not transparent. These are opaque documents that might suffer the same old problems of document rot—after a few years the documents may no longer be accessible because the proprietor of the proprietary format might have gone out of business and the knowledge of the format has been lost.
3.7
Freedom
The free software world aims to share their knowledge and software in order for all to gain towards a common goal. The proprietary software world aims to hoard their software, to hide their discoveries, to let others go through the discovery process themselves rather than to innovate from the shoulders of those who went before them. Stallman characterises the view of the proprietary vendors as: “If you share with your neighbour, you are a pirate. If you want any changes, beg us to make them.”. If I enjoyed a piece of music or a novel, should I be inhibited from lending the CD or the book to my neighbour? Eric Raymond, in his “Musings on Linux and Open Source” in the book “The Cathedral and the Bazaar” makes compelling arguments for Free and
18
History: Unix, GNU, Gnome
Open Source Software development. Some of his points, paraphrased, are: • The quality of the software is maintained by a simple strategy of releasing the software to the general public every week and receiving feedback from hundreds of users within days: release early and release often. • Users can be cultivated into becoming developers if your software is serving a need of theirs. They will add functionality to suit their particular goals, and this functionality is likely to be useful to others.
3.8 3.8.1
General Resources Books
A Quarter Century of Unix by Peter H. Salus. 256 pages published by Addison Wesley, 1994, ISBN 0-201-54777-5. This is a good review of the history of Unix with many interesting insights. Well worth a read if you are interested in where Unix came from and you can find a copy of the book. The Cathedral and the Bazaar: Musings on Linux and Open Source by an Accidental Revolutionary by Eric S. Raymond. 288 pages, published October 1999 by O’Reilly & Associates, ISBN 1565927249. Discusses the free software business model. The author is an identity in the Open Source movement and here captures a model of Open Source and Free Software development. Linux in A Nutshell: A Desktop Quick Reference, Second Edition by Ellen Siever. 632 pages, published February 1999 by O’Reilly & Associates, ISBN 1565925858. An excellent reference to many standard GNU and Unix tools. An intermediate resource between this current book which aims to get you started with the tools and fully fledged manuals. The Linux Sampler: A Linux Resource Guide by Belinda Frazier and Laurie Tucker. 240 pages, published November 1994 by Specialized Systems Consultants, ISBN 0916151743. Presents an overview of Linux from the point of view of where, how, and why it is being used, with a little technical help thrown in. Linux Rute User’s Tutorial and Exposition by Paul Sheer. 500 pages, published January 2002 by Prentice Hall, ISBN 0130333514. Presents an
3.8 General Resources
19
excellent guide to many aspects of the Linux operating system. Also available from http://www.icon.co.za/~psheer/book/.
20
3.8.2
History: Unix, GNU, Gnome
Internet
For the GNU perspective on many of the issues mentioned here refer to http: //www.gnu.org/philosophy/free-software-for-freedom.html. This article, titled Why “Free Software” is better than “Open Source” is written by Richard Stallman and is an essential read on the topic. It explains why the use of the term “Open Source” is not strong enough in the context of “Free Software.” Freshmeat (http://freshmeat.net/) is an index of a large collection of GNU/Linux packages with up-to-date information on their status and links to their home pages and related locations. The index can be searched or browsed. Most of the GNU/Linux tools are included. Gnome (http://gnome.org/) is the framework and associated toolkit used by many of the graphical applications introduced in this book. The Gnome web site includes a list of many of the major Gnome applications. Linux Today (http://linuxtoday.org/) is a news service providing updates on developments related to GNU/Linux. It has a good selection of articles usually updated several times a day, and does not overwhelm the reader with news. Summaries are presented with links to slightly more detailed summaries, with links to the complete articles, wherever they appear on the Internet. Slashdot (http://slashdot.org/) is another news service with a Linux bent.
Chapter 4 Distributions When you purchase a computer the chances are that it comes with MSWindows pre-installed. The version of MS-Windows has been tuned and set up by the manufacturer or retailer to run well on the particular configuration you have purchased. Drivers for the particular devices, such as audio, video, and CD-ROM, will have been included in the installation. The computer is ready to turn on and get started in MS-Windows. It will just work (usually)! To run GNU/Linux instead of MS-Windows (or in addition to MS-Windows) you need to install the system yourself. This entails obtaining a distribution of GNU/Linux, installing it, and configuring the device drivers to suit your particular setup. So some extra effort is usually required to get GNU/Linux up and running. The GNU/Linux Operating System is built upon the foundation that is the Linux kernel. To install GNU/Linux on your PC you could start with installing the Linux kernel and then compiling and installing the GNU tools and other essential software that you need. But this approach is not for the light hearted. Luckily this is not the usual manner of installing a GNU/Linux system! Many people have put a lot of effort into packaging things together into distributions so that installing GNU/Linux is a more straightforward exercise. GNU/Linux distributions typically provide the whole system as a collection of packages from which you choose those that you want install. Some packages are mandatory, and form the base installation. Other packages are then installed as you need them. Until pre-installed GNU/Linux systems become more common chances are 21
22
Distributions
you will need to install a distribution yourself. The process is not trivial but it is straightforward. In Chapter 5 we will highlight the steps with just enough detail to get you through the installation process. In this chapter we review the options available in selecting a distribution of GNU/Linux to install.
4.1
Debian GNU/Linux Distributions
The reference distribution for this book, and my preferred distribution, is Debian GNU/Linux, the Linux for the GNU Generation. I originally started with Slackware in the early 90’s but migrated through Red Hat and then quickly on to Debian in 1995. Red Hat is a good distribution and is quite popular but has limitations. Debian conforms to the open and distributed development model making it a very open distribution where even you can make a change to it if you so desired. Debian is the basis of a number of commercial distributions and it also powers quite a few web sites including Linux.com. Distributions involving Debian GNU/Linux are listed at http://www.debian. org/misc/children-distros and include: Demo Linux This is a CD based GNU/Linux that allows one to run GNU/Linux without installation or disk partitioning. See http://www.demolinux. org/. Gibraltar The Gibraltar project produces a Debian-based firewall/router that runs entirely off of a bootable CD-ROM. See http://gibraltar. vianova.at/. Knoppix The Knoppix distribution, based on Debian, allows one to run Debian without installing it! Just boot from the CD-ROM and Debian will run from there. If you decide to then install Debian, you can do so from the Knoppix CD-ROM. Knoppix works on most but not all hardware, trying its best to automatically identify hardware and set things up appropriately. See http://www.knopper.net/knoppix/ index-en.html. Libranet Linux by Libranet packages commonly used applications onto an easy to install CD and includes, for example, Gnome. See http://www. libranet.com.
4.2 Advantages of the Debian Distribution
23
Linex A Debian-based distribution being developed by the regional government of Extremadura (Spain) with the goal of migrating all the computer systems, from government offices, to businesses to schools into Linux. Morphix Morphix is a modular LiveCD derived from Knoppix, with install images for Games, Gnome, KDE, and LightGUI. It is available from http://www.morphix.org. Stormix Storm Linux is built around Debian GNU/Linux, “the most stable and secure distribution available.” See http://www.stormix.com/. ThinkNIC This is a $200 new Internet computer (NIC) which runs from a CD-ROM using Debian GNU/Linux. See http://www.thinknic.com. TuxTops This distributor of laptops pre-installs Debian GNU/Linux on their laptops. See http://www.tuxtops.com/. Related distributions include Amirix (http://www.amirixlinux.com/), Embedded Debian (http://www.emdebian.org/), TimeSys for real time GNU/Linux (http://timesys.com/products/linux.html) and the VA Linux Systems, O’Reilly and SGI collaboration (http://www.oreilly.com/catalog/debian/ index.html).
4.2
Advantages of the Debian Distribution
Debian (http://www.debian.org) is an excellent distribution of GNU/Linux. (A popular commercial alternative to Debian is Red Hat.) The releases of Debian are rock solid stable and come highly recommended. The Debian packaging system is well developed and acknowledge as an excellent piece of work. You can purchase the CD-ROM distributions of Debian inexpensively (see http://www.debian.org/distrib/vendors for a list of vendors) or burn your own CD-ROMs from images available on the net. This latter option is explored in this chapter. Here are some specific advantages and benefits that distinguish Debian from other distributions: • As a non-profit organisation Debian is more of a partner than a competitor with other distributions. Anyone can sign up as a Debian developer and be granted the same privileges as anyone else. There are
24
Distributions currently over 870 active Debian developers. New work developed for Debian is available for all of the other Linux distributions to copy as soon as it’s uploaded to the Debian servers. • The Debian Free Software Guidelines are a critical component from a business standpoint. They specify the requirements for licenses of any package that is to be included with Debian. Debian conforms to the official GNU version of free software which means that every package included in Debian can be redistributed freely. • Debian is driven by policy. The formal and publicly available Debian policies have been developed over many years and are a mature response to dealing with the large task of maintaining such a distribution in a distributed manner. Various Debian tools (such as dpkg, apt-get, and lintian) effectively implement the policy and provide a guarantee of quality in the packaging. • Debian is an excellent choice for the development of software for all distributions of GNU/Linux. Because Debian’s processes, in terms of policies and packaging, are fair and visible and open standards conforming, Debian is a very clean and very carefully constructed distribution. Developments that occur on a Debian platform can thus easily be delivered or transferred to other GNU/Linux (and Unix) platforms. • It is difficult to upgrade a system from one RedHat release to another. Debian provides simple migration paths that are well trodden. No more re-installing the operating system just to upgrade to the new release. • Debian’s tools have the ability to do recursive upgrades of systems. • Debian deals with dependencies and will identify the required packages and install them and then install the package you want. • Debian packages can Suggest other packages to be installed, and it is left to the user whether to follow the suggestions or not. • Multiple packages can Provide the same functionality (e.g., email, web server, editor). A package might thus specify that it depends on a web server, but not which particular web server (assuming it works with any web server). • Debian has a utility to install RedHat packages if you are desperate!
4.3 Debian Distributions
25
• Debian does not overwrite your config files nor does the packaging system touch /usr/local except perhaps to ensure appropriate directories exist for local (non-Debian) installed data and utilities. • RedHat uses a binary database for its package data while Debian (dpkg) uses text files. Debian is more robust (if a single file gets corrupted it’s less of a problem) and it is possible to fix or modify things by hand using a normal text editor if needed. (Debian’s apt-get uses a mixed approach: it uses the same text files as dpkg but uses a binary cache to also get the advantages of a binary database. • RedHat packages rarely fix upstream (i.e., original source of packages) file locations to be standards compliant but instead just place files whereever the upstream package happens to put them. Many upstream developers do not know about or conform to the standards. A minor example, the openssh rpms create /usr/libexec for the sftpd daemons, but libexec is a BSD standard and the Linux standard1 says such things should go in /usr/lib/¡program¿ or /usr/sbin. • Generally speaking, Debian packages must be created by “qualified” developers (and there are thousands of them) who are committed to following Debian’s strict policies requiring such things as FHS compliance and never overwriting config files without permission. Only packages from these developers become part of the Debian archives. • Debian runs on more hardware platforms than any other distribution. • The Debian packaging philosophy is to keep packages in small chunks so that the user can choose what to install with a little more control. See also http://www.infodrom.org/Debian/doc/advantages.html.
4.3
Debian Distributions
Debian provides a rock solid, stable, distribution which is highly recommended for those running servers that must be reliable. This distribution 1 The Filesystem Hierarchy Standard (FHS) is described at http://www.pathname. com/fhs/. It consists of, to quote the site, a set of requirements and guidelines for file and directory placement under UNIX-like operating systems. They thus encourage the interoperability of applications, system administration tools, development tools, and scripts as well as greater uniformity of documentation for these systems. More GNU/Linux specific is the Linux Standard Base (LSB) with information at http://www.linuxbase.org/.
26
Distributions
has been thoroughly tested. Software included in this distribution is not leading edge, but instead it is mature software, unlikely to crash, ever! But many people like to stay up-to-date with the latest and greatest. An alternative Debian distribution, the unstable distribution, is where you will find the latest and the greatest—it is a pretty solid distribution (and is particularly suited to those who live at the bleeding edge). The testing distribution is a compromise between stability and bleeding edge. Packages in this distribution have not been through the rigorous testing of the stable distribution, but are generally stable enough to not have serious bugs reported against them. Administering a Debian system and maintaining up-to-date package installations is easy with Debian’s apt-get and dpkg tools. A lot of effort has been devoted to ensuring the system works as a whole, rather than providing a lot of glitz. The name Debian comes from Deb and Ian Murdoch. A LITTLE MORE HISTORY OF DEBIAN HERE. First appeared in 1993, pre-dating RedHat and many other distributions. Debian satisfies the needs of both system administrators who require rock solid software and hobbyists who like to live at the cutting edge and don’t mind the occasional bumpy road. The stable releases have proven to be extremely stable. Only packages that have been thoroughly tested by the Debian team become part of a stable release. These releases are sometimes called dinosaurs even before they get released. By the time they are released the rest of the GNU/Linux world has moved on (often to introduce new bugs). You can be confident, though, that you will have a solid Linux installation. And if you want to have the latest and greatest, or even just update some packages to their latest release, you simply ask Debian to go grab it and install it for you. The stable distribution of Debian is found at http://www.debian.org/ releases/stable/ and the unstable distribution, where you will find the latest and the greatest, is found at http://www.debian.org/releases/ unstable/. Despite its name, the unstable distribution is very stable, although at times you might find an aberrant package in transition, but it won’t be there for long! Administering the system and maintaining up-todate package installations is easy with Debian’s apt-get and dpkg tools. With these tools and the Debian package structure a lot of effort has been devoted to ensuring the system works as a fully integrated whole, rather than providing a lot of glitz.
4.4 Debian Packages
4.4
27
Debian Packages
Debian has a carefully planned and controlled release program and has a number of releases available at any time. The releases have code names (originally from the Toy Story movies), release names, and versions. This may sound complicated, but it is actually quite simple and effective. The officially released and current version of Debian is referred to as the stable release. This release is regularly highlighted as the most stable GNU/Linux distribution available.
4.5 4.5.1
Debian Releases Naming The Releases
There are three ways of referring to a particular release: name (e.g., woody), state (e.g., stable), and number (e.g., 2.2). The name and number refer to the same static release with a number only being issued when the release is finalised (i.e., it becomes stable). The state (stable, testing, or unstable) shifts from release to release, and a given release will cycle through these states. The special name sid always refers to unstable. The release names come from the Toy Story movies (bo, hamm, slink, potato, woody, sid, . . . ). The states are stable, unstable, testing, and frozen. The unstable release is where new packages and updates to old packages appear. You access this distribution if you want the latest and greatest, and are comfortable with the occasional glitch. For those who want the latest and greatest but not the risk the testing release lags behind the unstable release by a few weeks to include only packages that don’t appear to have any problems. When a new release is being prepared it evolves from the unstable release through the testing release onto the frozen release. A frozen release goes through a thorough testing phase to ensure all packages in the distribution work together and there are no outstanding bug reports. This process can take six months or more.
28
Distributions
Once this testing is complete the release is then renamed as stable and may remain the current stable for up to eighteen months. The stable release is just that, stable. It is often regarded as the most stable distribution of GNU/Linux available. Packages in this release are not the most recently available and sometimes thought to be quite out of date, but that is the cost of rock solid stability. In summary, the stable release is best suited to production servers, while the adventurous power user can run ’unstable’ on a desktop with only the rare mess up. An advantage of this system is that a user can track either a specific release (slink, potato, woody, sid) or a state (stable, testing, unstable) simply by specifying the appropriate name in /etc/apt/sources.list. The fact that the states can change quite dramatically (e.g., when a new stable release is made) is a little problematical as people may suddenly find that their system wants to upgrade everything to a new release. One suggestion is to choose the release name and stay with that until you decide yourself to upgrade. Thus, to stay with a given release use the release name. To keep up-to-date with a stable system then use the stable release. To be at the bleeding edge and relatively stable then use testing. To live at the absolute bleeding edge use unstable. Version 2.0 2.1 2.2 3.0
Name Testing bo hamm slink potato woody 2001/08 sid
Frozen
Stable
1998/11/03 2000/01/16
1999/03/10 2000/08/22
Table 4.1: A selection of Debian releases.
4.5.2
Recording Your Choice
There are over 75 Debian mirrors world-wide and over 7300 packages available for unstable which you can browse at http://www.debian.org/Packages/ unstable/allpackages.html. Check for a mirror near you by trying http:
4.5 Debian Releases
29
//ftp.au.debian.org/ where you replace au with your country code. The following are likely to exist: au Australia If you don’t find one then stay with the master Debian site or check for another mirror listed in http: //www.debian.org/distrib/ftplist. If you do find a suitable mirror then edit /etc/apt/sources.list (as root user) and add in the appropriate net address. For example, if you are in Australia you might and want to install from the potato archive then your /etc/apt/sources.list might look like: deb http://ftp.au.debian.org/debian potato main contrib non-free deb http://ftp.au.debian.org/debian-non-US potato/non-US main contrib non-free
(If you are familiar with Debian slink or earlier, you will notice that the format of the non-US entry changed starting with potato.) Finally, if you want to go the “commercial” (and sometimes less hassle) CDROM distribution path a nice looking one based on Debian is Libranet. The apt-setup command will run a simple interface to help set up your /etc/apt/sources.list.
4.5.3
Other Flavours
Another key benefit of Debian is that the distribution is packaged for multiple architectures, including Alpha, ARM, HP PA-RISC, Intel x86, Intel IA-64, Motorola 680x0, MIPS, MIPS (DEC), PowerPC, IBM S/390, and SPARC! That’s quite a choice. And even more interestingly, Debian is not tied to the Linux kernel! There’s also a “Linux-free” Debian called Debian/Hurd (hurd-i386) and, surprisingly there is even discussion of a Debian/Cygwin which runs Debian packages on legacy MS-Windows platforms via the Cygwin compatibility toolkit. Now that will be something to see!
4.5.4
Package Basics
Debian distributions are based on over 4400 packages. Your task is to select those you wish to install! This is made easier with task packages which are virtual packages that depend on a collection of other packages. Selecting one of these task packages results in that collection of other packages being
30
Distributions
installed. An example is the task-tex package that will install the TEX and LATEX packages and related utilities. Task packages are presented to the user on an initial install. As the name indicates a task package is intended to deliniate a specific task you might use a computer for, like a web server, an X workstation, or perhaps an X workstation using Gnome or KDE. Individual packages are installed and updated using http://www.debian. org/Packages/stable/base/dpkg.html dselect (with a basic GUI), or http: //www.debian.org/Packages/stable/base/dpkg.html dpkg (for manual installation of deb files), or http://www.debian.org/Packages/stable/ admin/apt.html apt-get (for automatic download and install, including installation of other required packages). Using dselect is at first confusing but allows you to easily update and install new packages with an ease that leaves you confident that all difficulties have been carefully hidden through extensive dependency and consistency checking. If network connection is interrupted, the downloads will be resumed from where they got to. The dselect learning curve will pay dividends. My installation has always been left in a consistent and stable state after installing packages from the Debian archives on the Internet. As you gain confidence and know what you are after, move on to apt-get if you prefer a command-line interface. This takes care of dependency checking automatically (unlike dpkg) and will retrieve the required packages from the Debian archives. Each individual package can Suggest, Recommend, and Depend on other packages. A subtle difference between dselect and apt-get is that the latter ignores Suggest and Recommend dependencies whereas dselect will offer Suggested packages for the user’s attention and will select Recommended packages automatically.
4.6
Using dselect
Running dselect you will be lead through these simple steps: • Access the archives using the apt access method. You will be offered the chance to edit the file /etc/apt/sources.list but I always answer
4.7 Debian on CD
31
N since it seems to wipe out my comments. I prefer to hand edit the file and to update my comments. • Update my machine’s picture of the world. This reads the Packages files (which is the master list of packages available from the Debian archive) found at those sites listed in /etc/apt/sources.list and updates the information for dselect on my machine. • Select any packages you want to install. This will also highlight any packages that dselect thinks you probably should install, including dependencies and security updates. • Install will then figure out what has to be done and tells you what it will need to download. You can tell it to go ahead or if you get cold feet you can pull out here and go back and change your selections. If you go ahead the packages are pulled from the Net and installed. • Config is mostly a null operation for me. It seems to just double check things. • Remove is also mostly a null operation. It also seems to just double check things. • Quit when I’m all done. Simple. The Select stage can be a little confusing when you get conflicts so read the help screens carefully. Once you’ve got things going with dselect you may find the convenience of the command line based wajig useful.
4.7
Debian on CD
You don’t need to install Debian GNU/Linux from CD-ROM. You can obtain all of the Debian packages from the international network of Debian mirrors by simply using the Debian package tools (often based around the apt-get package and including those that provide more user-friendly interfaces to apt-get including capt, gnome-apt, and aptitude). Of course, if you do not have ready access to the Internet you may want to burn your own CD image of the distribution (assuming you have enough
32
Distributions
access to download the images!). Or if you are installing Debian GNU/Linux on multiple machines then the CD-ROM installation is the best option. Burning your own CD-ROM is a straightforward process using tools supplied by Debian specifically to build, as a file, an image of the CD so that you can then burn the image directly to CD using CD writers on any platform you may have access to. The recipe presented here uses a Solaris host (but can be any other Unix or MS-Windows host) with good Internet access. You will need to install ncftp version 2.4.3 (don’t use the more experimental version 3beta of ncftp as it has a different behaviour that does not work with the Debian tools discussed here—this may of course be fixed in more recent releases.) You will also need wget. These are both freely available on the Internet (check freshmeat.net).
4.7.1
Build or Download the CD Image?
You may be wondering why you should go through a process of building a CD image yourself rather than simply downloading the appropriate images from a Debian CD image mirror somewhere. The answer has been that there are many Debian mirrors world-wide that store the complete collection of Debian packages. If these mirrors were to also store the CD images the extra space required is essentially wasted space and so many of the Debian mirrors do not keep the CD images. There are a smaller number of Debian hosts on the Internet that do maintain CD images. These hosts are often not local and the amount of bandwidth required to download the images from these smaller number of mirrors is quite significant. According to the Debian GNU/Linux CD Images Frequently Asked Questions page (http://cdimage.debian.org/faq.html) by using a distributed approach based on the network of Debian package mirrors the required bandwidth to the CD image mirrors is reduced by over 99%! Nonetheless, today you may find local Debian hosts mirroring the CD images also. If that is the case then it is easier to simply download the actual images rather than building the images as described in the rest of this chapter. In Australia, for example, the primary Debian mirror also mirrors the CD images (from http://cdimage.debian.org/cd-images/. So for those in .au and .nz it is perhaps easiest to simply download one of the following:
4.7 Debian on CD
33
> wget http://mirror.aarnet.edu.au/pub/debian-cd/3.0_r1/i386/debian-30r1-i386-binary-1_NONUS.iso > wget http://mirror.aarnet.edu.au/pub/debian-cd/3.0_r1/i386/debian-30r1-i386-binary-1.iso
Then burn the image to CD using whatever tools you have at your disposal. For release 3 there are 7 CDs. The NONUS alternative (which contains items that can not be exported directly from the US) is only relevant to the first CD.
4.7.2
Obtain The Debian Pseudo-Image Kit
If you don’t have good access to a well connected CD image host then it is best to follow the following recipe to build the CD images. It is quite straightforward. The first step is to obtain the appropriate Debian tools to build the CD image. Again, recall that the scenario here is to build the image on a Solaris machine, but the procedure should be similar for any GNU/Linux or Unix machine. The pseudo-image-kit package can be obtained from a number of locations listed at http://cdimage.debian.org/~costar/pseudo-image-kit/. We use one of these locations here: > > > >
wget http://panic.et.tudelft.nl/~costar/pseudo-image-kit/pseudo-image-kit-2.0.tar.gz tar zxvf pseudo-image-kit-2.0.tar.gz cd pseudo-image-kit-2.0 perl -pi -e ’s|^#! /bin/sh|#! /usr/local/bin/bash|’ make-pseudo-image
The last operation here changes the location at which the script makepseudo-image expects to find the installed version of the bash shell. Under GNU/Linux it is /bin/sh but under Solaris it may be installed in /usr/ local/bin/bash.
4.7.3
Listing of CD Image Contents
The next step is to obtain a list of files that will make up the contents of the CD. This is obtained from an appropriate CD image archive. For the binary distribution of Debian (2.2) there are three CDs. We download the list of contents for each:
34
Distributions
> wget http://www.uk.debian.org/debian-cd/cd-images/2.2_rev0/i386/binary-i386-1.list > wget http://www.uk.debian.org/debian-cd/cd-images/2.2_rev0/i386/binary-i386-2.list > wget http://www.uk.debian.org/debian-cd/cd-images/2.2_rev0/i386/binary-i386-3.list
For Australia you can get them locally: > wget http://mirror.aarnet.edu.au/debian-cd/2.2_rev0/i386/binary-i386-1.list > wget http://mirror.aarnet.edu.au/debian-cd/2.2_rev0/i386/binary-i386-2.list > wget http://mirror.aarnet.edu.au/debian-cd/2.2_rev0/i386/binary-i386-3.list
4.7.4
Download Debian Packages
Now download from a local server the actual packages that will make up the contents of the CD-ROM: > ./make-pseudo-image binary-i386-1.list ftp://ftp.au.debian.org/debian
This takes quite a while! The end product is a file called pseudo-image. All the other pseudo-image* files can be removed (they’re used to keep track of where things were up to in case the download is interrupted). This download is called the pseudo image because it’s an approximation of the real image! It’s pretty close, but not yet guaranteed perfect. It is a simple process to now turn it into an official image: > mv pseudo-image binary-i386-1.iso > rsync --verbose --progress --stats --block-size=8192 \ mirror.aarnet.edu.au::debian-cd/2.1_r4/i386/binary-i386-1.iso .
This uses rsync to synchronise your CD-ROM image with the official one. When this is complete you can burn this CD-ROM image directly to CDROM. Most CD-ROM burning software supports burning iso images directly. Some other useful rsync commands allow you to hunt around the directory structure of an rsync server. Some useful commands are: List contents of the rsync server’s root directory > rsync mirror.aarnet.edu.au::
4.8 Other Distributions
35
List the contents of another directory > rsync --dry-run mirror.aarnet.edu.au::debian-cd/2.2_rev0/*
4.7.5
CD-ROM Packages from APT
You can tell apt-get to obtain packages from a selection of CD-ROMs with the following: # apt-cdrom add
4.8
Other Distributions
GNU/Linux is all about choice. Other distributions of GNU/Linux have their devotees, and each in its own way contributes significantly to the overall development of GNU/Linux. Other distibutions include Red Hat, Mandrake, SuSe, and Slackware. There are many distributions indexed at http://www.linux.org/dist/index.html. An early distribution, still being maintained is Slackware available from http://www.slackware.com/. Clearly, Red Hat, available from http://www.redhat.com/, is an excellent distribution responsible for gaining a lot of exposure for GNU/Linux. While we use Debian GNU/Linux in this book as the underlying distribution what we say here applies to most distributions most of the time.
4.8.1
Moving From Red Hat
When converting from RedHat to Debian all of the configuration files in /etc should be kept (e.g., burn them to CD-RW). Both distributions use many of the same configuration files, although sometimes they are in slightly different places. Another approach is to create a parted boot disk (or use a Knoppix CD— knoppix has parted installed) and then create a new partition on your machine onto which you install Debian. This allows you to keep a functioning RedHat install while you set up Debian. Once you have the Debian installation up to scratch you can wipe the RedHat partition and reclaim it for
36
Distributions
use in Debian (perhaps as /var, /usr). Otherwise delete the partition with parted and enlarge your Debian partition.
Chapter 5 Installation Installation of GNU/Linux is generally straight forward except when you hit some new or obscure hardware. In comparison, MS-Windows generally comes pre-installed when a PC is purchased, hiding the effort that went into fine tuning the installation of the operating system for that particular hardware. Until GNU/Linux is commonly available pre-installed we will continue to be faced with issues relating to installation by novices (and experts!). Nonetheless, the situation is improving dramatically with the introduction of LiveCDs running Debian GNU/Linux. These allow a user to boot GNU/Linux from CD and to actually run GNU/Linux without installing anything! The user can then have the option to install if they like what they see. For Debian GNU/Linux, installation instructions are provided by the Debian Installation Guide available from http://www.debian.org/releases/ stable/i386/install. An alternative guide is available from http://www. polaris.net/~dwarf/. These provide considerable detail and are well worth the effort. Be familiar with the installation process—try it out once or twice—it doesn’t hurt to practise! In this chapter we review the installation process through examples using a number of platforms. These include common desktops, laptops, and even a different type of CPU (Sun SPARC). The aim is to install a minimal stable 1 release from CD-ROM and then to upgrade to the unstable 2 release. If you 1 The stable release of Debian GNU/Linux is a solid distribution which has been very extensively tested. It generally contains older releases of software that have proven to be quite stable. 2 While the unstable release sounds, well, unstable, it contains the most recent versions of all packages and is usually quite a stable product. Occasionally it suffers from a buggy
37
38
Installation
are not connected to the Internet then you will be installing a full system from CD-ROM. This will leave you with a complete system ready for most tasks.
5.1
Hardware Compatibility
While a number of hardware manufacturers support GNU/Linux, not all do, or else they are slow about it. This is the cause of most difficulty in installing GNU/Linux yourself—you suddenly find that your hardware is not supported out of the box. However, this is fairly rare today, and when you find yourself in such a situation there is generally a wealth of support available within the GNU/Linux community to solve the problem. Most devices will, however, simply work without any effort under GNU/Linux. We look at some specific cases below. The Linux Hardware HowTo is also a very useful resource. Network interface cards (NICs) come in many difference designs and there are numerous clones. Sometimes there is very little technical information made available by the manufacture available and open source drivers may be hard to come by. This is only likely though for very recent new cards or very specialised cards (like Gigabit Ethernet). Any PCI Ethernet or Fast Ethernet NIC should work out of the box with GNU/Linux. Modems that indentify themselves as Windows only or designed for Windows are so-called software modems which rely on the CPU doing some of the work for them. Some of these will not work with GNU/Linux. However, all external modems work with GNU/Linux. For graphics cards, avoid the absolute latest releases until you’ve checked their driver status under GNU/Linux (check with the retailer or vendor). For example, for nvidia graphics cards the NVidia Gnu/Linux binary driver web site has a README that lists the supported cards, which generally includes everything but the absolute latest top-of-the-line cards (support for which is generally only a matter of time). There is an excellent web site for checking GNU/Linux compatibility for printers (http://www.linuxprinting.org). Generally, most Epson and HP inkjet printers are well supported. There is a similar web site to check for CD recorder compatibility. In general, package or two but are usually quickly fixed.
5.2 Getting the Installation Media
39
any ATA CD-RW and DVD-RW/-RAM/+RW drive should work just fine with GNU/Linux since they are controlled by the ATAPI driver.
5.2
Getting the Installation Media
You can install Debian GNU/Linux in a number of ways. Here we review a CD-ROM installation (although floppy install is also covered for some older installations). CD-ROM is the current recommended approach (although DVD-ROM is now also available and will soon become the recommended approach). However, floppy disk install is still feasible, if a little tiresome. LiveCD install is becoming a preferred alternative, and is also discussed.
5.2.1
Floppy Distribution
A collection of floppy disks (sixteen for Debian 2.2, for example) is required to begin the floppy-disk installation. The raw floppy disk images can be retrieved from http://ftp.debian.org/debian/dists/stable/main/ disks-i386/current/images-1.44/. The required images are: rescue.bin (the Rescue Disk ); driver-1.bin to driver-4.bin (the Drivers Disks); and base-1.bin up to base-11.bin (the Base Disks). These can be written to floppy disks using the rawrite2 executable for MS-Windows (available from http://ftp.debian.org/debian/dists/stable/main/disks-i386/current/ dosutils/): C:\> rawrite2 -f resc1440.bin -d a:
5.2.2
CD-ROM Distribution
The available CD-ROMs include the main distribution (currently version 3.0 woody CD-ROM), the network install3 (netinst) CD-ROM (version 3.0), and other CPU specific CD-ROMs (e.g., the Sparc 3.0 woody CD-ROM). The CD-ROM images can be obtained from, for example, http://mirror. 3
The netinst, or network install, distributions are Debian CDs with a bare installer. The base OS and any additional packages you choose to install are downloaded from a Debian mirror.
40
Installation
aarnet.edu.au/pub/debian-cd/current/ and similar archives (this Australian mirror is only available to Australian hosts). For CD-ROM only installations you may need to obtain multiple CD-ROMs. For the netinst approach the CD-ROM images are generally around 100MB. Grab the CD-ROM image from a web site and burn to CD (preferably CDRW!): # cdrecord -v speed=4 dev=1,1,0 -data cdimage.raw
The recommendation is to use the netinst approach—the base packages are provided on one CD-ROM and from there the rest of the system is installed over the network. Debian supplies netinst CD-ROM images as does Progeny. The Debian version is the familiar and well tried installation process while Progeny uses the new PGI (piggy) interface which is quite a bit nicer and is likely to become the standard Debian interface in the future.
5.2.3
LiveCD Distributions
Morphix is a modular distribution of Debian GNU/Linux with LiveCD support. Thus, you simply burn the CD image onto a CD-ROM and boot from the CD to have a working GNU/Linux system, with no hard disk installation. The advantage is that you can try out GNU/Linux without touching your current data. If you like what you see, then installing Morphix on a hard disk is straightforward. Simply click on the icon on the desktop (or choose the installer from the morphix/babytux submenu). But note that Morphix is still experimental and no guarantees are given, so use Morphix at your own risk for now. To obtain the ISO image to burn to your CD visit http://morphix.sourceforge. net.
5.3
Boot
Boot from the suitable bootable CD-ROM. This might be one of the network installer single CD-ROMs from Progeny or Debian, or disk 1 of the Debian CD-ROM set (e.g., it might be called the Debian GNU/Linux Binary1 (nonUS) CD-ROM) or even the Rescue floppy disk. For different hardware
5.4 Installation
41
boot from the appropriate media—for example for a SPARCStation boot from the Sparc CD-ROM.
5.3.1
SPARCStation Boot
Cepheus (Section 5.9.21) is a SPARCStation. At boot time SPARCstation’s are under the control of the Sun OpenBoot. Obtain the OpenBoot prompt with the keyboard L1 (which might be labelled Stop)and A simultaneously. The prompt is a simple “ok”. Note that the prompt can even be obtained from within SILO (the Linux Loader for Sparc) or using the halt command in SILO. Then boot the machine from CD-ROM with: ok boot cdrom
At the boot prompt choose s (SCSI) and the system then boots from the CD-ROM. To boot single user simply use boot -s.
5.3.2
BIOS Not Supporting CD-ROM
On some older machines, like Prefect (Section 5.9.16), the BIOS cannot boot direct from CD-ROM so the machine needs to be booted from floppy disk using MS-Windows Millenium Startup floppy. This recognises the CD-ROM drive as drive D:. So simply run the BOOT command on the CD-ROM: DOS> D: > CD INSTALL > BOOT
5.4 5.4.1
Installation Debian Install
For Debian 3.0 choose to install the 2.4.18 kernel, at the boot prompt enter: boot: bf24
42
Installation
5.4.2
PGI Install
Some advantages: • Much simpler than the laborious Debian install. • Uses the newer grub boot loader. • Uses discover to find hardware and to configure the hardware. Some caveats: • Can’t think of any yet. Install of base takes about 1 hour, depending on network connection. Install of all additional packages can take quite some time, depending on network connection. Connected to a local Debian mirror with high throughput took 1 hour. The default for PGI is to use DHCP (an automated mechanism for obtaining an IP address from a DHCP server) to automatically obtain network information. If you don’t have a DHCP server available then tell the installer using the nodhcp option:
boot: install nodhcp
The PGI install process proceeds to running gnome-tasksel. You can choose not to run this, or else select the tasks you would like installed and leave it to do so from the Progeny archive. Once completed update the installation with defaults for gdm.conf and apt’s /etc/apt/sources.list. Your are then ready to ensure all appropriate packages are installed. Install synaptic to select further packages (after a dist-upgrade). The configuration figlets used by PGI include: dexlet etherconf
X Server configuration Configure the network: wajig reconfigure etherconf
5.5 Base Install
5.5 5.5.1
43
Base Install Keyboard
Choose qwerty/us.
5.5.2
Partitions
Partitioning of hard drive(s) can be tricky for the new user. One day an installation tool might look at the disk size and available disks, ask what the machine will generally be used for, and then make a list of suggestions as to the partitioning. But this is waiting on someone to write the tool to do it! For a discussion of Disk Partitioning see Chapter 67. The simplest of partitioning schemes is to have two partitions, one for swap (2 times available RAM) and the rest as /. This may well suffice. The general wisdom though is to keep / in a smallish partition separate from /tmp, /var, /usr, and /home. This ensures / is not accidentally filled, leading to the operating system freezing. A common suggestion (and my default) is: Swap / /tmp /usr /var /home
2GB 1GB 1GB 5GB 5GB rest
See Bartok (Section 5.9.19) for an example of a different partition scheme.
5.5.3
Configure Devices
This section of the install essentially identifies modules that you want to be loaded whenever the machine is booted. The modules you identify will be listed in /etc/modules. You can always add the modules there yourself later. If using a pre-3.0 Debian install be sure to add a network module (or else ppp if you are connected via a modem through an ISP) so that Debian knows to set up the network.
44
5.5.4
Installation
Networking
During an install you will be asked whether to try DHCP to obtain your network information from a DHCP server. This (usually) requires that you identify your host as a host that your DHCP server knows or relies on the DHCP server allocating the next available IP address. Do so just to see if there is a DHCP server available to you. If a DHCP server is not available then you will be prompted for appropriate network information. Generally you need the following, where some sample addresses are supplied: IP Netmask Gateway Domain DNS
155.229.8.158 255.255.255.192 155.229.8.190 togaware.com 183.44.72.1
The information is recorded in /etc/network/interfaces and /etc/resolv. conf. Later on edit /etc/resolv.conf to add search togaware.com so that you can refer to your local machines by their name, without fully specifying the domain. Some useful commands for trouble shooting are: # netstat -n # ifconfig -a
5.5.5
Time Zone
Generally choose GMT for a GNU/Linux only machine and NO GMT for dual boot machines.
5.5.6
Floppy Boot Disk
It is recommended to create a floppy boot disk if asked as a security blanket during the Debian installation process (you will be asked).
5.5 Base Install
5.5.7
45
Reboot and User Accounts
Once the base system is installed you are asked to reboot the system. Remove the floppy disk and CD-ROM and reboot the machine. Keep the floppy in if this is how you plan to boot into Linux (otherwise you are probably using LILO to book directly into Linux). You will be asked to enter a password for the root account and to create a user account. Do so. In general it is best to log in as a user then use the su command to set the user to be root as needed (e.g., to install packages or modify files in /etc).
5.5.8
Package Selections
You will be asked to install a collection of selected packages. Generally I delay until I’ve got the system basically functioning, then use my own devices to update and install all the packages I want, and hence I skip this step. See Section ?? for details.
5.5.9
EMail: Setup Exim
The default email server for Debian is exim. This can be set up in one of several ways, depending on how you will access your email. The exim configurator will list the options. Generally, for a networked machine (e.g., Altrop (Section 5.9.20)) that is not acting as a mail server, but using a remote smarthost (SMTP server) to send email, yet still delivering email locally (which is obtained using fetchmail, for example, from an IMAP server), you will choose option 2. The information you then supply is: visible name other names domain rely network relay smarthost root email sent to
altrop.togaware.com none none none mailhost.togaware.com kayon
This means that mailhost.togaware.com is used for sending email. Any
46
Installation
email sent from Altrop (Section 5.9.20) to an unqualified address (i.e., no @) will have altrop.togaware.com appended to it and delivered locally.
5.6
Installing Packages
To get started install these from CD-ROM or the Internet: # apt-get install wajig # wajig install ssh emacs21 less finger mtools
5.6.1
Update To Newest Distribution
Add the local server (I add a local mirror plus an Australian mirror at aarnet) and the US server to /etc/apt/sources.list: deb deb deb deb deb deb
http://datamining.csiro.au/pub/debian unstable main contrib non-free http://datamining.csiro.au/pub/debian unstable/non-US main contrib non-free ftp://mirror.aarnet.edu.au/pub/debian unstable main contrib non-free http://ftp.debian.org/debian unstable main contrib non-free http://non-US.debian.org/ unstable/non-US main contrib non-free http://security.debian.org/ stable/updates main contrib non-free
5.6.2
Upgrade
Use the following commands to upgrade your system: # wajig update (Update list of available packages) # wajig dist-upgrade (Update all installed packages and dependencies)
5.6.3
New Packages
New packages can be installed one at a time or as part of a collection using the task selection tool tasksel or gnome-tasksel. A nice graphical alternative in synaptic. Below is a list of packages I commonly install. Place the following list into a file called install:
5.6 Installing Packages
47
acroread alien apt-listchanges apt-utils aspell aspell-doc aspell-en auctex autoconf automake autotools-dev balsa bsdmainutils bsdutils bzip2 catdoc cdrdao cdrecord cdtool communicator cpio cpp cvs dc debconf debconf-doc debconf-utils debhelper debianutils deborphan defoma devhelp-books dialog docbook docbook-dsssl docbook-utils docbook-xml dpkg-dev ebook-dev-ggad eeyes eject elvis-tiny emacs21 emacs21-el enscript eog evolution fakeroot fdutils file finger fortune-mod fortunes-min fping ftp g++ g77 galeon galeon-common gaspell gawk gcc gconf-editor gcvs gdm gedit gettext-el gimp gkdebconf gkrellm gkrellm-gnome gkrellm-volume gkrellmms glabels glade-gnome gnome-applets gnome-audio gnome-commander gnome-common gnome-control-center gnome-core gnome-games gnome-gv gnome-help gnome-help-data gnome-media gnome-office gnome-panel gnome-pim gnome-session gnome-spell gnome-terminal gnome-users-guide gnome-utils gnumeric-doc gnumeric-gda gnumeric-python gnuplot gpaint grep grip groff groff-x11 gs gs-pdfencrypt gsfonts gsfonts-x11 gthumb gtimer gtk-engines-begtk gtk-engines-cleanice gtk-engines-cleanice2 gtk-engines-eazel gtk-engines-flat gtk-engines-gtkstep gtk-engines-icegradient gtk-engines-mac2 gtk-engines-metal gtk-engines-notif gtk-engines-pixmap gtk-engines-raleigh gtk-engines-redmond95 gtk-engines-thinice gtk-engines-xenophilia gtkgraph gtkhtml gzip hdparm hostname html2text hwdata hwtools ifupdown indent info jade jadetex java-common jdk1.1 jdk1.1-dev less lprng lynx lyx make man-db manpages mime-support mkisofs modconf modutils most mozilla mpage mpg321 mtools mutt muttprint nano nautilus-suggested net-tools netbase netpbm nfs-kernel-server
48
Installation
ntp-simple nvi openoffice.org patch pciutils perl perl-doc perl-tk playmidi plotutils powermgmt-base powershell prosper psfontmgr psgml psmisc pstoedit psutils python python-apt python-dev python-doc python-elisp python-gdk-imlib python-glade python-gnome python-gtk python-mysqldb python-numeric python-optik python-soappy python-xml qemacs r-base r-base-dev r-doc-html r-doc-info r-doc-pdf r-gnome r-mathlib r-nonlinear r-recommended rdist rep-gtk-gnome rep-xmms reportbug rpm rstatd rstat-client rsync samba sawfish scrollkeeper setserial sgml-data sgmlspl sharutils sndconfig sox sp splay ssh ssh-askpass ssh-askpass-gnome sudo synaptic sysutils tasksel tcl8.3 tetex-bin tetex-doc tetex-extra tetex-src texinfo time tk8.3 transfig ucf unzip vim wajig wget whiptail whois x-window-system x-window-system-core xclip xdaliclock xearth xfig xfishtank xfonts-cyrillic xfonts-pex xfree86-common xfsprogs xfstt xgalaga xine-ui xletters xloadimage xmeter xmh xmms xmms-alarm xmms-bumpscope xmms-cdread xmms-crossfade xmms-dev xmms-flac xmms-fmradio xmms-goodnight xmms-goom xmms-infinity xmms-jess xmms-lirc xmms-liveice xmms-modplug xmms-msa xmms-osd-plugin xmms-qbble xmms-shell xmms-sid xmms-singit xmms-status-plugin xmms-synaesthesia xmms-volnorm xmms-wmdiscotux xmmsarts xmountains xpdf xpdf-common xpdf-reader xpdf-utils xplanet xplanet-images xscreensaver-gl xscreensaver-gnome xsltproc xsnow
Install them with:
5.7 Kernel Upgrade: 2.2 to 2.4
49
> wajig install -f install
5.7
Kernel Upgrade: 2.2 to 2.4
Upgrading from a 2.2 version kernel to a 2.4 version kernel is straightforward. If using lilo4 you will be required to add the following line to /etc/lilo.conf: initrd=/initrd.img
You are reminded of this on each upgrade. This message can be turned off by adding the following line to /etc/kernel-img.conf: do_initrd=Yes
If using grub none of this is required—the kernel update is automatically added to grub’s menu.
5.8
Initial Configurations
My initial configuration involves making the gdm login screen looking nicer by adding my own graphic, turning off the title bar, editing the welcome message, and adding the System menu. The relevant lines in /etc/gdm/ gdm.conf are: TitleBar=false Logo=/usr/local/share/pixmaps/tux.jpg SystemMenu=true Welcome=Togaware Australia\n\nWelcome to %n\n\nDebian GNU/%s %r %m
I have numerous file systems NFS mounted, as identified in /etc/fstab: ktw:/home ktw:/usr/local ktw:/var/lib/cvs ktw:/ktwnet/altrop 4
/home /usr/local /var/lib/cvs /ktwnet/altrop
nfs nfs nfs nfs
defaults defaults defaults defaults
0 0 0 0
0 0 0 0
The default boot loader for a Debian install is lilo, but a PGI install uses grub so no need to fiddle here.
50
5.9
Installation
Target Machines
Below we illustrate various aspects of the installation and configuration of Debian GNU/Linux on a number of different machines used for different purposes. The sections are being reordered to match when they were installed so that newest installations appear first.
5.9.1
Build (Wayfare)
This is a purpose built desktop used for development. It has a 1GHz Pentium 3 processors, 512MB memory, 20GB of disk and Rage M3 video. A test run used Gnoppix to test basic Linux functionality. All was okay with X running at 1152x864 75Hz. The base install (2 Mar 2004) was with the beta2 Debian Installer, which was under development for the next stable release of Debian. A partition of 12GB was used for / and 1GB for swap. (The rest was for a pre-installed Windows2000 system, drives C and D using about 7GB there.)
Wayfare Specification
From the lspci and lshw commands and /proc/cpuinfo:
5.9 Target Machines
51
Machine: Purpose built, Award Medallion BIOS V6.0 CPU: Intel Pentium III (Coppermine) 1002MHz Bogomips: 2000 Memory: 111MB Network: SiS 900 PCI Fast Ethernet (sis900) Disk: 20GB QUANTUM FIREBALLlct20 20, ATA DISK (/dev/hda) Video: Silicon Integrated Systems SiS630 GUI Accelerator+3D (sis) Audio: C-Media Electronics Inc CM8738 (cmpci) CDRW: LG CD-RW CED-8080B Hostname: wayfare Domainname: togaware.com.au IP Address: 105.229.8.165 Netmask: 255.255.255.192 Broadcast: 105.229.255.255 Gateway: 105.229.8.190 DNS 125.83.72.15 125.83.72.1 Boot: Grub Kernel: 2.4.25-1-686 Wayfare Install Log The beta2 release of the Debian Installer (Netinst) was downloaded as an ISO image from wgethttp://gluck.debian.org/cdimage/testing/netinst/i386/ beta2/sarge-i386-netinst.iso. Boot from the CD-ROM. For the Debian install choose English (Australian). There is no DHCP on the local network so a static network was configured. The disk was partitioned with 19GB for / and 1GB for swap. Reboot. Configure the time zone as Australia/ACT. Add Root and User accounts. For apt choose CDROM. Don’t do any task selection for now. No specific exim4 options need be selected - set up as a local system. Note that to reconfigure, run the base-config program. The resolv.conf didn’t include my usual search line so it was added: search togaware.com
Install ssh and then copy a master sources.list file, followed by apt-get update (the CD is no longer required) and then apt-get install wajig to get things going:
52 # # > > > >
Installation mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list apt-get update apt-get install wajig wajig update wajig dist-upgrade
Now the setup begins. Install emacs21 less most zile. Set up, for the user account, ssh for access to remote accounts if you like, to avoid repeatedly typing a password: > mkdir .ssh > scp ktw:.ssh/id_dsa .ssh/ > scp ktw:.ssh/authorized_keys2 .ssh/authorized_keys > ssh-agent bash > ssh-add Enter passphrase for /home/kayon/.ssh/id_dsa: Identity added: /home/kayon/.ssh/id_dsa (/home/kayon/.ssh/id_dsa)
Now copy setup files from remote hosts: > scp ktw:{.bashrc,.bash_profile} . > scp ktw:{.emacs,.emacs-custom,.emacs-kayon} . > scp ktw:{.xsession,.Xresources} .
Copy the same files for root. Use visudo to set up wajig usage for a user. Install grub: > > > >
wajig install grub sudo grub-install /dev/hda sudo update-grub wajig remove lilo
The configuration should be fine (finding /dev/hda3 as the Linux boot). For convenience, add the following to /etc/kernel-img.conf: postinst_hook = /sbin/update-grub postrm_hook = /sbin/update-grub
5.9 Target Machines
53
Install kernel-image-2.4.25-1-686. Install ntpdate to set the system clock accurately from a reliable server (e.g., ntp.togaware.com). Get X Windows working with the Rage card by installing x-window-system gnome gdm gdm-themes cinepaint xine-ui. I’ve chosen a 1280x1024 resolution for display on a Dell flat panel. Install openoffice.org xmms apache Run tasksel to install groups of packages. Install vrms! And any other packages as appropriate.
54
5.9.2
Installation
Dell Latitude C600 (Inci)
This is a laptop used for developing and delivering presentations and for note taking and working whilst travelling. It has a 1GHz Pentium 3 processors, 512MB memory, 18GB of disk and Rage M3 video. The base install (27 Feb 2004) was with the beta2 Debian Installer, which was under development for the next stable release of Debian. A partition of 12GB was used for / and 1GB for swap. (The rest was for a pre-installed Windows2000 system, drives C and D using about 7GB there.) Inci Specification From the lspci and lshw commands and /proc/cpuinfo: Machine: CPU: Bogomips: Memory: Network: Disk: Video: Audio: CDRW/DVD: Hostname: Domainname: IP Address: Netmask: Broadcast: Gateway: DNS Boot: Kernel:
Latitude C600, BIOS A16 Intel Pentium III (Coppermine) 1.0GHz/700MHz 2000 512MB 3Com 3c556 10/100 Mini PCI Adapter (3c59x) 18GB TOSHIBA MK2017GAP, ATA DISK drive (/dev/hda) Rage Mobility M3 AGP 2x 64MB 66MHz (ati/r128) ES1983S Maestro-3i (maestro3) Samsung CD-RW/DVD-ROM SN-308B, ATAPI CD/DVD-ROM drive inci togaware.com.au 105.229.8.156 255.255.255.192 105.229.255.255 105.229.8.190 125.83.72.15 125.83.72.1 Grub 2.4.24-1-686
Inci Install Log The beta release of the Debian Installer, identified as Sarge i386 Netinst and dated 26 Feb 2004, was downloaded as an ISO image from wgethttp:// gluck.debian.org/cdimage/testing/daily/i386/current/sarge-i386-netinst. iso. This failed to install GRUB - it simply froze. Reverting to the beta2
5.9 Target Machines
55
release from wgethttp://gluck.debian.org/cdimage/testing/netinst/ i386/beta2/sarge-i386-netinst.iso succeeded. Boot from the CD-ROM. For the Debian install choose English (Australian). There is no DHCP on the local network so a static network was configured. Configure the time zone as Australia/ACT. Add Root and User accounts. For apt choose CDROM. Don’t do any task selection for now. No specific exim4 options need be selected - set up as a local system. Note that to reconfigure, run the base-config program. Install ssh and then copy a master sources.list file, follwoed by apt-get update and then apt-get install wajig to get things going: # # > > > >
mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list apt-get update apt-get install wajig wajig update wajig dist-upgrade
Now the setup begins. Install emacs21 less most zile python-glade2 pythongnome2. The resolv.conf didn’t include my usual search line so it was added: search togaware.com
Set up, for the user account, ssh for access to remote accounts if you like, to avoid repeatedly typing a password: > mkdir .ssh > scp ktw:.ssh/id_dsa .ssh/ > scp ktw:.ssh/authorized_keys2 .ssh/authorized_keys > ssh-agent bash > ssh-add Enter passphrase for /home/kayon/.ssh/id_dsa: Identity added: /home/kayon/.ssh/id_dsa (/home/kayon/.ssh/id_dsa)
Now copy setup files from remote hosts:
56
Installation
> scp ktw:{.bashrc,.bash_profile} . > scp ktw:{.emacs,.emacs-custom,.emacs-kayon} . > scp ktw:{.xsession,.Xresources} .
Copy the same files for root. Use visudo to set up wajig usage for a user. Install grub: > > > >
wajig install grub wajig remove lilo sudo grub-install /dev/hda sudo update-grub
Apart from adding a Windows2000 boot option to /boot/grub/menu.lst, the configuration should be fine (finding /dev/hda3 as the Linux boot). For convenience, add the following to /etc/kernel-img.conf: postinst_hook = /sbin/update-grub postrm_hook = /sbin/update-grub
Install kernel-image-2.4.24-1-686. Install ntpdate to set the system clock accurately from a reliable server (e.g., ntp.togaware.com). Get X Windows working with the Rage card by installing x-window-system gnome gdm gdm-themes cinepaint xine-ui. Install openoffice.org xmms apache Run tasksel to install groups of packages. Install vrms. I’ve chosen a 1024x768 resolution. This is not so nice since it can handle 1400x1050, but it does make plugging into data projectors easier. However, the screen goes into a funny mode which can be fixed by Fn-F7 (compress/uncompress). The chosen ranges are 30-100 kHz for hsync and 50-160 Hz for vsync. Simply use wajig reconfigure xserver-xfree86 to force choice of 1024x768 when required.
5.9 Target Machines
5.9.3
57
Compaq Evo N610c (Axel)
NOT YET COMPLETED This is a laptop used for data analysis with 2GHz Pentium 4 processors, 256MB memory, 80GB of disk and 64MB NVIVIA GeFOrce2 with TV-OUT. The base install was with the beta Debian Installer (31 Jan 2004), which was under development for the next stable release of Debian. A partition of 10GB was used for /, and 70GB for /home and 1GB for swap.
Friends Specification From the lspci and lshw commands and /proc/cpuinfo: Machine: CPU: Bogomips: Memory: Network: Disk: Video: Audio: CD/DVD: Hostname: Domainname: IP Address: Netmask: Broadcast: Gateway: DNS Boot:
(e100) nVidia
friends togaware.com.au 105.229.8.158 255.255.255.192 105.229.255.255 105.229.8.190 125.83.72.15 125.83.72.1 Grub
Friends Install Log The beta release of the Debian Installer, identified as Sarge i386 Netinst and dated 31 Jan 2004, was downloaded as an ISO image from wgethttp:// gluck.debian.org/cdimage/testing/netinst/i386/20040131/sarge-i386-netinst. iso. This failed to install the base system. So try the beta2 version from
58
Installation
wgethttp://gluck.debian.org/cdimage/testing/netinst/i386/beta2/sarge-i386-net iso. Boot from CD-ROM. For the Debian install choose English (USA). There is no DHCP on the local network so a static network was configured. Sarge was chosen as the mirror. Configure the time zone as Australia/ACT. Add Root and User accounts. For apt choose http with the US mirrors.kernel.org (testing). Don’t do any task selection for now. No specific exim4 options need be selected - set up as a local system. Note that to reconfigure, run the base-config program. Now the setup begins. Install wajig ssh emacs21 less most zile. The resolv.conf didn’t include my usual search line so it was added: search togaware.com
Set up, for the user account, ssh for access to remote accounts if you like, to avoid repeatedly typing a password: > scp ktw:.ssh/id_dsa .ssh/ > scp ktw:.ssh/authorized_keys2 .ssh/authorized_keys > ssh-agent bash > ssh-add Enter passphrase for /home/kayon/.ssh/id_dsa: Identity added: /home/kayon/.ssh/id_dsa (/home/kayon/.ssh/id_dsa)
Now copy setup files from remote hosts: > scp ktw:{.bashrc,.bash_profile} . > scp ktw:{.emacs,.emacs-custom,.emacs-kayon} . > scp ktw:{.xsession,.Xresources} .
Copy the same files for root. Set up apt appropriately: # # > >
mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list wajig update wajig dist-upgrade
5.9 Target Machines
59
Use visudo to set up wajig usage for a user. Install grub. Install kernelimage-2.4.24-1-686. Install ntpdate to set the system clock accurately from a reliable server (e.g., ntp.togaware.com). Get X Windows working with the nVidia card by installing x-window-system gnome gdm gdm-themes cinepaint xine-ui. Install openoffice.org xmms apache Run tasksel to install groups of packages. Install vrms
60
5.9.4
Installation
Compaq Presario 5740AP (Friends)
This is a web server with 2GHz Pentium 4 processors, 256MB memory, 80GB of disk and 64MB NVIVIA GeFOrce2 with TV-OUT. The base install was with the beta Debian Installer (31 Jan 2004), which was under development for the next stable release of Debian. A partition of 10GB was used for /, and 70GB for /home and 1GB for swap.
Friends Specification From the lspci and lshw commands and /proc/cpuinfo: Machine: CPU: Bogomips: Memory: Network: (e100) Disk: Video: nVidia Audio: CD/DVD: Hostname: friends Domainname: togaware.com.au IP Address: 105.229.8.158 Netmask: 255.255.255.192 Broadcast: 105.229.255.255 Gateway: 105.229.8.190 DNS 125.83.72.15 125.83.72.1 Boot: Grub
Friends Install Log
The beta release of the Debian Installer, identified as Sarge i386 Netinst and dated 31 Jan 2004, was downloaded as an ISO image from wgethttp:// gluck.debian.org/cdimage/testing/netinst/i386/20040131/sarge-i386-netinst. iso. This failed to install the base system. So try the beta2 version from wgethttp://gluck.debian.org/cdimage/testing/netinst/i386/beta2/sarge-i386-net iso.
5.9 Target Machines
61
Boot from CD-ROM. For the Debian install choose English (USA). There is no DHCP on the local network so a static network was configured. Sarge was chosen as the mirror. Configure the time zone as Australia/ACT. Add Root and User accounts. For apt choose http with the US mirrors.kernel.org (testing). Don’t do any task selection for now. No specific exim4 options need be selected - set up as a local system. Note that to reconfigure, run the base-config program. Now the setup begins. Install wajig ssh emacs21 less most zile. The resolv.conf didn’t include my usual search line so it was added: search togaware.com
Set up, for the user account, ssh for access to remote accounts if you like, to avoid repeatedly typing a password: > scp ktw:.ssh/id_dsa .ssh/ > scp ktw:.ssh/authorized_keys2 .ssh/authorized_keys > ssh-agent bash > ssh-add Enter passphrase for /home/kayon/.ssh/id_dsa: Identity added: /home/kayon/.ssh/id_dsa (/home/kayon/.ssh/id_dsa)
Now copy setup files from remote hosts: > scp ktw:{.bashrc,.bash_profile} . > scp ktw:{.emacs,.emacs-custom,.emacs-kayon} . > scp ktw:{.xsession,.Xresources} .
Copy the same files for root. Set up apt appropriately: # # > >
mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list wajig update wajig dist-upgrade
62
Installation
Use visudo to set up wajig usage for a user. Install grub. Install kernelimage-2.4.24-1-686. Install ntpdate to set the system clock accurately from a reliable server (e.g., ntp.togaware.com). Get X Windows working with the nVidia card by installing x-window-system gnome gdm gdm-themes cinepaint xine-ui. Install openoffice.org xmms apache Run tasksel to install groups of packages. Install vrms
5.9 Target Machines
5.9.5
63
Dell Precision 650 (Caravan)
This is a server with dual processors, 4GB memory, SCSI disk with a PERC 320/DC Adaptec controller with 440GB of disk (4 110GB drives). The base install was with the beta Debian Installer (12 Nov 2003), which was under development for the next stable release of Debian. The SCSI controller was not recognised (although Knoppix had no problem with it, loading the percraid module and identifying it as scsi2) but going to tty2 (C-A-F2) and doing a modprobe aacraid (there was no percraid module) then a detect hardware did the trick. A partition of 10GB was used for /, and 420GB for /dmrnet and 10GB (far too much) for swap. Caravan Specification From the lspci and lshw commands and /proc/cpuinfo: Machine: CPU: Bogomips: Memory: Network: Disk: Video: Audio: CD/DVD: Hostname: Domainname: IP Address: Netmask: Broadcast: Gateway: DNS Boot:
Precision WorkStation 650 2 x Intel(R) Xeon(TM) CPU 3.20GHz 6370 4GB 82545EM Gigabit Ethernet Controller (e1000) PERC RAID5C Adaptec AAC-RAID 420GB (aacraid) nVidia NV18GL [Quadro4 NVS AGP 8x] 128MB (nv) Intel 82801DB AC’97 Audio Controller (intel810 audio) caravan togaware.com.au 105.229.8.170 255.255.255.192 105.229.255.255 105.229.8.190 125.83.72.15 125.83.72.1 Grub
Caravan Install Log The beta release of the Debian Installer, identified as Sarge i386 Netinst and dated 9 Nov 2003, was downloaded as an ISO image from http://gluck. debian.org/cdimage/testing/netinst/i386/sarge-i386-netinst.iso.
64
Installation
Booting from CD-ROM was arranged from the BIOS by going into the boot device menu (F12) and choosing CD-ROM. For the Debian install choose English (USA)—choosing Australia results in a bad keyboard amp. There is no DHCP on the local network so a static network was configured. Create partitions: 9GB ext3 for /, 70GB ext3 for /home, and 1GB for swap. Sarge was chosen as the mirror. The driver for the SCSI RAID was loaded by going to another virtual terminal (C-A-F2) and loading it with modprobe aacraid. Then C-A-F1 and Choose Detect Hardware. Now partition the (420GB) into 10GB ext3 for /, 390GB ext3 for /home and 10GB for swap. This is too much for swap - seems to only recognise 2GB. Choose to install GRUB (on hd0), then reboot. Configure the clock as GMT (although it might not be GMT at present, it is the usual set up) and the time zone is Australia/ACT. Choose to use Shadow Passwords. Add Root and User accounts. For apt choose http with the US mirrors.kernel.org. Don’t do any task selection for now. No specific exim4 options need be selected - set up as a satellite system. Note that the hostname remained as localhost. I had to change this as below. Now the setup begins. Install wajig ssh emacs21 less most. Use visudo to set up wajig usage for a user. Install kernel-image-2.4.22-1-686. Correct the host name with the command hostname caravan then emacs /etc/hostname and emacs /etc/hosts. Install ntpdate to set the system clock accurately from a reliable server (e.g., ntp.togaware.com). Install ntp-simple to regularly update the clock. Set up ssh from remote accounts if you like: > scp ktw:.ssh/id_dsa .ssh/ > scp ktw:.ssh/authorized_keys2 .ssh/authorized_keys
Similarly copy any setup files from remote hosts: > scp ktw:{.bashrc,.bash_profile} . > scp ktw:{.emacs,.emacs-custom,.emacs-kayon} . > scp ktw:{.xsession,.Xresources} .
Set up apt appropriately: # mv /etc/apt-get/sources.list /etc/apt-get/sources.list.orig
5.9 Target Machines
65
# scp ktw:/etc/apt-get/sources.list /etc/apt-get/sources.list > wajig update > wajig dist-upgrade
Get X Windows working with the nVidia card by installing x-window-system gnome gdm gdm-themes cinepaint xine-ui.
66
5.9.6
Installation
Dell OptiPlex GX270 (Modern)
This is a desktop machine with modem access, a flat screen (with 4 USB sockets), and a USB mouse. Base install was with the beta Debian Installer (12 Nov 2003), which was under development for the next stable release of Debian. A partition of 9GB was used for /, 65GB from /home and 5GB for swap. With a HP PS2210 all-in-one printer connected through USB the machine’s BIOS (A02) stops for about 5 minutes trying to boot from the printer (presumably because it has a card reader and is being seen as a mass storage device from which it might be able to boot—but without a memory card inserted). This can be turned off by entering BIOS setup (F2 at boot), choosing Integrated Device (LegacySelect Options) and changing the USB Emulation to No Boot. With xfree86 4.3.0 multiple virtual terminals are not (always) supported for the intel 865G graphics card. With kernel-image-2.4.22-1-686 multiple virtual terminals are just fine. With kernel-image-2.4.23-1-686, starting a second X server freezes the system with a black screen. There have been problems with switching virtual terminals in that there is a 30 second delay after switching. There is also a 30 second delay on start up. Clearly something is timing out, and the suspicion is that it is something to do with USB. When hotplug was installed and the module usb-uhci was removed from /etc/modules the delay disappeared.
Modern Specification
Using lspci and lshw commands and /proc/cpuinfo:
5.9 Target Machines Machine: CPU: Bogomips: Memory: Network: Disk: Video: Audio: CD/DVD: Hostname: Domainname: IP Address: Netmask: Broadcast: Gateway: DNS
67
OptiPlex GX270 Intel(R) Pentium(R) 4 CPU 2.80GHz 5570 512MB 82540EM Gigabit Ethernet Controller (e1000) ATA Disk 74GB /dev/hda (9G/60G/5G) Intel 82865G Integrated Graphics Device (i810) Intel 82801EB AC’97 Audio Controller (intel810 audio) SAMSUNG CDRW/DVD SM-348B modern togaware.com.au 105.229.8.170 255.255.255.192 105.229.255.255 105.229.8.190 125.83.72.15 125.83.72.1
Modern Install Log This is identified as the Sarge i386 Netinst dated 9 Nov 2003, and the ISO image was downloaded from http://gluck.debian.org/cdimage/testing/ netinst/i386/sarge-i386-netinst.iso. Simply boot from CD-ROM by going into the boot device menu (F12). Choose English (USA)—choosing Australia resulted in bad keyboard. There is no DHCP set up on the local network so set up a static network. Choose sarge as the mirror. Partition the 80GB disk into 10GB ext3 for /, 65GB ext3 for /home, and 5GB for swap. Choose LILO (but should have chosen GRUB). Reboot. Now configure with GMT, Australia/ACT, using Shadow Passwords. Create Root and User accounts. For apt choose the http US mirrors.kernel.org. For configuring exim choose act.cmis.csiro.au, smarthost mailhost.act.cmis.csiro.au. Problems included DHCP failing and requiring the user to skip menus over to the set static network choice. The hostname remained localhost and had to be reset later. The clock was really not GMT but I said it was because I want it to be. Now install wajig, ssh, emacs21, less, and most. Set up visudo for wajig usage by users. Replace LILO with Grub using
68 # # # #
Installation grub-install /dev/hda update-grub wajig remove lilo reboot
Add update-grub to /etc/kernel-img.conf: postinst_hook = /sbin/update-grub postrm_hook = /sbin/update-grub
and then install kernel-image-2.4.22-1-686. Correct the host name: hostname modern; emacs /etc/hostname. Install ntp-simple to regularly check the time against a network time server (e.g., ntp.togaware.com). Also install ntpdate to initially set the time at boot time. Set up ssh scp ktw:.ssh/id dsa .ssh/ and scp ktw:.ssh/authorized keys2 .ssh/authorized keys. Copy setup files .bashrc .bash profile .emacs .emacs-custom .emacs-kayon .xsession Copy sources.list; wajig update; wajig dist-upgrade Get X Windows Working with the nVidia card. Install x-window-system gnome gdm gdm-themes cinepaint xine-ui. Get X Windows working. It had an unknown chipset (82865G) so move to xserver-xfree86 4.3.0-0pre1v4 from experimental. 8 bit worked, but from the BIOS set graphic memory to report 16MB (not 1MB) and then 24 bit works! To get the usb mouse working modprobe usb-uhci did the trick! With hotplug installed the appropriate kernel modules will be automatically loaded. Install x-window-system gnome gdm gdm-themes cinepaint xine-ui. Get DVD stuff working: create /dvd, edit fstab to reflect, ln /dev/dvd to /dev/cdrom0, add users to group cdrom to access dvd for view. Install ica client, and pppconfig. With X multiple windows (C-A-F7, C-A-F1) there are problems (not supported). With 2 gdm screens the screen blanks every 10 minutes or so. Need to C-A-F8 C-A-F7 to recover, but quite slow (seems like a 30 second time out). So go back to one gdm and no problem (except 30 second delay on startup and switching terminals)! Just after a boot, using usbmgr, connecting a USB camera recognises it as /dev/sdb1 (presumably because the printer’s card reader is seen as /dev/ sda1 initially). After disconnecting, the kernel module is unloaded and when the camera is next connected it becomes /dev/sda1! Using hotplug instead does the right thing (always loading it as /dev/sdb1. A USB flash drive
5.9 Target Machines
69
memory stick can be plugged in and is seen as /dev/sdc1 and mounted as /flash.
70
5.9.7
Installation
Dell OptiPlex GX150 (Fairmond)
A trial run of Debian GNU/Linux 3.0 using the GNOPPIX GNU/Linux live CD was attempted (25 Sep 2003). Booted just fine but the install to hard disk is still under development. Also trialled both the sarge (testing) netinst and the sid (unstable) install CD-1, but both failed. So used Debian 3.0r1 to install and upgraded immediately to unstable.
GNOPPIX 0.5.4-1 GNOPPIX version 0.5.4-1 was downloaded:
wget ftp://source.rfc822.org/pub/local/gnoppix/gnoppix-0.5.5-2.iso
Then booted with:
credativ lang=en wheelmouse screen=1280x1024
Works just fine. Choose to install to hard disk from the icon. This allowed the disk to be partitioned and configured, but there were problems on reboot with the tty1 printing / as -. So use a traditional install.
Sarge Netinst 25-Sep-2003 16:16 Try the current testing netinst:
wget http://gluck.debian.org/cdimage/testing/netinst/i386/sarge-i386-netinst.iso
Simply boot then choose English (Australia), us keyboard, cdrom, load kernel modules, installer modules (none chosen), skip PCMCIA, find network and configure, configure static network: fairmont, act.cmis.csiro.au, 125.83.72.15 125.83.72.1, 105.229.8.169, 255.255.255.192, 105.229.8.190, mirror http US ftp.us.debian.org sarge, hardware and kernel drivers, partition (/dev/hda1 / 36GB ext2, Swap 1GB), create filesystems, base install, ERRORS....
5.9 Target Machines
71
Sid 09/21/03 00:58:00 wget ftp://ftp.fsn.hu/pub/CDROM-Images/debian-unofficial/sid/sid-i386-1.iso
Failed again in the installation process. Not ready yet! Debian 3.0r1 Boot using Debian 3.0r1 CD-ROM with: boot> bf24
Choose en, English (United States), qwerty/us, partition /dev/hda (/dev/hda1 / 36GB ext2, Swap 1GB), initialise swap, initialise partitions, modules (kernel/net 3c59x), network (fairmond, 105.229.8.169, 255.255.255.192, 105.229.8.190, act.cmis.csiro.au, 125.83.72.15 125.83.72.1), base system, bootable (lilo in mbr), create a boot floppy, remove floppy and CD, reboot. After reboot set up GMT, Australia/ACT, no md5 passwords, enable shadow passwords, root password, normal user: kayon, remove pcmcia, no PPP, apt from cdrom (insert 3.0r1 CD), no tasksel, no dselect, continue with package installation with defaults, exim: 2, fairmond.togaware.com, none, none, none, mailhost.togaware.com, kayon. Base installation is complete. Install discover in case some hardware can still be identified (like network cards). Now set up the system. First, apt-setup to add other sources of packages, in particular, to add unstable, and then install wajig. Install grub (grub-install /dev/hda; update-grub), remove lilo, and reboot. Then upgrade the whole distribution to unstable. Use tasksel to install Desktop (fails with abiword/abiword-gnome conflict, so install gnome and x-window-system instead), Linux Standard Base, File Server, Unix Server, Java, C/C++, Python, LaTeX, Scientific. Might also need: cupsys acroread acroread-plugin rubber. Fairmond Specification The lshw command (abbreviated) gives:
72
Hostname fairmond Address 105.229.8.169 Netmask 255.255.255.192 Broadcast 105.229.255.255 Gateway 105.229.8.190 DNS 125.83.72.15,125.83.72.1 Domain togaware.com
Installation
5.9 Target Machines
5.9.8
73
Dell OptiPlex GX240 (Bigdaddy)
Debian GNU/Linux 2.2r2 was installed from a Debian CD-ROM (2002) and then upgraded to unstable 6 August 2003.
Bigdaddy Specification
The lshw command was used to obtain the following:
bigdaddy Dell OptiPlex GX240 capabilities: smbios-2.3 dmi-2.3 BIOS A03 (03/01/2002) 64KB (capacity: 448KB) capabilities: isa pci pnp apm upgrade shadowing escd cdboot bootselect edd int13floppytoshiba int5printscreen int9keyboard int14serial int17printer PU Intel(R) Pentium(R) 1.70GHz version: 15.1.2 1700MHz (capacity: 2400MHz) clock: 100MHz capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm Internal L1 write-back Cache (data cache) 8KB Internal L2 Cache 256KB Memory 512MB (capacity: 1GB) DIMM SDRAM Synchronous 133 MHz (7.5 ns) 64 bits 512MB 133MHz (7.5188ns) PCI Network driver=3c59x irq=18 capabilities: bus_master cap_list IDE ATA Disk MAXTOR 6L040L2 /dev/hda version: A93.0500 37GB capabilities: ata dma lba iordy smart security pm configuration: mode=udma5 smart=on IDE DVD reader SAMSUNG CDRW/DVD SM-308B /dev/hdc version: T100 capabilities: atapi cdrom removable nonmagnetic dma lba iordy audio cd-r cd-rw dvd
74 Hostname bigdaddy Address 105.229.9.9 Netmask 255.255.255.192 Broadcast 105.229.255.255 Gateway 105.229.8.190 DNS 125.83.72.15 125.83.72.1 Domain togaware.com
Installation
5.9 Target Machines
5.9.9
75
Dell OptiPlex GX260 (Vince)
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (15 Apr 2003). This desktop machine is considered a production machine and so needs to stay with the stable release. However this machine requires XFree 4.3. The XFree86 documentation said the video chipset (Intel i845) was only supported in version 4.3.0, which is only available in Debian packaged for the unstable distribution. The vesa driver in XFree86-4.1.0 is an option but has serious problems. Even with the Debian testing release there were problems with the vesa driver. The solution was better kernel support of the devices. But before considering this option think about buying an extra video card or at least have a read of http://support.intel.com/support/graphics/intel845g/screen.htm to decide if the features on offer are going to be worth the trouble. A first attempt was to install XFree86 4.3.0 from the tar files provided by xfree86.org. This works but it lives outside the Debian package system and might break your package management system at some stage down the track, although this is usually easily managed. Intel does provide some information from http://support.intel.com/support/ graphics/linux/index.htm Intel indicates that xfree86-4.2.0 is required, which means using Debian’s testing distribution at the moment. See the Debian Reference for how to upgrade your distribution from stable to testing. Some BIOS changes: Video DAC Snoop = ON Legacy Video Memory = 8Mb AGP window max = 256Mb (the maximum available)
Get the appropriate drivers from Intel at http://support.intel.com/support/ graphics/linux.htm. The tarball is i830-2003030120-i386-linux.tar.gz Before compiling the drivers Get the kernel-headers. This is needed so the Intel driver code can fit correctly into your running kernel. The testing distribution of Debian uses kernel 2.4.20. For kernel 2.4.20, debian changed the layout of the headers package — it is no longer kernel-headers-2.4.20-686, but kernel-build-2.4.20/¡arch¿ and you get all the relevant architectures.
76
Installation
# cd /usr/src # ln -s kernel-build-2.4.20/686 linux
Build the drivers Now unpack the Intel driver tarball, anywhere you like. The tarball unpacks to a directory called dripkg. # cd dripkg # sh ./install.sh
The install script prompts you for the information it needs, and keeps a log of what it does. You need to run it as root. The compilation can fail if the /usr/src/linux link is not pointing to the right place (see above), or the kernel version is too old (less than 2.4.11). As part of the install script, the newly built files are installed at the locations shown below. Any preexisting files are moved to a file of the same name with a “.dri-old” suffix. dripkg/i830/i810_drv.o /usr/X11R6/lib/modules/drivers/i810_drv.o dripkg/i830/i830_dri.so /usr/X11R6/lib/modules/dri/i830_dri.so dripkg/drm/i830.o /lib/modules/2.4.20-686/kernel/drivers/char/drm/i830.o dripkg/agpgart/agpgart.o /lib/modules/2.4.20-686/kernel/drivers/char/agp/agpgart.o dripkg/core/libdri.a /usr/X11R6/lib/modules/extensions/libdri.a dripkg/core/libdrm.a /usr/X11R6/lib/modules/linux/libdrm.a dripkg/core/libpcidata.a /usr/X11R6/lib/modules/libpcidata.a dripkg/core/libscanpci.a /usr/X11R6/lib/modules/libscanpci.a
(Note that the set of files and the locations will likely be different on your system.) The fact these modules replace ones provided by the packaging system may break the packaging system to some extent, but to a far smaller extent than installing XFree86-4.3 from a tarball or from source. Configure your X server
5.9 Target Machines
77
This is quite simple once you have the correct hardware support. All you really need is the line Driver “i810” in the Device section. In the Screen section, start with a default graphics depth of 16. This is what Intel recommend. It may help to specify a VideoRam size, but it’s not required. Resolutions 1024x768 and 1280x1024 work at 16 and 24 bits and seems to do the 3D graphics things (running glxinfo and glxgears to verify this). VESA driver Messing around with VESA modes in XFree86 4.2.1 did not help with this chipset. The drivers only work for a little while. The failure was that once you switch VTs or restart the X server, the screen goes black. Sometimes the card seems to go into the correct video mode (verify this using the menu buttons on the monitor) but when the screen is a uniform black you can’t do much useful work. There was one other mode of failure, where the screen had strange colours. This may have been an incorrect pixmap depth problem, or possibly a bad video modeline (though I find it hard to accept the latter, I let vbe/ddc do its thing.) The upgrade described in this note makes no real difference to these problems with the vesa driver. Presumably this is because the upgrade doesn’t affect the relevant bits of the system.
78
5.9.10
Installation
Dell Optiplex GX260 (Festival)
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (29 Nov 2002). This desktop machine is used for data analysis and desktop environment. Lilo was replaced by grub. The NIC (e1000) was not supported in the default 2.4.18 kernel. A kernelimage-2.4.19 was installed but again did not support the NIC. A kernelimage-2.4.20-pre11 was compiled for the machine (at the time the 2.4.20 was not released) and worked just fine. When it was released kernel-image2.4.20 was installed and worked just fine (and the NIC worked after insmod e1000—add e1000 to /etc/modules). Installed ssh to get things started with standard configs, startup files and passwd/group files copied from the server (Altrop (Section 5.9.20)). Installed gdm and then run a simple script to place the standard setup files in the appropriate locations. Installed wajig to get the show on the road! The on-board video was at first run using vesa because XFree86 4.2.1 does not have a driver for the 82845G AGP. It is supported in XFree86 4.3 (the i810 driver) which at the time was not released. The video works just fine. Until 4.3 is officially released you can add the following to /etc/apt/sources. list:
deb http://www.penguinppc.org/~daniels/sid/\$(ARCH) ./
and then do the following:
> wajig update > update upgrade
5.9 Target Machines
79
Festival Specification CPU BogoMIPS RAM Disk
Intel(R) Pentium(R) 4 CPU 2.40GHz 4771 512MB 80GB (/dev/hda) 75GB (/dev/hda1) ext2 root 5GB (/dev/hda2) swap CDRW/DVD (/dev/hdc) NIC 82540EM Gigabit Ethernet Controller Intel PRO/1000 (e1000) Video Intel 82845G/GL [Brookdale-G] Chipset (i810) Audio Intel 82801DB AC’97 (i810 audio)
The lspci command gives:
00:00.0 00:02.0 00:1d.0 00:1d.1 00:1d.2 00:1d.7 00:1e.0 00:1f.0 00:1f.1 00:1f.3 00:1f.5 01:0c.0
Host bridge: Intel Corp.: Unknown device 2560 (rev 01) VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01) USB Controller: Intel Corp.: Unknown device 24c2 (rev 01) USB Controller: Intel Corp.: Unknown device 24c4 (rev 01) USB Controller: Intel Corp.: Unknown device 24c7 (rev 01) USB Controller: Intel Corp.: Unknown device 24cd (rev 01) PCI bridge: Intel Corp. 82820 820 (Camino 2) Chipset PCI (rev 81) ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01) IDE interface: Intel Corp.: Unknown device 24cb (rev 01) SMBus: Intel Corp.: Unknown device 24c3 (rev 01) Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01) Ethernet controller: Intel Corp.: Unknown device 100e (rev 02)
Festival Install Hostname uramys1 Address 125.83.88.13 Netmask 255.255.255.0 Broadcast optional Gateway 125.83.88.177 DNS 183.44.72.1 Domain togaware.com
80
Installation
Install Kernel 2.4.20 At the time of installing the NIC card (e10000) was not supported by the available Debian kernels. Kernel 2.4.20 fixed this. A kernel was compiled from source and patched up to 2.4.20-pre11. The default .config (i.e., starting from no .config file) was the starting point. Below is recorded the specific configurations added. # # # # # # #
# # # #
cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz tar zxvf linux-2.4.19.tar.gz cd linux-2.4.19 gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4 make menuconfig Processor type and features Processor family CONFIG_MPENTIUM4=y #General: Seem to get ‘‘Can’t get display ID errors’’ # CONFIG_APM=y # CONFIG_APM_DO_ENABLE=y # CONFIG_APM_CPU_IDLE=y # CONFIG_APM_DISPLAY_BLANK=y # CONFIG_APM_RTC_IS_GMT=y Block devices RAM disk support CONFIG_BLK_DEV_RAM=y Initial RAM disk (initrd) support CONFIG_BLK_DEV_INITRD=y Network device support Ethernet (1000 Mbit) CONFIG_E1000=y Sound CONFIG_SOUND_ICH=y make-kpkg clean make-kpkg --append-to-version -gjw --revision edm01 --initrd kernel_image cd .. wajig install kernel-image-2.4.19-gjw_edm01_i386.deb
This works just fine and all standard drivers (CDROM and NFS) were included by default and the e1000 support included in the kernal. The result-
5.9 Target Machines
81
ing kernel is quite a bit smaller that the kernels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules cf 20MB)!
82
5.9.11
Installation
Dell Optiplex GX260 (Uramys1)
Debian GNU/Linux 3.0 was installed from a Debian CD-ROM (28 Nov 2002). This desktop machine is to be used as a server for CVS, apache, and other services. The NIC (e1000) was not supported in the default 2.4.18 kernel. A kernel-image-2.4.20-pre11 was compiled for the machine. Lilo was replaced by grub and The on-board video is run using vesa because XFree86 4.2.1 does not have a driver for the 82845G AGP. See Festival (Section 5.9.10) for further details.
Uramys1 Specification CPU BogoMIPS RAM Disk
Intel(R) Pentium(R) 4 CPU 2.40GHz 4771 512MB 80GB (/dev/hda) 6GB (/dev/hda5) ext2 root 2GB (/dev/hda6) swap 40GB (/dev/hda7) ext2 30GB (/dev/hda7) ext2 DVD/CDRW (/dev/hdc) NIC 82540EM Gigabit Ethernet Controller Intel PRO/1000 (e1000) Video Intel 82845G/GL [Brookdale-G] Chipset (i810) Audio Intel 82801DB AC’97 (i810 audio) The lspci command gives:
00:00.0 00:02.0 00:1d.0 00:1d.1 00:1d.2 00:1d.7 00:1e.0 00:1f.0 00:1f.1 00:1f.3 00:1f.5 01:0c.0
Host bridge: Intel Corp.: Unknown device 2560 (rev 01) VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01) USB Controller: Intel Corp.: Unknown device 24c2 (rev 01) USB Controller: Intel Corp.: Unknown device 24c4 (rev 01) USB Controller: Intel Corp.: Unknown device 24c7 (rev 01) USB Controller: Intel Corp.: Unknown device 24cd (rev 01) PCI bridge: Intel Corp. 82820 820 (Camino 2) Chipset PCI (rev 81) ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01) IDE interface: Intel Corp.: Unknown device 24cb (rev 01) SMBus: Intel Corp.: Unknown device 24c3 (rev 01) Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01) Ethernet controller: Intel Corp.: Unknown device 100e (rev 02)
5.9 Target Machines
83
Uramys1 Install Hostname uramys1 Address 125.83.88.13 Netmask 255.255.255.0 Broadcast optional Gateway 125.83.88.177 DNS 183.44.72.1 Domain togaware.com Install Kernel 2.4.20 At the time of installing the NIC card (e10000) was not supported by the available Debian kernels. Kernel 2.4.20 fixed this. A kernel was compiled from source and patched up to 2.4.20-pre11. The default .config (i.e., starting from no .config file) was the starting point. Below is recorded the specific configurations added. # # # # # # #
cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz tar zxvf linux-2.4.19.tar.gz cd linux-2.4.19 gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4 make menuconfig Processor type and features Processor family CONFIG_MPENTIUM4=y General CONFIG_APM=y CONFIG_APM_DO_ENABLE=y CONFIG_APM_CPU_IDLE=y CONFIG_APM_DISPLAY_BLANK=y CONFIG_APM_RTC_IS_GMT=y Block devices RAM disk support CONFIG_BLK_DEV_RAM=y Initial RAM disk (initrd) support CONFIG_BLK_DEV_INITRD=y Network device support Ethernet (1000 Mbit)
84
Installation CONFIG_E1000=y Sound
CONFIG_SOUND_ICH=y # make-kpkg clean # make-kpkg --append-to-version -gjw --revision sis01 --initrd kernel_image # cd .. # wajig install kernel-image-2.4.19-gjw_sis01_i386.deb
This works just fine and all standard drivers (CDROM and NFS) were included by default and the e1000 support included in the kernal. The resulting kernel is quite a bit smaller that the kernels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules cf 20MB)!
5.9 Target Machines
5.9.12
85
Optima (Vivaldi)
Debian GNU/Linux 3.0 was installed from the Debian CD-ROM (8 November 2002). This server is used as a data server for a work group of policy researchers using a mixture of MSWindows-2000 and Linux machines. Debian GNU/Linux 3.0 was installed. The NIC (eepro100) was not recognised. The additional IDE CMD680s card were not recognised by kernel 2.4.18. The main challenge was the fact that the machine had an ASUS P4B533VM motherboard with on board network interface card. It also had two additional IDE cards (CMD680) for additional disks. This mother board is best supported under kernel 2.4.20 and beyond. The default 2.4.18 installed fine but the CMD680’s were not recognised. Kernel 2.4.19 recognised the CMD680’s but not the on-board IDE so booting was a problem! Kernel 2.4.20 had not been released so a pre-release was compiled (pre11). That worked just fine. The on-board video was originally run as vesa because XFree86 4.2.1 does not have a driver for the 82845G AGP. See Festival (Section 5.9.10) for further details. Grub was installed but this resulted in a strange error: root (hd0,0) Filesystem type is ext2fs, partition type 0x83 kernel /Vmlinuz-2.4.20-pre11-p4 ro root= [Linux-bzImage, setup=0x1400, size=0x10ea0d] Error 28: Selected item cannot fit into memory
Reverting to lilo fixed the problem! However, at a later stage (27 June 2003) a new kernel was installed (kernel-image-2.4.21-1-686) and the next reboot stopped at LIL. To recover boot from a Debian CD using a rescue kernel: linux: rescbf24 root=/dev/hda1
Lilo could not be fixed easily so instead grub was again installed, and work just fine.
86
Installation
Another problem is that on occasions the power up gets no further than checking the first IDE and reporting Primary master disk fails. This is well before Linux even comes in to play and seems to indicate some serious hardware problem.
Vivaldi Specification CPU BogoMIPS RAM Disk
CD-ROM NIC Video Audio
Intel(R) Pentium(R) 4 CPU 2.00GHz 4023.91 512MB 80GB ST380021A, ATA DISK drive (/dev/hda) 80GB ST380021A, ATA DISK drive (/dev/hdd) 60GB ST360021A, ATA DISK drive (/dev/hde) 80GB ST380021A, ATA DISK drive (/dev/hdf) 60GB ST360021A, ATA DISK drive (/dev/hdg) 60GB ST360021A, ATA DISK drive (/dev/hdh) (/dev/hdj) ATAPI-CD ROM-DRIVE-52MAX, ATAPI CD/DVD-ROM drive (/dev/hdb) Intel Corp. 82801BD PRO/100 VE (CNR)(eepro100) Intel 845G Chipset 82845G/GL Brookdale-G (i810) Intel ICH4 AC’97 codec (i810 audio)
The lspci command gives:
00:00.0 00:02.0 00:1d.0 00:1d.1 00:1d.2 00:1d.7 00:1e.0 00:1f.0 00:1f.1 00:1f.5 01:08.0 01:09.0 01:0b.0
Host bridge: Intel Corp.: Unknown device 2560 (rev 01) VGA compatible controller: Intel Corp.: Unknown device 2562 (rev 01) USB Controller: Intel Corp.: Unknown device 24c2 (rev 01) USB Controller: Intel Corp.: Unknown device 24c4 (rev 01) USB Controller: Intel Corp.: Unknown device 24c7 (rev 01) USB Controller: Intel Corp.: Unknown device 24cd (rev 01) PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 81) ISA bridge: Intel Corp.: Unknown device 24c0 (rev 01) IDE interface: Intel Corp. 82801DB ICH4 IDE (rev 01) Multimedia audio controller: Intel Corp.: Unknown device 24c5 (rev 01) Ethernet controller: Intel Corp.: Unknown device 103a (rev 81) RAID bus controller: CMD Technology Inc PCI0680 (rev 01) RAID bus controller: CMD Technology Inc PCI0680 (rev 01)
5.9 Target Machines
87
Vivaldi Install Hostname vivaldi Address 155.229.8.158 Netmask 255.255.255.192 Broadcast optional Gateway 155.229.8.190 DNS 125.83.72.1 Domain togaware.com For information on the AGP see http://www.intel.com/support/graphics/ intel845g/linux.htm and http://www.xfree86.org/~dawes/845driver. html.
Install Kernel 2.4.20 Two IDE controllers (Silicon Image CMD680) were installed delivering disks /dev/hde, /dev/hdg, /dev/hdh, and /dev/hdj. At the time of installing the CMD680 IDE controller chip kernel 2.4.19 was available as a Debian package but had did not recognise the IDE card on the motherboard. Kernel 2.4.20 fixed this, but was not released nor available for Debian. A kernel was compiled from source and patched up to 2.4.20-pre11. The default .config (i.e., starting from no .config file) was the starting point. Below is recorded the specific configurations added. # # # # # # #
cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz wget http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.20-pre11.gz tar zxvf linux-2.4.19.tar.gz cd linux-2.4.19 gzip -dc ../patch-2.4.20-pre11.gz | patch -p1 -N -F4 make menuconfig Processor type and features Processor family CONFIG_MPENTIUM4=y General CONFIG_APM=y CONFIG_APM_DO_ENABLE=y CONFIG_APM_CPU_IDLE=y CONFIG_APM_DISPLAY_BLANK=y
88
# # # #
Installation CONFIG_APM_RTC_IS_GMT=y Block devices RAM disk support CONFIG_BLK_DEV_RAM=y Initial RAM disk (initrd) support CONFIG_BLK_DEV_INITRD=y ATA/IDE/MFM/RLL support IDE, ATA and ATAPI Block devices CONFIG_BLK_DEV_CMD64X=y CONFIG_BLK_DEV_CMD680=y Sound CONFIG_SOUND_ICH=y make-kpkg clean make-kpkg --append-to-version -p4 --revision dha01 --initrd kernel_image cd .. wajig install kernel-image-2.4.19-p4_dha01_i386.deb
This works just fine and all standard drivers (CDROM and NFS and EEPRO100) were included by default. The resulting kernel is quite a bit smaller that the kernels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules cf 20MB)!
5.9 Target Machines
5.9.13
89
Dell Precision 620 (Brick)
Debian GNU/Linux 3.0 was installed from a Debian netinst PGI CD-ROM (2 October 2002). This machine is used as a database server.
Brick Specification CPU BogoMIPS RAM Disk
Pentium III (Coppermine) 1848.11 900MB 8GB (/dev/sda) 34GB (/dev/sdb) (/dev/hdc)
DVD-ROM CD-RW NIC 3c905C-TX/TX-M [Tornado] (3c59x) Video nVidia Corporation NV10 (GeForce 256) Audio Crystal 4280/46xx + AC97 Audio (cs46xx) The lspci command gives: 00:00.0 Host bridge: Intel Corp. 82840 840 (Carmel) Chipset Host Bridge (Hub A) (rev 01) 00:01.0 PCI bridge: Intel Corp. 82840 840 (Carmel) Chipset AGP Bridge (rev 01) 00:02.0 PCI bridge: Intel Corp. 82840 840 (Carmel) Chipset PCI Bridge (Hub B) (rev 01) 00:1e.0 PCI bridge: Intel Corp. 82801AA PCI Bridge (rev 02) 00:1f.0 ISA bridge: Intel Corp. 82801AA ISA Bridge (LPC) (rev 02) 00:1f.1 IDE interface: Intel Corp. 82801AA IDE (rev 02) 00:1f.2 USB Controller: Intel Corp. 82801AA USB (rev 02) 00:1f.3 SMBus: Intel Corp. 82801AA SMBus (rev 02) 01:00.0 VGA compatible controller: nVidia Corporation NV10 [GeForce 256 SDR] (rev 10)02:1f.0 PCI bridge: Intel Corp. 82806AA PCI64 Hub PCI Bridge (rev 03) 03:00.0 PIC: Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller (rev 01) 04:04.0 Multimedia audio controller: Cirrus Logic CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] (rev 01) 04:05.0 SCSI storage controller: Adaptec AIC-7899P U160/m (rev 01) 04:05.1 SCSI storage controller:
90
Installation
Adaptec AIC-7899P U160/m (rev 01) 04:07.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
Brick Install Hostname brick Address 155.229.8.165 Netmask 255.255.255.192 Broadcast optional Gateway 155.229.8.190 DNS 183.44.72.1 Domain togaware.com
5.9 Target Machines
5.9.14
91
Dell Precision 620 (Atom)
Debian GNU/Linux 3.0 was installed from a Debian netinst PGI CD-ROM (2 October 2002). This machine is used as a database server.
Atom Specification CPU BogoMIPS RAM Disk
Pentium III (Coppermine) 1854.66 1GB 8GB (/dev/sda) 34GB (/dev/sdb) (/dev/hdc)
DVD-ROM CD-RW NIC 3c905C-TX/TX-M [Tornado] (3c59x) Video nVidia Corporation NV10 (GeForce 256) Audio Crystal 4280/46xx + AC97 Audio (cs46xx) The lspci command gives: 00:00.0 Host bridge: Intel Corp. 82840 840 (Carmel) Chipset Host Bridge (Hub A) (rev 01) 00:01.0 PCI bridge: Intel Corp. 82840 840 (Carmel) Chipset AGP Bridge (rev 01) 00:02.0 PCI bridge: Intel Corp. 82840 840 (Carmel) Chipset PCI Bridge (Hub B) (rev 01) 00:1e.0 PCI bridge: Intel Corp. 82801AA PCI Bridge (rev 02) 00:1f.0 ISA bridge: Intel Corp. 82801AA ISA Bridge (LPC) (rev 02) 00:1f.1 IDE interface: Intel Corp. 82801AA IDE (rev 02) 00:1f.2 USB Controller: Intel Corp. 82801AA USB (rev 02) 00:1f.3 SMBus: Intel Corp. 82801AA SMBus (rev 02) 01:00.0 VGA compatible controller: nVidia Corporation NV10 [GeForce 256 SDR] (rev 10)02:1f.0 PCI bridge: Intel Corp. 82806AA PCI64 Hub PCI Bridge (rev 03) 03:00.0 PIC: Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller (rev 01) 04:04.0 Multimedia audio controller: Cirrus Logic CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] (rev 01) 04:05.0 SCSI storage controller: Adaptec AIC-7899P U160/m (rev 01) 04:05.1 SCSI storage controller:
92
Installation
Adaptec AIC-7899P U160/m (rev 01) 04:07.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
Atom Install Hostname atom Address 155.229.8.164 Netmask 255.255.255.192 Broadcast optional Gateway 155.229.8.190 DNS 183.44.72.1 Domain togaware.com
5.9 Target Machines
5.9.15
93
Optima WorkPro (Bach)
Debian GNU/Linux 3.0 was installed from a Progeny netinst CD-ROM (28 June 2002). This desktop machine is to be used for data analysis by a government department. After installation a new IDE card was installed (CMD680) with two IDE 60GB hard drives. This required at least version 2.4.19 of the kernel. I have also had feedback from another user at the University of London who has three cards running on a machine with kernel 2.4.19.
Bach Specification CPU BogoMIPS RAM Disk
Intel(R) Pentium(R) 4 CPU 1.70GHz 3381 650M ST360021A, ATA DISK drive 60GB (/dev/hda) ST360021A, ATA DISK drive 60GB (/dev/hdb) DVD-ROM SONY DVD-ROM DDU1621 S1.6 (/dev/hdc) NIC Intel Corp. 82820 (ICH2) Chipset Ethernet Controller (eepro100) Video nVidia Corporation NV6 [Vanta] Audio Intel 810 + AC97 Audio (i810, i810 audio, ac97 codec) The lspci command gives:
00:00.0 00:01.0 00:1e.0 00:1f.0 00:1f.1 00:1f.2 00:1f.4 00:1f.5 01:00.0 02:08.0
Host bridge: Intel Corp. 82845 845 (Brookdale) Chipset Host Bridge (rev 04) PCI bridge: Intel Corp. 82845 845 (Brookdale) Chipset AGP Bridge (rev 04) PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 05) ISA bridge: Intel Corp. 82801BA ISA Bridge (LPC) (rev 05) IDE interface: Intel Corp. 82801BA IDE U100 (rev 05) USB Controller: Intel Corp. 82801BA/BAM USB (Hub #1) (rev 05) USB Controller: Intel Corp. 82801BA/BAM USB (Hub #2) (rev 05) Multimedia audio controller: Intel Corp. 82801BA/BAM AC’97 Audio (rev 05) VGA compatible controller: nVidia Corporation NV6 [Vanta] (rev 15) Ethernet controller: Intel Corp. 82801BA/BAM/CA/CAM Ethernet Controller (rev 03)
94
Installation
Bach Install Hostname bach Address 155.229.8.158 Netmask 255.255.255.192 Broadcast optional Gateway 155.229.8.190 DNS 183.44.72.1 Domain togaware.com Passwords using MD5 was turned off (DES instead used) as I think this is the same as the server of the network into which this host will connect. The second IDE disk was formatted: # cfdisk /dev/hdb ; mkfs.ext2 /dev/hdb1
Then /etc/fstab was updated: /dev/hdb1 /ktnet/bach ext2 defaults,errors=remount-ro 0 0
After installing Debian a serious performance hit was noticed every time the disks were busy. In the X Window System, for example, the mouse would be extremely sluggish (for several seconds or more) and there was no hope of typing. It turned out that the parameters for the hard disk required tuning. Installing hdparm allowed the tuning to happen. Running hdparm with /dev/hda showed the current parameters: # hdparm /dev/hda /dev/hda: multcount I/O support unmaskirq using_dma keepsettings nowerr readonly readahead geometry busstate
= 0 (off) = 0 (default 16-bit) = 0 (off) = 0 (off) = 0 (off) = 0 (off) = 0 (off) = 8 (on) = 7297/255/63, sectors = 117231408, start = 0 = 1 (on)
5.9 Target Machines
95
It turns out that the following fixes the problem. It turns on DMA (-d1), 16 multiple sectors (-m16), and 32 bit I/O support (-c1): # hdparm -d1 -m16 -c1 /dev/hda # hdparm -d1 -m16 -c1 /dev/hdb
To ensure these new settings are saved for each reboot install the package hwtools and edit /etc/init.d/hwtools: if command -v hdparm >/dev/null 2>&1; then hdparm -q -d1 -m16 -c1 /dev/hda hdparm -q -d1 -m16 -c1 /dev/hdb fi
For further information see Section 26.3. Install Kernel 2.4.19 A new IDE controller (Silicon Image CMD680) was installed delivering disks /dev/hde and /dev/hdg. At the time of installing the CMD680 IDE controller chip kernel 2.4.19 (which supports this chip, but not kernel 2.4.18) was not available as a Debian package but had just been released. A kernel was compiled from source to get support for this new controller. The default .config (i.e., starting from no .config file) was the starting point. Below is recorded the specific configurations added. # # # # #
cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.gz tar zxvf linux-2.4.19.tar.gz cd linux-2.4.19 make menuconfig Processor type and features Processor family CONFIG_MPENTIUM4=y Block devices RAM disk support CONFIG_BLK_DEV_RAM=y
96
# # # #
Installation Initial RAM disk (initrd) support CONFIG_BLK_DEV_INITRD=y ATA/IDE/MFM/RLL support IDE, ATA and ATAPI Block devices CONFIG_BLK_DEV_CMD64X=y CONFIG_BLK_DEV_CMD680=y Sound CONFIG_SOUND_ICH=y make-kpkg clean make-kpkg --append-to-version -p4 --revision dha01 --initrd kernel_image cd .. wajig install kernel-image-2.4.19-p4_dha01_i386.deb
This works just fine and all standard drivers (CDROM and NFS) were included by default. The resulting kernel is quite a bit smaller that the kernels supporting lots of hardware (700K initrd cf 2.4MB and 56K modules cf 20MB)!
5.9 Target Machines
5.9.16
97
Dell OptiPlex GXi 523M (Prefect)
This desktop machine is used primarily for testing new installations and new software updates. Also serves as a spare desktop workstation when required. Installed Debian GNU/Linux 3.0 from the Debian 3.0 beta netinst CD-ROM of 14 May 2002 (26 June 2002). Originally installed Debian GNU/Linux 2.2r2 from CD-ROM (July 2001). After the install the system was immediately upgraded to unstable and other packages from unstable were installed as required.
Prefect Specifications CPU RAM Disk Disk CD-ROM NIC Video
Audio
Pentium MMX 232MHz 97MB 3GB Hard Drive QUANTUM FIREBALL 8GB Dard Drive NEC CD-ROM DRIVE:288, ATAPI CDROM drive 3Com Corporation 3c905 MGA Power Desk Version 3.31 Matrox Millenium 11 Accel 2164W 4MB 1024x768 75Hz Crystal Wave cs32BA11 1.51
The lspci command gives:
00:00.0 Host bridge: Intel Corporation 430HX - 82439HX TXC [Triton II] (rev 03) 00:07.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] (rev 01) 00:07.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:0e.0 VGA compatible controller: Matrox Graphics, Inc. MGA 2164W [Millennium II] 00:10.0 VGA compatible controller: S3 Inc. 86c764/765 [Trio32/64/64V+] (rev 44) 00:11.0 Ethernet controller: 3Com Corporation 3c905 100BaseTX [Boomerang]
98
Installation
Prefect Install For the Debian 2.2 install be sure to identify the network card when configuring devices. It is a 3c59x. This is not required for Debian 3.0. For the Debian 3.0 install the Debian netinst was used since the PGI netinst did not include INSTALL/BOOT nor LOADLIN.
5.9 Target Machines
5.9.17
99
Dell Precision 420 MT (Cleveland)
This dual processor desktop machine is to be used for software development. Debian GNU/Linux 3.0 was installed from PGI 3.0 beta netinst CD-ROM (24 June 2002). Cleveland Specification CPU BogoMIPS RAM Disk DVD-ROM CD-RW NIC Video Audio
Genuine Intel Pentium III (Coppermine) 800MHz 1592 512MB 34GB NEC DV-5700A, ATAPI CDROM drive SONY CD-RW CRX140E, ATAPI CDROM drive 3Com 3c905C Tornado nVidia GeForce 256 Cirrus Logic CS 4614/22/24 CrystalClear
Cleveland Install The network information for this host is: Hostname Address Netmask Broadcast Gateway DNS Domain
cleveland 155.229.8.161 255.255.255.192 optional 155.229.8.190 183.44.72.1 togaware.com
For this dual processor a new kernel was installed (kernel-image-2.4.18-686smp). Since this was a PGI install the boot loader is grub and no further action is required. On the next book a menu of alternative kernels was presented.
100
5.9.18
Installation
Dell Optiplex GX240 (Cultus)
Debian GNU/Linux 2.2r2 was installed from CD-ROM (22 May 2002). The network card was not recognised and so the kernel was upgraded to 2.4.6 which was available on a CDROM, requiring moving to the use of initrd and resulting lilo configuration changes (see Sections 5.7 and 5.9.19). This kernel supported the ethernet card so that the installation could be upgraded immediately to unstable. The graphics chip (ATI Rage 128 Pro TF) though was not supported by the current XFree86 (4.1.0). An upgrade to the experimental XFree86 (4.2) fixed that.
Cultus Specifications CPU Intel(R) Pentium(R) 4 CPU 1.70GHz BogoMIPS 3381 RAM 512MB Disk MAXTOR 6L040L2, ATA DISK drive 40GB IDE CD-RW/DVD ATAPI 32X DVD-ROM CD-R/RW drive NIC 3Com PCI 3c905C Tornado Video ATI Rage 128 Pro TF Audio Intel Corp. 82801BA/BAM AC’97 Audio The lspci command gives:
00:00.0 Host bridge: Intel Corp. 82845 845 (Brookdale) Chipset Host Bridge (rev 03) 00:01.0 PCI bridge: Intel Corp. 82845 845 (Brookdale) Chipset AGP Bridge (rev 03) 00:1e.0 PCI bridge: Intel Corp. 82801BA/CA PCI Bridge (rev 12) 00:1f.0 ISA bridge: Intel Corp. 82801BA ISA Bridge (LPC) (rev 12) 00:1f.1 IDE interface: Intel Corp. 82801BA IDE U100 (rev 12) 00:1f.2 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #1) (rev 12) 00:1f.3 SMBus: Intel Corp. 82801BA/BAM SMBus (rev 12) 00:1f.4 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #2) (rev 12) 00:1f.5 Multimedia audio controller: Intel Corp. 82801BA/BAM AC’97 Audio (rev 12) 01:00.0 VGA compatible controller: ATI Technologies Inc Rage 128 Pro Ultra TF 02:0c.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
5.9 Target Machines
101
Cultus Install Log The disk was partitioned into two: one for swap (1GB as /dev/hda2) and the rest for everything else (39GB as /dev/hda1). The ethernet driver (3c59x) in this release (kernel 2.2.18pre21) does not support the 3Com 3c905C-TX card. The kernel needed to be upgraded to a 2.4.6 kernel on a more recent release (e.g., Debian 3.0 woody beta CD-ROM—see Section 4.7.5 for details of making a CD-ROM available to apt-get): # apt-get install
kernel-image-2.2.19
The networking began working just fine. In moving to the unstable release (after a dist-upgrade) kernel-image-2.4.18-686 was installed without effort (except for initrd addition to lilo—see Sections 5.7 and 5.9.19) Sound card support from the kernel required adding the following line to /etc/modules.conf (by adding it to /etc/modutils/sndconfig then running update-modules: alias sound-slot-0 i810_audio
A modprobe can then be used to load the module. Refer to documentation in /usr/src/linux/Documentation/sound/ for details. To ensure the module is loaded at boot time add i810 audio to /etc/ modules.
102
5.9.19
Installation
Optima Super Vizon II 3600 Customised (Bartok)
Bartok (Section 5.9.19) is a custom built dual processor server with an inexpensive 20GB IDE hard disk (for Debian GNU/Linux install) and a 136GB SCSI RAID disk (made up of 4 disks). Debian GNU/Linux 2.2r2 was installed (kernel-image-2.2.18pre21) from CD-ROM, 4 December 2001. The SCSI RAID disk (Adaptec 2100s) was not supported by the installed kernel thus Debian was first installed on the IDE drive. A driver for the SCSI RAID was then obtained from Adaptec (dpt i2o.o) and installed after Debian was upgraded to unstable and running with kernel-image-2.2.19. A compile of kernel-source-2.4.16 produced a dpt i2o.o suitable for use with kernel-image2.4.16-686-smp. On 26 March 2003 a standard kernel-image-2.4.20-686-smp was installed to provide up to date support for USB, adding a USB Printer. This kernel supports the dual processors and 4GB high memory. Originally there were occasional I/O errors with the dpt i2o driver for the Adaptec. Others (e.g., Ian Millsom — [email protected]) report that the driver in the 2.4.n kernels is still buggy. Ian can provide a 2.2.19pre17 kernel patched for the driver. However, running under kernel versions 2.4.16 and 2.4.20 has given no further problems. (The 2.4.16 kernel was compiled with options p3, high memory, and SMP and the 2.4.20 kernel was a standard Debian kernel with SMP and HIMEM and 686 - kernel-image-2.4.20-1-686smp.) Partitioning was 4GB for / and the rest for /home. Bartok Specifications CPU BogoMIPS RAM Disk CD-RW CD-ROM NIC Video Audio
Dual Intel Pentium III (Coppermine) 1GHz 2 x 2005 1.3GB 20GB IDE 140GB Adaptec 2100s RAID. 4 x Seegate Cheetah 10K 36GB Mitsubishi CDRW 32x12x8 ATAPI-CD ROM-DRIVE-52MAX, ATAPI CD/DVD-ROM drive Integrated Intel PRO/100+ Intel 82559 NVidia Riva Ultra 64
The lspci command gives:
5.9 Target Machines
103
00:00.0 Host bridge: VIA Technologies, Inc. VT82C693A/694x [Apollo PRO133x] (rev c4) 00:01.0 PCI bridge: VIA Technologies, Inc. VT82C598/694x [Apollo MVP3/Pro133x AGP] 00:04.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40) 00:04.1 IDE interface: VIA Technologies, Inc. Bus Master IDE (rev 06) 00:04.2 USB Controller: VIA Technologies, Inc. UHCI USB (rev 16) 00:04.3 USB Controller: VIA Technologies, Inc. UHCI USB (rev 16) 00:04.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40) 00:07.0 Ethernet controller: Intel Corp. 82557 [Ethernet Pro 100] (rev 08) 00:08.0 SCSI storage controller: LSI Logic / Symbios Logic (formerly NCR) 53c1010 Ultra3 SCSI Adapter (rev 01) 00:08.1 SCSI storage controller: LSI Logic / Symbios Logic (formerly NCR) 53c1010 Ultra3 SCSI Adapter (rev 01) 00:0d.0 PCI bridge: Distributed Processing Technology PCI Bridge (rev 02) 00:0d.1 I2O: Distributed Processing Technology SmartRAID V Controller (rev 02) 01:00.0 VGA compatible controller: nVidia Corporation Vanta [NV6] (rev 15)
Bartok Install The IDE disk was partitioned into three: one for swap (2GB as /dev/hda3), one for / (4GB as /dev/hda1) and the rest for /home (14GB as /dev/hda2. The network module eepro100 was selected.
Load RAID Driver During Install The Adaptec PCI Ultra 160 Single Channel RAID Controller, also known as the Adaptec 2100s, was an interesting challenge as drivers for this were not available on the install media. Thus initially it was not possible to install Linux. The initial boot with Debian GNU/Linx V2.2r2 CD-ROM failed because the disks were not found! After the Configure Keyboard step in the Debian install process there is an opportunity to Preload Essential Modules from Floppy. This allows the
104
Installation
loading of modules that are required for particular devices that are otherwise not provided in the kernel. So the first attempt at installing Linux obtained the appropriate module/driver from Adaptec by downloading dptdriver-2.4.tgz from linux.adaptec. com. This gzipped tape archive generates /usr/adaptec/i2o_driver/: > tar zxvf dptdriver-2.4.tgz > cd usr/adaptec/i2o_driver/
The drivers for various versions of the kernel are then contained in dpt i2o prebuilt.cgz. This is a gzipped cpio archive. To extract the archive: $ mkdir tmp $ cd tmp $ gunzip < ../dpt_i2o_prebuilt.cgz | cpio --extract
The kernel installed was 2.2.18pre21 but there is not a corresponding dpt i2o. The 2.2.18 version had undefined symbols and the machine froze. The 2.2.19 version worked. This was then copied onto a floppy for Debian to load: $ $ $ $
mount /floppy mkdir /floppy/boot cp dpt_i2o.2.2.19 /floppy/boot/dpt_i2o.o umount /floppy
Once dpt_i2o is installed you can create and initialise the disk partitions on the RAID: # cfdisk /dev/sda # mke2fs /dev/sda1
(to create a single partition perhaps)
Later when configuring drivers and devices you can also add modules from floppy, but they must now be in /floppy/lib/modules/scsi/dpt_i2o.o, for example. Now we come unstuck because we create a boot floppy yet there is no way to install the RAID driver on the kernel on this boot floppy, so next reboot the RAID is no longer available and the boot hangs with a Kernel Panic and a message about block-major-8 and not being able to mount the root fs.
5.9 Target Machines
105
Install an IDE Hard Drive It would appear that a sensible approach to building a computer with a SCSI RAID is to install an IDE drive onto which Debian GNU/Linux is installed. The appropriate driver for the SCIS RAID is then installed after Debian is functioning. The driver for the SCSI RAID is dpt_i2o.o, obtained from the dptdriver-2.4.tgz archive at linux.adaptec.com. The correct one (for kernel 2.2.19) was copied to the appropriate modules folder after upgrading the kernel to 2.2.19: # # # # #
mount -r /dev/fd0 /floppy cp /floppy/boot/dpt_i2o.o /lib/modules/2.2.19/scsi umount /floppy depmod -a insmod dpt_i2o
Then dpt_i2o.o is listed in /lib/modules/2.2.19/modules.dep (thanks to the depmod command) and the RAID disk is accessible. There were some unresolved symbols but these seem not to affect the drive. (The choice of kernel 2.2.19 was dictated by the available kernel-images in Debian and the available drivers for specific kernels from Adaptec.) To mount the drive add the following to /etc/fstab: /dev/sda1
/raid ext2
defaults,errors=remount-ro
0 0
Then create /raid and mount the RAID disk: # mkdir /raid # mount /raid
Also add dpt i2o to /etc/modules so that the RAID is available when the machine boots. Kernel Compiles to Support HIGHMEM and SMP Eventually the standard package kernel-image-2.4.20-1-686-smp was installed, providing both SMP and HIMEM support. Previous kernel compiles are outlined here.
106
Installation
# # # # # #
wajig install bin86 kernel-package kernel-source-2.4.16 debconf-utils cd /usr/src tar jxvf kernel-source-2.2.16.tar.bz2 cd kernel-source-2.2.16 cp /boot/config-2.4.16-586 .config make menuconfig Processor Type and Features CONFIG_MPENTIUMIII=y CONFIG_HIGHMEM4G=y (originally off) CONFIG_SMP=y (already set) # make-kpkg clean # make-kpkg --append-to-version -p3hmsmp --revision dha01 --initrd kernel_image
The aim was to have: 1. dpt_i2o provided by the kernel (2.4.14 on with CONFIG SCSI DPT I2O=m) 2. support for 2 CPUs (CONFIG SMP=y) 3. support over 1GB memory (CONFIG HIGHMEM4G=y) With the new kernels the initrd (initial ram disk) is the default, so it is worth moving to this. It requires changes to your /etc/lilo.conf to include initrd lines. For example: image=/boot/vmlinuz-2.4.16-p3hmsmp label=2.4.16-p3hmsmp read-only initrd=/boot/initrd.img-2.4.16-p3hmsmp append="noapic"
Note also that with the dual processor card in this machine (ASUS CUV4XDLS) the noapic option was required, otherwise there is a problem with running out of IRQs and the boot hangs after the following message: ENABLING IO-APIC IRQs Setting 2 in the phys_id_present_map ...changing IO-APIC physical ID to 2 ... ok. ..TIMER: vector=0x31 pin1=2 pin2=0
5.9 Target Machines
107
An alternative to turning APIC off is to free up the IRQs used by the PCI IDE devices. This is only useful if either the primary or secondary IDE is not being used (for IDE hard disks and IDE CD-ROM). To turn it off the secondary or both IDEs in the BIOS setup, go to Advanced→Chip Configuration→Onboard PCI IDE and set it to either Primary or Disabled.
108
5.9.20
Installation
Dell Precision WorkStation 530 MT (Altrop)
Altrop is a dual processor, high-end server. Debian GNU/Linux 2.2r2 was installed from CD-ROM, 23 November 2001. The network card was not immediately recognised so a 2.2.19 kernel was installed. Altrop was then upgraded to unstable over the internet. The kernel was then upgraded to 2.4.14-686-smp supporting dual processors. A custom kernel was compiled to further support the extra memory through the HIMEM option. Altrop Specifications CPU BogoMIPS RAM Disk
Dual Intell Xeon 1.5GHz 2 x 2988 2GB FUJITSU MAN3735MP 73GB SCSI SEAGATE ST373405LW 73 GB SCSI DVD-ROM LITEON DVD-ROM LTD163 CD-RW NEC CD-RW NR-7800A NIC 3Com 3c905C-TX Video nVidia NV15 GL (Quadro2 Pro) Audio Intel Corp. 82820 820 (Camino 2) Chipset AC’97 The lspci command gives: 00:00.0 Host bridge: Intel Corp. 82850 860 (Wombat) Chipset Host Bridge (MCH) (rev 04) 00:01.0 PCI bridge: Intel Corp. 82850 850 (Tehama) Chipset AGP Bridge (rev 04) 00:02.0 PCI bridge: Intel Corp. 82860 860 (Wombat) Chipset AGP Bridge (rev 04) 00:1e.0 PCI bridge: Intel Corp. 82820 820 (Camino 2) Chipset PCI (rev 04) 00:1f.0 ISA bridge: Intel Corp. 82820 820 (Camino 2) Chipset ISA Bridge (ICH2) (rev 04) 00:1f.1 IDE interface: Intel Corp. 82820 820 (Camino 2) Chipset IDE U100 (rev 04) 00:1f.2 USB Controller: Intel Corp. 82820 820 (Camino 2) Chipset USB (Hub A) (rev 04) 00:1f.3 SMBus: Intel Corp. 82820 820 (Camino 2) Chipset SMBus (rev 04) 00:1f.4 USB Controller: Intel Corp. 82820 820 (Camino 2) Chipset USB (Hub B) (rev 04)
5.9 Target Machines
109
00:1f.5 Multimedia audio controller: Intel Corp. 82820 820 (Camino 2) Chipset AC’97 Audio Controller (rev 04) 01:00.0 VGA compatible controller: nVidia Corporation NV15 GL (Quadro2 Pro) (rev a4) 02:1f.0 PCI bridge: Intel Corp. 82806AA PCI64 Hub PCI Bridge (rev 03) 03:00.0 PIC: Intel Corp. 82806AA PCI64 Hub Advanced Programmable Interrupt Controller (rev 01) 03:0e.0 SCSI storage controller: Adaptec 7892P (rev 02) 04:0b.0 Ethernet controller: 3Com Corporation 3c905C-TX [Fast Etherlink] (rev 78) 04:0c.0 FireWire (IEEE 1394): Texas Instruments: Unknown device 8020
Altrop Install There were no particular issues in the install except for the lack of support in the 2.2.18pre21 kernel for the Ethernet card (3c905C-TX) in this machine. The disk was partitioned into two: one for swap (2GB as /dev/sda2) and the rest for everything else (65GB as /dev/sda1). The NIC (ethernet card) driver (3c59x) in this release (kernel 2.2.18pre21) does not appear to support the 3Com 3c905C-TX card. The kernel needed to be upgraded to a 2.2.19 kernel on a more recent release (e.g., Debian 3.0 woody beta—see Section 4.7.5 for details of making a CD-ROM available to apt-get): # apt-get install
kernel-image-2.2.19
The networking began working just fine. In moving to the unstable release (after a dist-upgrade) kernel-image-2.4.14-686-smp was installed without effort (except for initrd addition to lilo) Sound card support from the kernel required adding the following line to /etc/modules.conf (by adding it to /etc/modutils/sndconfig then running update-modules: alias sound-slot-0 i810_audio
A modprobe can be used to load the module. Refer to documentation in /usr/src/linux/Documentation/sound/ for details.
110
Installation
To ensure the module is loaded at boot time add i810 audio to /etc/ modules.
5.9 Target Machines
5.9.21
111
Sun SPARCstation 5 (sun4m) (Cepheus)
Cepheus is an older Sun SPARCstation that serves as a testbed for installing Debian GNU/Linux on very different hardware. Debian GNU/Linux 2.2r2 was installed from the sparc CD-ROM, 19 September 2001. It was immediately upgraded to unstable and maintained at unstable with weekly distupgrades. Cepheus Specifications CPU BogoMIPS RAM Disk CD-R NIC Video Audio
Fujitsu MB86904 TurboSPARC 170MHZ 109 30MB!!! 2GB (1.7GB /dev/sda1 and .3GB swap on /dev/sda2) TOSHIBA Model: XM-4101TASUNSLCD (SCSI) LANCE cgsix at 0.50000000 TEC Rev 4 CPU sparc Rev b [TurboGX] CS4231
112
5.9.22
Installation
Toshiba Satellite 1800 (HAX)
HAX is a dual boot laptop used for development. Debian GNU/Linux 2.2r2 was installed (kernel-image-2.2.18pre21) from CD-ROM 12 December 2001. It was immediately upgraded to unstable and running with kernel-image-2.4.16.
HAX Specifications CPU Intel Pentium III (Coppermine) BogoMIPS 1697 RAM 196MB Disk 14GB TOSHIBA MK1517GAP, ATA DISK DVD-ROM DV-28E-B, ATAPI 24x CDROM NIC Integrated Intel PRO/100+ Intel 82559 Video Trident CyberBlade/DSTN/Ai1 Audio Acer Laboratories Inc. [ALi] M5451 PCI South Bridge Audio (rev 01) The lspci command gives: 00:00.0 Host bridge: Acer Laboratories Inc. [ALi]: Unknown device 1632 (rev 01) 00:01.0 PCI bridge: Acer Laboratories Inc. [ALi] M5247 (rev 01) 00:02.0 USB Controller: Acer Laboratories Inc. [ALi] M5237 USB (rev 03) 00:04.0 IDE interface: Acer Laboratories Inc. [ALi] M5229 IDE (rev c3) 00:06.0 Multimedia audio controller: Acer Laboratories Inc. [ALi] M5451 PCI South Bridge Audio (rev 01) 00:07.0 ISA bridge: Acer Laboratories Inc. [ALi] M1533 PCI to ISA Bridge [Aladdin IV] 00:08.0 Bridge: Acer Laboratories Inc. [ALi] M7101 PMU 00:0a.0 Ethernet controller: Intel Corp. 82557 [Ethernet Pro 100] (rev 08) 00:11.0 CardBus bridge: Toshiba America Info Systems ToPIC95 PCI to Cardbus Bridge with ZV Support (rev 32) 00:11.1 CardBus bridge: Toshiba America Info Systems ToPIC95 PCI to Cardbus Bridge with ZV Support (rev 32) 01:00.0 VGA compatible controller: Trident Microsystems: Unknown device 8620 (rev 5d)
5.9 Target Machines HAX Install Log kb qwerty/us disks partition swap /dev/hda3 linux /dev/hda2 root mount /dev/hda2 kernel from cd-rom /dev/hdc devices net/eepro100 network host = hax base from cd-rom config timezone Australia ACT NO GMT Make Linux boot directly from hard disk MBR Make boot floppy Custom Boot Reboot
113
114
5.9.23
Installation
IBM ThinkPad (Hukz)
HUKZ is a laptop used essentially as a stand-alone machine with Ethernet connection. Debian 2.2r4 was installed 20 January 2002. It was upgraded to unstable immediately.
HUKZ Specifications CPU Intel Pentium III (Coppermine) 500MHz BogoMIPS 993 RAM 132MB Disk HITACHI DK23AA-12B, 11509MB w/512kB Cache DVD-ROM TOSHIBA 24X DVD-ROM SD-C2302, ATAPI CDROM NIC 3Com 3CCFE575CT Tornado CardBus Video Neomagic Corporation NM2360 Audio Cirrus Logic CS 4614/22/24 The lspci command gives: 00:00.0 00:01.0 00:02.0 00:02.1 00:03.0 00:06.0 00:07.0 00:07.1 00:07.2 00:07.3 01:00.0 05:00.0
Host bridge: Intel Corp. 440BX/ZX - 82443BX/ZX Host bridge (rev 03) PCI bridge: Intel Corp. 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) CardBus bridge: Texas Instruments PCI1450 (rev 03) CardBus bridge: Texas Instruments PCI1450 (rev 03) Communication controller: Lucent Microelectronics WinModem 56k (rev 01) Multimedia audio controller: Cirrus Logic CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] (rev 01) Bridge: Intel Corp. 82371AB PIIX4 ISA (rev 02) IDE interface: Intel Corp. 82371AB PIIX4 IDE (rev 01) USB Controller: Intel Corp. 82371AB PIIX4 USB (rev 01) Bridge: Intel Corp. 82371AB PIIX4 ACPI (rev 03) VGA compatible controller: Neomagic Corporation NM2360 [MagicMedia 256ZX] Ethernet controller: 3Com Corporation 3CCFE575CT Cyclone CardBus (rev 10)
HUKZ Install Log kb disks
qwerty/us partition
1GB
Linux hda6 Swap hda7
5.9 Target Machines swap /dev/hda7 linux /dev/hda6 root mount /dev/hda6 kernel from cd-rom devices ? network host = debian base from cd-rom config timezone (skip the "Make Linux boot directly from hard disk") Make boot floppy Custom Boot Reboot
115
116
5.9.24
Installation
Dell Latitude C600 (Inco)
Inco is a laptop with a docking station, used as a shared portable, primarily for presentations (but previously as a desktop machine). It has a built-in network card and modem plus another network card in the docking station. It is a dual boot machine, although MSWindows-NT doesn’t see much use. Debian GNU/Linux 2.2r2 was installed from CD-ROM, 20 November 2001. It was upgraded immediately to unstable. The kernel was upgraded to 2.4.14 early on but has keep up to date with Debian kernel releases. The built-in modem is a WinModem which is not supported by Linux so a PCMCIA modem is used. Inco has two NTFS partitions (C and D drives) using about 7GB with the remaining 13GB partitioned as 1GB swap and 12GB for linux:
Partition 12GB as linux ext2 /dev/hda3 Partition 1GB as linux swap /dev/hda4
Inco Specifications
From the lspci and lshw commands and /proc/cpuinfo:
5.9 Target Machines
117
Machine: CPU: Bogomips: Memory: Network:
Latitude C600 A16 Intel Pentium III (Coppermine) 1.0GHz/700MHz 1400 512MB 3Com 3c905C Tornado (docking station) (3c59x) 3Com 3c556 10/100 Mini PCI Adapter (3c59x) Disk: 18GB TOSHIBA MK2017GAP, ATA DISK drive (/dev/hda) Video: Rage Mobility M3 AGP 2x 64MB 66MHz (ati/r128) Audio: ES1983S Maestro-3i (maestro3) CD/DVD: LG DRN-8080B, ATAPI 24X DVD-ROM drive CDRW/DVD: Samsung CD-RW/DVD-ROM SN-308B, ATAPI CD/DVD-ROM drive Modem: 3Com Mini PCI 56k Winmodem Hostname: Domainname: IP Address: Netmask: Broadcast: Gateway: DNS Boot: Kernel:
inco togaware.com.au 105.229.8.156 255.255.255.192 105.229.255.255 105.229.8.190 125.83.72.15 125.83.72.1 Grub 2.4.22-1-686
Inco Install Log The basic install chose the qwerty/us keyboard. The disks were partitioned as 12GB for a linux partition (hda3) and 1GB for swap (hda4). Root was mounted from /dev/hda3. The kernel was installed from CD-ROM with devices selected including fs/autofs, fs/nfs, fs/nfsd, fs/ntfs, fs/vfat, net/3c59x, misc/psaux and net/ppp. The network hostname was identified as inco. The base system was installed from CD-ROM. Configuration involved setting the timezone to Australia/ACT with the clock not set to GMT (since it is dual boot). Initially skipped the ”Make Linux boot directly from hard disk”, but created a boot floppy. A Cusomt Boot was chosen and the system was rebooted. The built-in network card is eth1 when docked and eth0 when undocked. See Section 62.9 to handle this. Install i8kutils to control the Dell Latitude CPU fan, volume buttons, and Fn-keys, and to report CPU temperature. Includes a little applet to include
118
Installation
a CPU temperature in the Gnome-Panel. You may need to load the module i8k. (By the way, i8k stands for Insperion 8000.) The command line i8kctl lists the current status of the fans. Lilo was configured to boot MS-Windows/2000 by pointing it to /dev/hda1. Later, lilo was replace with grub for booting. Sound card support from the kernel required adding the following line to /etc/modules.conf (by adding it to /etc/modutils/sndconfig then running update-modules: alias sound-slot-0 maestro3
Refer to documentation in /usr/src/linux/Documentation/sound/ for details. The video card has TV-Out but ATI is not supporting Linux on this yet, unlike NVidia which supports TV with its XFree86-4 option: Option "ConnectedMonitor" "TV".
Currently on Inco I have: Option "Display" "BIOS"
which tells it to use whatever the BIOS recognises as connected (either CRT or FP). At one time I had a problem playing videos with xine. Starting xine on Inco (Section 5.9.24) displayed just a blue screen, even when the video is playing. If I choose the video driver to be xshm it works acceptably. Ogle fails to start also, although mplayer coped. The problem was running with 16 rather than 24 bpp X server!
5.9 Target Machines
5.9.25
119
Dell OptiPlex GX1p (Plymouth)
Installed Debian GNU/Linux 2.2r2 from CD-ROM 21 (September 2001) then immediately upgraded to unstable and installed packages from unstable as required. Plymouth is a single boot machine with no NTFS partitions and a single 10GB hard disk:
Partition 9.5GB as linux ext2 /dev/hda1 Partition 500MB as linux swap /dev/hda2 Write partition table
Plymouth Specifications CPU RAM 256MB Disk 10GB CD-R NIC 3COM Ethernet Card 3C905B Video ATI Technologies Inc 3D Rage Pro AGP 1X/2X (rev 5c) Audio The lspci command gives:
00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 02) 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 02) 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) 00:0f.0 PCI bridge: Digital Equipment Corporation DECchip 21152 (rev 03) 00:11.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 24) 01:00.0 VGA compatible controller: ATI Technologies Inc 3D Rage Pro AGP 1X/2X (rev 5c)
120 Plymouth Install Nothing particularly special in the install.
Installation
5.9 Target Machines
5.9.26
121
Dell Precision WorkStation 420 MT (Velox)
Installed Debian GNU/Linux 2.2r2 from CD-ROM (15 December 2000). Upgraded to unstable and installed packages from unstable as required. Velox (Section 5.9.26) is a dual boot machine with the first partition kept as NTFS (C: Drive). During the Debian install the second partition (originally the D: Drive) was deleted and partitioned as: Partition 8.2GB as linux ext2 /dev/sda2 Partition 500MB as linux swap /dev/sda3 Write partition table
Velox Specifications CPU
Dual Processor Pentium III (Coppermine) 800MHz (979780 kHz) BogoMIPS 1595 RAM 512MB (523840k) Disk SCSI Hard Disk Adaptec AIC 7899 SCSI BIO V25113 DVD-ROM NEC DV-5700A, ATAPI CDROM drive CD-RW SONY CD-RW CRX140E, ATAPI CDROM drive NIC 3Com 3c905C Tornado Video nVidia GeForce 256 Audio Cirrus Logic CS 4614/22/24 CrystalClear SoundFusion Audio Accelerator The lspci command gives: 00:00.0 Host bridge: Intel Corporation 82840 840 (Carmel) Chipset Host Bridge (Hub A) (rev 01) 00:01.0 PCI bridge: Intel Corporation 82840 840 (Carmel) Chipset AGP Bridge (rev 01) 00:1e.0 PCI bridge: Intel Corporation 82801AA PCI Bridge (rev 02) 00:1f.0 ISA bridge: Intel Corporation 82801AA ISA Bridge (LPC) (rev 02) 00:1f.1 IDE interface: Intel Corporation 82801AA IDE (rev 02) 00:1f.2 USB Controller: Intel Corporation 82801AA USB (rev 02) 00:1f.3 SMBus: Intel Corporation 82801AA SMBus (rev 02) 01:00.0 VGA compatible controller: nVidia Corporation GeForce 256 (rev 10) 02:04.0 Ethernet controller: 3Com Corporation 3c905C-TX [Fast Etherlink] (rev 78)
122
Installation
02:06.0 Multimedia audio controller: Cirrus Logic CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator] (rev 01) 02:0e.0 PCI bridge: Digital Equipment Corporation DECchip 21152 (rev 03) 03:0a.0 SCSI storage controller: Adaptec 7899P (rev 01) 03:0a.1 SCSI storage controller: Adaptec 7899P (rev 01)
Velox Install No particular trouble with the install. This is a dual boot machine with MS-Windows/NT so do not install a boot loader - use NT’s boot loader.
5.9 Target Machines
5.9.27
123
Dell OptiPlex GX110 (Mint)
Debian GNU/Linux 2.2r2 was installed from CD-ROM (15 December 2000) and immediately upgraded to unstable. This is a desktop machine with an external modem for network connection and acts as the Internet gateway for a small network. Mint is a dual boot machine with the first partition as NTFS (C: Drive). The second partition (originally a D: Drive) was deleted during the Debian install and partitioned as: Partition 8.5GB as linux ext2 /dev/hda2 Partition 200MB as linux swap /dev/hda3
Mint Specifications The lshw command was used to obtain the following: mint.act.cmis.csiro.au CPU Pentium III (Coppermine) version: 6.8.6 730MHz capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse Memory 254MB PCI VGA NV5M64 [RIVA TNT2 Model 64/Model 64 Pro] capabilities: vga bus_master cap_list irq=9 PCI Network Ethernet controller 3c905C-TX/TX-M [Tornado] capabilities: bus_master cap_list configuration: driver=3c59x irq=5 IDE IBM-DTLA-307015 /dev/hda 13GB IDE NEC DV-5700A /dev/hdc 1023GB IDE LG CD-RW CED-8080B /dev/hdd 1023GB Multimedia 82801AA AC’97 Audio capabilities: bus_master configuration: driver=intel810_audio irq=10
Mint Install kb disks
qwerty/us partition
124
Installation
swap linux root mount kernel from cd-rom devices fs/ntfs net/3c59x network host = inx base from cd-rom config timezone Australia ACT GMT no (skip the "Make Linux boot directly from hard disk") Make boot floppy Custom Boot Reboot IP Netmask Gateway DNS
183.44.70.89 255.255.255.192 BLANK 183.44.72.1
5.9 Target Machines
5.9.28
125
Dell Latitude CPiD300XT (Inka)
Inka is a laptop used essentially as a stand-alone machine with modem connectivity. A docking station provided a 19inch monitor and external keyboard and mouse. Debian GNU/Linux 2.1 was installed from floppies, 15 March 1999. It was upgraded to unstable sometime later.
Inka Specifications CPU RAM Disk Disk Floppy CD-ROM NIC Modem Video Audio
Pentium Pentium II 300MHz 128MB 6GB (MS-Windows/NT) 6GB (additional drive in the internal bay) /dev/hdc Parallel port of the docking station TOSHIBA CD-ROM XM-1802B, ATAPI CDROM drive (docking station) 3COM Vortex 3C590/905-series (docking station) PCMCIA 3COM 56K NeoMagic MagicGraph 128XD (NM2160) Crystal Semiconductor CS4237B Advanced Audio SRS 3D Sound
The lspci command gives:
00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (AGP disabled) (rev 02) 00:02.0 VGA compatible controller: Neomagic Corporation NM2160 [MagicGraph 128XD] (rev 01) 00:03.0 CardBus bridge: Texas Instruments PCI1131 (rev 01) 00:03.1 CardBus bridge: Texas Instruments PCI1131 (rev 01) 00:07.0 Bridge: Intel Corporation 82371AB PIIX4 ISA (rev 01) 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 01) 00:11.0 PCI bridge: Intel Corporation 82380FB (rev 01) 01:05.0 IDE interface: CMD Technology Inc PCI0646 (rev 03) 01:07.0 SCSI storage controller: Adaptec AIC-7860 (rev 03) 01:08.0 Ethernet controller: 3Com Corporation 3c905 100BaseTX [Boomerang]
126
Installation
Inka Install Log color kb disks swap linux root kernel devices
qwerty/us partition
6GB Linux N P 6063 B T 83 B hdc1 128MB Swap N P 125 T 82 hdc2 scan scan /dev/hdc1 Rescue Disk Drivers Disk psaux ppp
W Q
/dev/hdc2 /dev/hdc1 mount from /dev/fd0 misc net network host = debian connected = no base from /dev/fd0 Base Disks 1-7 config timezone Australia ACT GMT no (skip the "Make Linux boot directly from hard disk") Make boot floppy Custom Boot Reboot
With the initial boot the extra internal bay hard disk drive had to be mentioned to the kernel with the following command line when the boot prompt is displayed (you have about 10 seconds to begin typing): boot: linux hdc=13424,15,63
(the numbers were eventually figured out one time when the drive was eventually auto-detected after a kernel upgrade). ALSA Sound Configuration Lindsay Haisley supplied the following configuration file for alsa: # ALSA portion alias char-major-116 snd alias snd-card-0 snd-cs4236 alias char-major-14 soundcore alias sound-slot-0 snd-card-0 # OSS/Free portion - card #1
5.9 Target Machines alias alias alias alias alias
127
sound-service-0-0 snd-mixer-oss sound-service-0-1 snd-seq-oss sound-service-0-3 snd-pcm-oss sound-service-0-8 snd-seq-oss sound-service-0-12 snd-pcm-oss
# Set this to the correct number of cards. options snd cards_limit=1
# Options for the Crystal sound card in the Dell Latitude CPi D300XT options snd-cs4236 index=0 id=CARD_0 port=0x530 cport=0x210 mpu_port=0x330 fm_port=0x388 i # OSS/Free portion alias char-major-14 soundcore alias /dev/mixer snd-mixer-oss alias /dev/dsp snd-pcm-oss alias /dev/midi snd-seq-oss
XF86 Configuration Lindsay Haisley supplied the following configuration file (/etc/X11/XF86Config-4) for xserver-xfree86. It is specific to the Dell CPi D300XT laptop with the standard Neomagic Chipset and the example here is a combination of the XF86Config-4 example provided with Gentoo Linux and Dell CPi D300XT laptop details. For the Dell CPi with the NeoMagic video we do not need to specify a specific ModeLine setting—the X server determines that the VESA standard default video mode for the Neomagic video system in the Dell Latitude CPi D300XT should be as follows: (**) NEOMAGIC(0): *Default mode "1024x768": 65.0 MHz, 48.4 kHz, 60.0 Hz (II) NEOMAGIC(0): Modeline "1024x768" 65.00 \ 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
If you are using version 3 of the XFree86 server then the following modeline might help out: Modeline
"1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
128
Installation
The video system in this computer seems to be sufficiently flexible to accomodate either setting without apparent video alignment errors, however if your display appears to be misaligned, use the older Modeline setting to see if it solves your problem. The options for the neomagic driver allow docked and external displays. Internal and external displays don’t work together so you need to manually edit the XF86Config-4 file each time you change between the external and internal display. It is reported that having both enabled can destroy the internal display. It certainly makes it go pretty ugly momentarily. Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" FontPath "unix/:7100" FontPath "/usr/X11R6/lib/X11/fonts/local/" FontPath "/usr/X11R6/lib/X11/fonts/misc/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/Type1/" FontPath "/usr/X11R6/lib/X11/fonts/CID/" FontPath "/usr/X11R6/lib/X11/fonts/Speedo/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/" FontPath "/usr/X11R6/lib/X11/fonts/100dpi/" ModulePath "/usr/X11R6/lib/modules" EndSection Section "Module" Load "dbe" SubSection "extmod" Option "omit xfree86-dga" EndSubSection Load "dbe" # Double-buffering Load "GLcore" # OpenGL support Load "dri" # Direct rendering infrastructure Load "glx" # OpenGL X protocol interface Load "extmod" # Misc. required extensions Load "v4l" # Video4Linux EndSection Section "ServerFlags" Option "blank time" "10" # 10 minutes EndSection Section "InputDevice" Identifier "Keyboard0" Driver "keyboard"
5.9 Target Machines
129
Option "AutoRepeat" "500 20" Option "Xleds" "1 2 3" Option "XkbModel" "pc105" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "PS/2" Option "Device" "/dev/mouse" Option "Emulate3Buttons" Option "Emulate3Timeout" "50" EndSection Section "Monitor" Identifier "Dell SyncMaster 17GLi" HorizSync 31.5 - 48.5 # multisync VertRefresh 55-65 EndSection Section "Device" Identifier "NeoMagic" Driver "neomagic" BoardName "Unknown" # Option "Rotate" # Option "pciBurst" # Option "ShadowFB" # Option "NoStretch" # Option "LcdCenter" # Option "externDisp" # Uncomment this for external video Option "internDisp" # Uncomment this for internal video Option "overrideValidateMode" # Option "noMMIO" # Option "SWcursor" # Option "NoAccel" # Option "NoLinear" # Option "XaaNoScanlineImageWriteRect" # Option "XaaNoScanlineCPUToScreenColorExpandFill" EndSection Section "Screen" Identifier "Screen0" Device "NeoMagic" Monitor "Dell SyncMaster 17GLi" DefaultColorDepth 16 Subsection "Display" Depth 16
130 Modes "1024x768" "800x600" "640x480" EndSubsection EndSection Section "ServerLayout" Identifier "XFree86 Dell CPi D300XT" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection
Installation
5.9 Target Machines
5.9.29
131
Dell Latitude XPi (Rose)
This older notebook PC has limited resources but works quite well with a basic installation and on a network with a more powerfull server. At the time the XWindows driver for the NeoMagic chip was not part of the XFree86 distribution (it has been since version 3.3.3). This Dell Lattitude XPi P133ST has a NeoMagic NM2070 chipset. The machine has 24MB of memory and a 1.2 GB hard disk, using a PCMCIA modem card with PPP. The 1.2GB hard disk was partitioned into two equal partitions, the first for Windows95, the second for Linux. Windows95 offers less functionality, is slower, has more bugs, and consumes considerably more disk space than the Linux installation which includes X, TeX, and much more! Originally installed Debian GNU/Linux 1.1 with individual package updates as needed. Checking NeoMagic’s web pages at the time found that “NeoMagic does not support Unix drivers, and cannot provide device/programming information to end-users,” protecting their intellectual property rights. So for the NeoMagic chipset there was no SVGA driver (800x600x8bpp 256 colors) in XFree86 prior to version 3.3.3—only the simple VGA16 driver (800x600x4bpp 16 colours) could be used. There was a RedHat rpm with a driver for this chip with XFree86 versions prior to 3.3.3 available and a commercial (approximately US$250) X11 server from Xi Graphics with a NeoMagic driver for Linux, with many positive reports. Running an older version of XFree86 and of the kernel, you will find that the VGA16 server from XFree86 version 3.1 works with the NM2070, giving just 16 colours. A “trick” is required to get the server to use the whole screen (800x600) rather than the 640x480 default or the split screen effect. This requires putting the monitor into 800x600 mode on bootup. A consequence of this is that the normal console is turned off, and you will need to go directly into XWindows, via xdm. This is not usually a problem. Note that using the Neomagic 2070 xserver provided with XFree86 version 4 works fine with both 8bit and 16bit on 640x480 and 800x600 but causes a corrupted screen (vanishing window content etc.) in all x-applications if used with default settings. To fix the problem append both Xaa-options in the screen-section of the x86config: Option "XaaNoPixmapCache" Option "XaaNoScreenToScreenCopy"
132
Installation
No further hacks or tricks were required on the from SuSE-Linux distribution 7.2 on a Dell Latitude xps p133st Bios rev. 11. The simplest way to turn on the 800x600 mode is to use LILO and to change “vga=normal” to “vga=770” in /etc/lilo.conf (or to add it there if not present as in Red Hat Linux). You can also create alternative lilo startups so that you can choose to go with xdm or not with an ”append=4” or ”append=5” (an init 4 or 5 will start xdm depending on your setup—Red Hat uses init 5 for xdm). A kernel patch could also be used to switch to 800x600 mode (notice that 770 is the decimal equivalent of 0x0302). The modification is to the file /usr/src/linux/arch/i386/boot/video.S in the Linux kernel. From: mode_set: mov cmp jz
bx,ax ah,#0xff setalias
To: mode_set: mov mov cmp jz
ax,#0x0302 bx,ax ah,#0xff setalias
<- Insert this line
The Compaq Presario 1020 notebook (which also uses a NeoMagic NM2070 chip) requires no LILO switches nor kernel patches. Similarly the NEC Versa 4200 also uses the NeoMagic and no hacks are required to get it to run in 800x600x4bpp mode. Rose Specifications CPU BogoMIPS RAM Disk NIC Video Audio
Pentium 75+ 586 36 30MB 700MB
5.10 Resources
5.9.30
133
Generic 486/DX66 (Roast)
This much older machine demonstrates a basic install with limited resources. The machine is networked and provides a limited but useful interface to applications running on a more powerful server. Some basic applications installed included emacs, ssh, and lynx. Roast Specifications CPU 486/DX66 BogoMIPS RAM 12MB Disk 420MB NIC Video Audio
5.10
Resources
5.10.1
Books
There are many books that deal with the installation of Debian or RedHat. Some of the Debian books include: Debian GNU/Linux: A Guide to Installation and Usage by John Goerzen and Ossama. 158 pages, published July 1999 by New Riders, ISBN 0735709149. Learning Debian GNU/Linux by Bill McCarty. 360 pages, published October 1999 by O’Reilly & Associates, ISBN 1565927052. Debian GNU/Linux 2.1 Unleashed by Mario Camou, Aaron Von Cowenberghe, Aaron Van Couwenberghe. 1119 pages, published December 1999 by Sams, ISBN 0672317001.
134
Installation
Chapter 6 Basic Survival 6.1 6.1.1
Basic Linux File and Directory Protections
The setgid bit on a directory (in the group-execute portion represented as an s or S) forces all files to be created in the directory with the group of the parent directory rather then the user’s primary group. This is the BSD file creation semantics rather than SYSV. By default Debian uses a umask of 755. It is a long and well known Linux tradition to create home directories world readable as it encourages a sharing environment. Users can always change the permissions on their home directory or any subdirectory they want to keep private. To change this default behaviour edit /etc/adduser.conf to change the DIR_MODE option.
6.1.2
Background Jobs
The nohup command allows a command to be run that is immune to hangups. That is, nohup runs the given command with hangup signals ignored, so that the command can continue running in the background after you log out. $ nohup COMMAND [ARG]...
135
136
6.2
Basic Survival
System Information
Debian Pacakges: lshw. To find out information about the CPU do: $ cat /proc/cpuinfo
Chapter 7 Wajig: Administering Debian Wajig is an interface to many Debian administrative tasks. The name has no particular meaning (sorry!). Written in Python, it uses traditional Debian administration and user tools including apt-get, dpkg, apt-cache, wget, and others. It is intended to unify and simplify common administrative tasks. Wajig has evolved over many years and there’s a small band of users. It has some of the same aims as the feta package and I thought to wrap the extra wajig features into feta, but a number of users suggested that wajig should stay. So it was rewritten recently from being a shell script to a python program. It is available under the GPL. As wajig is simply my frontend to various other commands the goal of this section is more than simply demonstrating how to manage your system with wajig. Wajig may not be the answer you are looking for and that is fine. So, where ever I illustrate a procedure with wajig I will also indicate the underlying commands that are being used to effect the wajig command. You can then use these underlying commands directly if you prefer.
7.0.1
History: Motivations For Wajig
If you’ve tried to remember all the different commands to get different information about different aspects of Debian package management and then used other commands to install and remove packages then you’ll know that it can become a little too much. Swaping between dselect, deity, deity-gtk, aptitutde, apt-get, dpkg, gnome137
138
Wajig: Administering Debian
apt, apt-cache, and so on is interesting but cumbersome. Plus personally I find dselect, deity, and aptitude confusing and even though I’ve spent hours understanding each of them, I don’t think the time was particularly well spent. This Python script simply collects together what I have learnt over the years about various commands! Clearly I have yet to learn all there is. Another effort called feta has a similar goal of being a front end to APT and I have extended and refined my wajig interface to match feta to some extent. Wajig aims to offer more than just package management though.
7.0.2
Installing Wajig
Wajig is available in the Debian distribution. Alternatively Wajig can be installed by adding http://togaware.com/debian to /etc/apt/sources. list: deb http://togaware.com/debian ./
and then as root: # apt-get update # apt-get install wajig
7.0.3
The Basic Debian Tools
The Debian package apt-howto is a good place to start with understanding the apt (for Advanced Packaging Tools) suite of tools. Once installed browse the file /usr/share/doc/apt-howto/en/index.html. Also, see the Debian FAQ at http://www.debian.org/doc/FAQ/. In particular, Section 6 deals with the Packaging system. The Advanced Package Tool (apt) is the recommended way of managing packages under Debian. The command line interface is apt-get but it is also used within dselect, deity, and aptitude. See http://newbieDoc.sourceForge.net/ system/apt-get-intro.html for a great introduction to apt-get. Also see /usr/share/doc/apt/offline.html/index.html on your local Debian machine for using apt off line.
139
7.0.4
Wajig Overview
Wajig is designed to run as a normal user, using sudo as required. It can also be run as root without any extra setup (i.e., without the need for sudo). Using sudo requires a little setting up as described below in Section ??. Try the help command for a list of common commands provided by wajig: $ wajig help
Examples commands include: $ $ $ $ $ $ $ $ $ $
wajig wajig wajig wajig wajig wajig wajig wajig wajig wajig
update install less new newupgrades updatealts editor restart apache listfiles less whichpkg stdio.h whatis rats orphans
(= apt-get update) (= apt-get install less) (list new packages since last update) (list packages upgraded since last update) (update the default "editor") (restart the apache daemon) (list the files supplied by the "less" pkg) (what package supplies this header file) (one line description of the package "rats") (list libraries not required by other pkgs)
For a complete list of available commands increase the level of verbosity of the help command: $ wajig -v help All wajig commands: autoclean bug build dist-upgrade clean describe doc editsources findfile force help hold init
Remove all superseded downloaded deb files Check for reported bugs in package using the Debian Bug Tacker Retrieve/unpack sources and build .deb for the named packages Upgrade to a new distribution (installed and new rqd packages) Remove all downloaded deb files Provide a description of package (-v and -vv for more detail) Equivalent to help with -verbose=2 Edit the sources.list file which locates Debian archives Search for a file within installed pacakges Install package even if it overwrites files from other pkgs Print documentation (detail depends on --verbose) Place listed packages on hold so they are not upgraded Initialise or reset the wajig archive files
140
Wajig: Administering Debian
install integrity lastupdate list listalts listfiles listnames new newupgrades orphans purge reconfigure reinstall remove repackage reset search source status toupgrade update updatealts upgrade whatis whichpkg
Install (or upgrade) one or more packages or a .deb file Check the integrity of installed packages (through checksums) Identify when an update was last performed List the status of every known package List the objects that can have alternatives configured List the files that are supplied by the named package List all known packages or those containing supplied string List packages that became available since last update List packages newly available for upgrading List libraries not required by any installed package Remove one or more packages and configuration files Reconfigure the named installed packages Reinstall each of the named packages Remove one or more packages (see also purge) Generate a .deb file for an installed package Initialise or reset the wajig archive files Search for packages containing listed words Retrieve and unpack sources for the named packages Show the version and available version of packages List packages with newer versions available for upgrading Update the list of downloadable packages Update the default alternative for things like x-window-manager Upgrade all of the installed packages For each package named obtain a one line description Find the package that supplies the given command or file
Command line options: -h|--help -q|--quiet -t|--teaching -v|--verbose=n
Print usage message. Do system commands everything quietly. Trace the sequence of commands performed. Increase (or set) the level of verbosity (to n).
Run ‘wajig -vv help’ for documentation.
7.0.5
Getting Started with SUDO
The aim of Wajig is to operate as a user command and to do super user privileged commands as necessary. The easiest way to do this is to use the sudo package which will ask you for your password and then run the command as the super user. If you don’t have sudo installed then wajig will use ‘su’ to run as super user, but you will need to enter the super user
141 password frequently. If ‘sudo’ is installed but not set up for you to access the appropriate APT commands you will see a permission denied message. Installing sudo is straight forward. As root run the command ‘visudo’ to edit the configration file. Add the lines: Cmnd_Alias
APT = /usr/bin/apt-get, /usr/bin/apt-cache, /usr/bin/dpkg, \ /usr/bin/editor, /usr/sbin/dpkg-reconfigure, \ /etc/init.d/*, /usr/sbin/update-alternatives, \ /usr/lib/apt-move/fetch /usr/bin/dselect, \ /usr/bin/alien
and kayon
ALL=(ALL) APT
in the appropriate places. Then user ‘kayon’ can run the APT and related commands as the super user. If you prefer user ‘kayon’ not to need to enter their password every time you could instead add the following: kayon
ALL=(ALL) NOPASSWD: APT
This is not recommended as an unattended terminal may give someone else access to root, although this access is limited to specific applications so the risk is small.
7.0.6
Available Packages
The Debian packaging system relies on your local system having some idea of what packages are available. This is initialised when you install your system. You will generally need to update this list of packages with what is currently available from the Debian archives for downloading. If you are staying with the stable release you generally only need to update the list of available packages once. The following command is used to update the information about what is available for downloading: $ wajig update
(dpkg update)
142
Wajig: Administering Debian
(In brackets after the wajig command is the underlying command that wajig calls upon to perform the operation.) This uses entries in the file /etc/apt/sources.list to know where to get the list of available packages from and which release of Debian you wish to follow. You can edit this file with: $ wajig editsources
(editor /etc/apt/sources.list)
This will use the system’s default editor, but you can change which editor is the default with the command: $ wajig updatealts editor
(update-alternatives --config editor)
(Use the command wajig listalts for a list of things for which alternatives exist, and hence can be updated.) You need to understand the format of the file /etc/apt/sources.list as explained in the manual page: $ man sources.list
It is pretty straightforward and we will see examples in the next section.
7.0.7
Finding Packages
Once the list of available packages is updated you can see what new packages have recently been added to Debian with the command: $ wajig new
Note that after the first time you use wajig update all packages will be considered new! But after the next update the new packages are those that were not in the available list from the previous update. Some (and often many) of the packages that you already have installed on your Debian system may have been upgraded in the archive since the last time you performed an update. The following command will list these packages:
143 $ wajig newupgrades
For a complete list of the packages you have installed but for which there are newer versions available on the archive use: $ wajig toupgrade
To check the version of any installed package and also the version available from the archive previously (last time, but one, you performed an upgrade) and now (based on the last time you performed an update), and to also see the so called Desired and Status flags of the package, use: $ wajig status
(similar to dpkg -l)
Without a list of package names all installed packages will be listed. To check for a particular package for which you might guess at part of its name you can use: $ wajig listnames
(apt-cache pkgnames)
Without the string argument all known package names will be listed. Each package installs some collection of files in different places on your system (e.g., in /usr/bin/, /usr/man/man1/ and usr/doc/). Sometimes you like to see where those files go or even just view the list of files installed. The command to use is: $ wajig listfiles
(dpkg --listfiles )
To list a one line dscription for a package use: $ wajig whatis
And to find which package supplies a given command of file use: $ wajig whichpkg
144
7.0.8
Wajig: Administering Debian
Installing Packages
To install a new package (or even to update an already installed package) all you need do is: $ wajig install
(apt-get install)
(Instead of install you could equivalently say update.) You can list multiple packages to install with the one command. The install command will also accept a .deb file. So, for example, if you have downloaded a Debian package file (with the .deb extension) you can install it with: $ wajig install <.deb file>
(dpkg -i)
The .deb file will be searched for in both the current directory and in the apt archive at /var/cache/apt/archive/. You can list multiple .deb files to install. If the .deb package file you wish to install is available on the internet you can give its address and wajig will download then install it: $ wajig install http://samfundet.no/debian/dists/woody/css/xine-dvd-css.deb
Sometimes you may want to install many packages by listing them in a file, one per line. You can do this with: $ wajig fileinstall
(apt-get install)
The file of packages to install can conveniently be created from the list of installed packages on another system with: $ wajig listinstalled >
You can upgrade all installed packages with:
(dpkg --get-selections)
145 $ wajig upgrade
(apt-get -u upgrade)
And you can upgrade all installed packages, remove those packages that need to be removed (for various reasons, including issues to do with dependencies) and install all newly required packages in the distribution with: $ wajig dist-upgrade
(apt-get -u dist-upgrade)
Once a package is installed you can remove it with: $ wajig remove
(apt-get remove)
Once again, you can list multiple packages to remove with the one command. A remove will not remove configuration files (in case you have done some configuration of the package and later re-install the package). To get rid of the configuation files as well use: $ wajig purge
7.0.9
(apt-get --purge remove)
Checking What’s Changed Before Installing
When you install an updated package it is sometimes useful to know what’s changed. The apt-listchanges package provides a mechanism whereby when updating packages you will be given a chance to review the change log of the package and then decide whether to continue with the upgrade. Simply install the apt-listchanges package to turn this feature on.
7.0.10
Installing Alien Packages
RedHat is certainly the leader in terms of installed base. Many packages come out in RedHat format (with the .rpm extension). These can usually be installed in Debian with little effort. Use the alien package to convert from the .rpm to the .deb format then install that package: $ fakeroot alien -d gmyclient-0.0.91b-1.i386.rpm $ wajig install gmyclient_0.0.91b-2_i386.deb
146
7.0.11
Wajig: Administering Debian
Putting Packages on Hold
Occasionally, and particularly if you are following the unstable release, some packages are broken for various reasons. This was the case with the package cdrecord in unstable. This package was compiled with kernel 2.4.n and had some kernel specific issues that were done differently with kernel 2.2.n. At compile time one or the other options was chosen (but not both!). Thus the newer binary versions of cdrecord would not run on a system using kernel 2.2.n. One solution is to build a Debian package of cdrecord using the wajig build command. Another is to reinstall an older version that worked and then place the package on hold with: $ wajig hold cdrecord
A wajig upgrade would not try to upgrade this package.
7.0.12
Building Packages
Sometimes the binary distribution of the package is configured or compiled with options that don’t suit you. Or it may be compiled for a more recent release than that which you are using and does not work for your release. Normally you would then be left on your own to retrieve the source of the package, configure and compile it, then install it into /usr/local/. This is then outside of the Debian package management system, which is just fine. But there is a better solution. You can download the source code for any Debian package from the Debian archive. You can then modify it and generate your own .deb file for installation. To download the source of a Debian package you will need deb-src lines in your /etc/apt/sources.list file, such as the following: deb-src http://ftp.debian.org/debian unstable main contrib non-free
Generally you can add the ‘-src’ to copies of pre-existing ‘deb’ lines. To retrieve and unpack a source Debian package use: $ wajig source
(apt-get source)
147 Note that you can list several packages and grab all of their sources. The source command downloads a .tar.gz file and a .dsc file for the package. The .tar.gz file contains the source code and associated files. The .dsc file contains test information that is used by the packaging system. The source command will also extract the contents of the .tar.gz archive into a subdirectory consisting of the package name and version. To go one step further and also configure, compile and generate a default Debian .deb package from source code (useful if you need to compile a package for your setup specifically) then use instead: $ wajig build
(apt-get source -b)
But, if you need to modify the source in some way and rebuild a package: $ $ $ $ $
wajig update wajig build ncftp dpkg-source -x ncftp_3.0.2-3.dsc cd ncftp-3.0.2 fakeroot dpkg-buildpackage -b -u
7.0.13
Managing A Local Package Archive
When packages are installed the corresponding .deb files are stored in /var/cache/apt/archive. This can become quite populated with older versions of packages and we can clean out these older versions with: $ wajig autoclean
(apt-get autoclean)
Warning: It is sometimes useful to have older versions of packages hanging around if you are tracking the unstable release. Sometimes the newer versions of packages are broken and you need to revert to an older version which is generally not available from the Debian archives, but might be in your local download archive. Nonetheless, if you get short of disk space then you might want to remove all the downloaded .deb files (not just the older versions of downloaded files) with:
148
Wajig: Administering Debian
$ wajig clean
(apt-get clean)
To remove files immediately after they have been installed edit /etc/apt/ apt.conf:
// Things that effect the APT dselect method DSelect { Clean "auto"; // always|auto|prompt|never };
7.0.14
Mirroring With APT
7.0.15
Pinning Distributions
With the Debian packaging system you can specify that your packages come by default from one distribution but you can override this with packages from other distributions. The concept is called pinning and after it is set up you can have, for example, testing as your default release and then include unstable in /etc/apt/sources.list and install cdrecord from unstable with:
# apt-get install cdrecord/unstable
The following /etc/apt/preferences makes apt-get use testing unless it is overridden, even though there are entries for unstable in /etc/apt/sources. list:
Package: * Pin: release a=testing Pin-Priority: 900 Package: * Pin: release o=Debian Pin-Priority: -10
149
7.0.16
Cache Packages Locally
To set up a local debian cache of deb files that you’ve created or downloaded separately: # # # # >
mkdir -p /usr/local/cache/dists/local/local/binary-i386 cp *.deb /usr/local/cache/dists/local/local/binary-i386 cd /usr/local/cache dpkg-scanpackages dists/local/local/binary-i386 /dev/null \ dists/local/local/binary-i386/Packages
Then add the following line to /etc/apt/sources.list: deb file:/usr/local/cache local local
7.0.17
Reconfigure Packages
$ wajig reconfigure debconf
(dpkg-reconfigure
debconf)
An alternative where you can specify a particular front end to use for the configurator is: # dpkg-reconfigure --frontend=dialog debconf
7.0.18
Setting Default Applications
Debian has a system of alternatives for various commands (or functionalities). For example, the editor command could be nano or nvi, or one of a large number of alternative editors. You can update the default for this command with: $ wajig updatealts editor
(update-alternatives --config editor)
Another common alternative is x-window-manager. You can get a list of all alternatives with: $ wajig listalts
(ls /etc/alternatives/)
The information is maintained in the directory /etc/alternatives/.
150
7.0.19
Wajig: Administering Debian
Bugs
If you find a problem with your system and think it might be a bug, use the reportbug package to check it out. This package will allow you to view bugs recorded against packages and also allow you to add a new bug report to the Debian bug reporting system. Otherwise visit the Debian email lists at http://lists.debian.org/ and search for the problem there. The advice one gets here is generally of high quality. In the following sections I identify a number problems or issues that I’ve not yet resolved for some of my installations.
7.0.20
Managing Daemons or Services
In addition to managing the installed packages wajig also allows you to start, stop, reload , and restart services (which are often provided by so called daemons—processes that run on your computer in the background performing various functions on an on-going basis). The commands all follow the same pattern:
$ wajig restart
(/etc/init.d/ restart)
The start and stop commands are obvious. The restart command generally performs a stop followed by a start. The reload command will ask the daemon to reload its configuration files generally without stopping the daemon, if this is possible. The services you can specifiy here depend on what you have installed. Common services include: apache cron exim gdm ssh
Web server Regular task scheduler Email delivery system The Gnome Windows Display Manager (for logging on) The Secure Shell daemon
Generally, daemons are started at system boot time automatically.
7.1 Other Commands
7.1
151
Other Commands
These may work their way into wajig. You can use the apt-get–download-only option of apt-get to download the files for an install without actually unpacking and setting up the packages. For example: # wajig update # apt-get --download-only dist-upgrade
In this way you are able to leave the download unattended and when you are ready you can monitor the unpacking and setup. If things go wrong somewhere the apt may be able to help. The apt-get– fix-broken will do its best: # apt-get --fix-broken dist-upgrade
but if things still don’t work, you may need to use dpkg directly to remove and isntall packages.
7.1.1
Maintaining a Distribution Archive
The apt method within dselect and the apt-get command (which the apt mathod uses) place all downloaded files into /var/cache/apt/archive. You can then use the apt-move command to move the archived files into a local hierarchy that mirrors a standard distribution hierarchy. Then you can point apt-get to this local archive by pointing to it from /etc/apt/sources.list using the file:// format. You can also give the option apt-get–downloadonly to apt-get to download but not unpack nor install the package. To set up a local machine as a local (partial) mirror of the Debian archive, first install apt-move: $ wajig install apt-move
Then edit /etc/apt-move.conf to add the sites that appear in /etc/apt/ sources.list (replacing slashes with underscores and the following may need to all be on one line):
152
Wajig: Administering Debian
APTSITES="mirror.aarnet.edu.au_pub_debian ftp.debian.org_debian non-US.debian.org security.debian.org"
Then remove all architectures not of interest from the ARCHS variable and DIST: ARCHS="i386 sparc" DIST=unstable
The apt-move command is then used to install any packages in your /var/ cache/apt/archives into the Debian mirror being created: # apt-move update
You can also create a complete mirror with: # apt-move mirror
These commands place the mirror into /mirrors/debian. To make it available on your web server simply: # cd /var/www # ln -s /mirrors pub
The /etc/apt/sources.list file can then be updated to point to the new archive as the first place to check for packages (place these lines first in the file): deb http://togaware.com/pub/debian unstable main contrib non-free deb http://togaware.com/pub/debian unstable/non-US main contrib non-free
All of this might happen on your server, yet your server is not likely to be the most up to date machine. Suppose your experimental machine (always kept up to date) is Inco (Section 5.9.24). You can rsync all packages in /var/ cache/apt/archives on Inco (Section 5.9.24) to your sever (e.g., Altrop), then on Altrop run apt-move (and also remove the original files from the archive on Inco (Section 5.9.24)):
7.2 Package Information
153
# rsync -v inx:/var/cache/apt/archives/* /var/cache/apt/archives/ # ssh inx wajig clean (or apt-get clean) # apt-move update (soon to be wajig move)
7.1.2
Synchronising Two Installations
The package system maintains a list of all packages installed (and de-installed). You can access this list, save it to a file, and use it to mark those same packages for installation (or deinstallation) on anther machine: # dpkg --get-selections > dpkg-selections # dpkg --set-selections < dpkg-selections # apt-get dselect-upgrade
7.2
Package Information
The dpkg and apt-get commands are pretty useful and provide a lot of functionality. Here’s some common things that you may want to do: Search for the package that installed the file diff.info.gz $ dpkg --search diff.info.gz
[alternative is -S]
List all packages installed (one line per package) $ dpkg --list $ dpkg --get-selections
[alternative is -l]
What is the (one-line) status of the diff package? $ dpkg --list diff
List the information for any package with diff in its name $ dpkg --list *diff*
List files associated with the package diff
154
Wajig: Administering Debian
$ dpkg --listfiles diff
[alternative dpkg -L diff]
What packages mention diff ? $ apt-cache search diff
Display information about a package $ apt-cache show diff
[alternative is dpkg --print-avail]
What packages depend on diff ? $ apt-cache showpkg diff $ apt-cache depends diff
7.3
Alternative Applications
Debian has a mechanism for dealing with applications that provide the same functionality. We describe here how this mechanism works and how you can use it to tune your installation. If you have more than one variant of emacs installed (e.g., emacs19, emacs20, and xemacs) then you can configure which one you get by default with: $ wajig updatealts emacs
You will be asked to choose from a list of alternatives. To specify which window manager to use as the system default: $ wajig updatealts x-window-manager
Suppose the window-manager you want to use as the default is not listed as available. You can install it with: # update-alternatives --install /usr/bin/x-window-manager \ x-window-manager /usr/bin/mywm PRIORITY
7.4 Building Debian Packages
155
Where PRIORITY is a number higher than the highest existing priority for the x-window-manager alternative. You can get a list of priorities with:
# update-alternatives --display x-window-manager
To remove a Window Manager:
# update-alternatives --remove x-window-manager /usr/bin/mywm
7.4
Building Debian Packages
If you want to contribute to the distributed effort of maintaining Debian then find a package that you use regularly and is not available under Debian and package it up:
1. Read the developer documentation at http://www.debian.org/doc/ devel-manuals, probably starting with the ”New Maintainer’s Guide”. Most of these manuals can be installed as debian packages and read offline. 2. Find a Debian developer that will sponsor you http://www.internatif. org/bortzmeyer/debian/sponsor/ 3. Your sponsor will have access to the debian machines and can test your package on all the architectures with you.
Alternatively become a developer yourself. When you want to create a new package, send a message to debian-devel with a subject line ITP: mynewpackage. The ITP stands for Intend to Package. The packaging manual is a reference on the Debian formats, installation mechanism and standard tools (those in dpkg-dev). It doesn’t talk about the policies and isn’t such a good guide for new maintainers.
156
7.5
Wajig: Administering Debian
Packages: Roll Your Own
I’ve packaged up a tool I’ve written called wajig which is a simplified front end to the APT and DPKG suite of tools. It is a python program. I use autoconf to manage the configuration. I turned the tool into a Debian package using the steps outlined below. A useful resource for this is the Debian Policy Manual at http://www. debian.org/doc/debian-policy/
7.5.1
Prepackaging Development Environment
The Source Code Let’s assume I maintain the source code in wajig/development. Under this directory there is a collection of information files, configuration files, and a src subdirectory containing the python source code. This is a common GNU setup although not so common for python source code. Files The files include some that are required by the GNU standards and some that are required for the installation: ChangeLog Record of changes to the tool. configure.in Input for autoconf to generate configure. COPYING License associated with the tool. INSTALL Simple instructions on how to configure, compile and install. Makefile.in Template for the Makefile. NEWS A record of changes between versions. wajig.1 Every tool should have a man page. wajig.sh.in Generates the wajig ‘executable’. src A subdirectory called src holds all the python source code.
7.5 Packages: Roll Your Own
157
Building the Distribution Using autoconf we need a configuration file configure.in which contains the version number and other relevant information. See below for an example configure.in Each of the identified AC OUTPUT files will be generated by the configure script from the corresponding files suffixed with .in by the ./configure script which is in turn generated by the autoconf command which reads information from configure.in So, when you change the version number regenerate the configure script with: $ autoconf
Next time you ./configure the new Makefiles and source code will contain the updated information. $ ./configure
The Makefile.in in the base directory includes a target to generate a tar file for distribution: $ make dist
The resulting tar file will be named something like ./wajig-0.1.1.tar.gz. After making the distribution tar file move it to the parent directory for the convenience of the Debian packaging tools: $ mv wajig-0.1.1.tar.gz ..
configure.in dnl Process this file with autoconf to produce a configure script. AC_INIT(src/wajig.py) PACKAGE=wajig VERSION=0.1.1
158
Wajig: Administering Debian
AC_PATH_PROG(PYTHON, python) AC_SUBST(PYTHON) AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_CC AC_OUTPUT(Makefile src/Makefile src/const.py wajig.sh)
7.5.2
Initiating the Debian Package
The first task is to set up the information required for the Debian packaging system. Extract the distribution:
$ tar zxvf wajig-0.1.1.tar.gz
to create the wajig-0.1.1 subdirectory. Change into this directory and then run dh make to set things up for Debian:
$ cd wajig-0.1.1 $ dh_make -e [email protected] -f ../wajig-0.1.1.tar.gz
You will be asked what kind of package to create and since wajig is a single binary package we choose s. This has now created a debian subdirectory and copy of the original distribution in ../wajig-0.1.1.orig. Now edit the files in the debian subdirectory to tell Debian the appropriate information about the package.
7.5 Packages: Roll Your Own
159
control copyright changelog rules docs Other Files
7.5.3
Building the Debian Package: First Time
Now you are ready to build and check the new package: $ dpkg-buildpackage -rfakeroot $ cd .. $ lintian -i wajig_0.1.1-1_i386.changes
7.5.4
Adding the Package to Your Archive
Once the package is correctly built load it onto your Debian archive to provide it for others to access: $ $ $ $ $ $ $
cp wajig_0.1.1* /var/www/debian/ cd /var/www/debian/ chmod go+r wajig_0.1.1* apt-ftparchive packages . > Packages apt-ftparchive sources . > Sources gzip -c Packages > Packages.gz gzip -c Sources > Sources.gz
You will need to add the appropriate line to your /etc/apt/sources.list file: deb http://togaware.com/debian ./ deb-src http://togaware.com/debian ./
160
Wajig: Administering Debian
If you are a Debian developer you would upload the package directly to the Debian archives using the dupload tool instead of onto your own archive.
7.5.5
Updating the Debian Package
Updating From New Distribution Suppose we have a new wajig-0.1.2.tar.gz and want to package this up. Ensure this tar file is in the root directory, cd into the old source directory, and ask Debian to update: $ cd wajig-0.1.1 $ uupdate -u wajig-0.1.2.tar.gz
The updated source directory is ../wajig-0.1.2. We simply go there and build the Debian package and install it in our archive: $ $ $ $ $ $ $ $ $ $ $
cd ../wajig-0.1.2 dpkg-buildpackage -rfakeroot cd .. lintian -i wajig_0.1.2-1_i386.changes cp wajig_0.1.2* /var/www/debian/ cd /var/www/debian/ chmod go+r wajig_0.1.2* apt-ftparchive packages . > Packages apt-ftparchive sources . > Sources gzip -c Packages > Packages.gz gzip -c Sources > Sources.gz
Then install the new package with: $ apt-get update $ apt-get install wajig
Of course, if you are already using wajig this becomes: $ wajig update $ wajig install wajig
7.5 Packages: Roll Your Own
161
Updating Debian Packaging Make changes to any of the debian files and increment the Debian release number (the number after the “-” in the version) using dch and regenerate the Debian packages: $ $ $ $ $ $ $ $ $ $ $
dch -i dpkg-buildpackage -rfakeroot cd .. lintian -i wajig_0.1.2-2_i386.changes cp wajig_0.1.2* /var/www/debian/ cd /var/www/debian/ chmod go+r wajig_0.1.2* apt-ftparchive packages . > Packages apt-ftparchive sources . > Sources gzip -c Packages > Packages.gz gzip -c Sources > Sources.gz
162
Wajig: Administering Debian
Chapter 8 Audio GNU/Linux provides tools for listening to, recording, and modifying audio. Recording audio CDs is discussed in Section 15.3. Making sound recordings and mixing is covered in Chapter 80. To extract audio from your DVD see Section 89.2.3. In this chapter we talk about setting up of audio chips under GNU/Linux, and tools for manipulating audio files.
8.1
Configuring Your Audio Chip
Use the Debian package sndconfig to automatically identify your audio chip and to add this information to /etc/modutils/sndconfig. If the audio device is not supported then you will probably need to get a newer kernel. Suppose you has an i810 audio chip (82801DB AC’97). Get this information from the lspci command: > lspci ... 00:1f.5 Multimedia audio controller: Intel Corp. 82801DB AC’97 ...
The PCI ID here is 82801. Look this up in /usr/src/linux/drivers/ sound/i810\_audio.c and if it’s there, it should be supported. 163
164
8.2
Audio
Audio Not Working
If you notice that a user starts up Gnome and receives a message about Audio not working the likely cause is that the user is not in group audio (as no users are in group audio by default). You need to: # adduser kayon audio
Next time user kayon logs on they will be able to use the audio device.
8.3
Audio File Information
Information about an audio file can be stored as part of the audio file itself (at least in OGG or MP3 format). This can include track titles, artists, album titles, genre, and more. You can view the information using the vorbiscomment command: > vorbiscomment -l track05.ogg title=Mother artist=Roger Waters album=In The Flesh - Live tracknumber=5 genre=Rock
Chapter 9 AbiWord: Word Processor Debian Pacakges: abiword The Gnome Office Suite offers AbiWord for word processing. AbiWord can import and export Micorsoft Word documents with quite a respectable degree of compatibility. But for starting new documents it is a very good choice. AbiWord is lightweight in terms of features when compared to Microsoft Word but it has the features that 90% of the users need! AbiWord is also distinguished by the fact that it runs on very many platforms, including MS-Windows, BeOS (for both PPC and Intel hardware), Linux (Intel, PPC and Alpha), FreeBSD, Solaris, AIX, SGI Irix, NetBSD, and QNX. Because of its light weight use of computer resources (compared to Microsoft Word) AbiWord is even popular on the MS-Windows platform. The AbiWord user interface is very intuitive and in no time you will be producing the documents you want. If you are familiar with Microsoft Word then the AbiWord interface will be very familiar.
9.1
Export to LaTeX
A very useful feature of AbiWord is its export to LATEX. It does quite a good job in generating a representation in LATEX.
165
166
AbiWord: Word Processor
Figure 9.1: Basic AbiWord interface is very familiar.
Chapter 10 APM: Power Management Advanced power management (APM) is supported by the kernel1 but because some older machines have problems with it some Debian kernels have it turned off by default. Thus, when you poweroff your machine (e.g., by poweroff) the machine does not automatically power down. To turn on apm, if apm is compiled into the kernel (i.e., not a module) then simply add the following to the kernel configuration (often in /etc/lilo/ conf, assuming you are using lilo to boot your machine): append="apm=on apm=power-off"
If you have apm as a module then use the following when you load the module: # modprobe apm power_off=1
Or for a more persistent approach add the following line to /etc/modules: apm power_off=1
Some relevant kernel configurations are: 1
Current Debian kernels have CONFIG APM as a module but CONFIG APM DO ENABLE is not set.
167
168
APM: Power Management
CONFIG_APM=y CONFIG_APM_DO_ENABLE=y CONFIG_APM_CPU_IDLE=y CONFIG_APM_DISPLAY_BLANK=y CONFIG_APM_RTC_IS_GMT=y CONFIG_APM_IGNORE_MULTIPLE_SUSPEND=y CONFIG_APM_IGNORE_SUSPEND_BOUNCE=y
This configuration allows, for example, the suspend feature to function on laptops (so that when you close the laptop lid the OS suspends). The laptop will beep then turn itself off. Simply open the laptop lid to resume. This works for both console logins and X sessions. You can also eject the laptop from a docking station to achieve the same effect. When the laptop lid is opened, or the laptop is inserted back into a docking station, the system resumes. It seems advisable to do this only when in console mode (that is, not while you have an X session running - it’s not quite there for X sessions yet). It is also suggested to install the apmd package which provides the apm command. This produces a more human readable output than a simple cat /proc/apm and can suspend your laptop from the command line: # apm AC off-line, battery status high: 56% (2:27) # apm -s
A suspend while connected to power within a docking station does not seem to suspend the machine completely. It sends it to sleep but it does not beep and power down. Some useful commands related to rebooting are: # poweroff # reboot
(shutdown and turn off the computer) (shutdown and reboot the computer)
After installing the apmd package the suspend maintains the clock correctly between a suspend and a resume. (Although I seem to be losing a few seconds each time.) Note that a suspend will disconnect your modem!
169 PROBLEMS When you eject the laptop from a docking station while running an X session it does not come back properly when the laptop is reinserted into a docking station. Sometimes the display is half off the screen. Sometimes simply get streaks across the screen. If this happens, you can go back to a console as usual with CTRL-ALT-F1, or exit from the X session with CTRL-ALT-BACKSPACE. If you eject while running an X session and open the laptop lid you will not get the proper display, and may damage the display. It can also freeze the laptop. Suspend maintains RAM with the battery. Hibernate saves everything to disk. Standby powers down disks and the lcd display.
170
APM: Power Management
Chapter 11 Backup Computers crash, disks become corrupt, data is lost, security is compromised. Today computers are pretty reliable and it is rare to lose data but it can happen and usually when it is most inconvenient! Important work should always be backed up. In this chapter we review approaches to backup. We begin with a simple approach which uses another backed up host on a network that you can access. In this approach you simply copy files across to that other host. This is useful in an environment where you often work from home and have a good backup system in the office. The second approach uses the commercial backup system called Legato NetWorker (also known as the Solstice NetWorker).
11.1
Backup To Other Computers
Consider the situation of a collection of Debian boxes with no backup facilities as such, but there is an accessible machine with a proper backup regime. Access to the backed up machine is via ssh. The backup can be performed using a backup script which you create in /etc/cron.daily so that it will be executed each day (by default, 6:25am). The contents of the script are: #!/bin/sh # # Script for /etc/cron.daily #
171
172
Backup
LOGFILE="/root/BACKUP.log" RSYNC="/usr/bin/rsync" DEST="[email protected]:backup/$(/bin/hostname)" OPTS="--rsh=ssh --cvs-exclude --archive --compress " OPTS=${OPTS}"--delete --delete-excluded --verbose" INCFILE="/etc/backup.include" echo "===================================================" >> ${LOGFILE} date >> ${LOGFILE} echo "$RSYNC $OPTS --include-from ${INCFILE} / ${DEST}" >> ${LOGFILE} $RSYNC ${TESTING} $OPTS --include-from ${INCFILE} / ${DEST} >> ${LOGFILE} date >> ${LOGFILE} echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >> ${LOGFILE}
The file /etc/backup.include might contain: # # # # # # # # # +
Identify specific file types to exclude *.mp3 *.rpm *.deb *.wav *.avi *.mov *.temp *.tmp *.cdr Exclude paths that contain .thumbnails .xvpics cache skins thumbnails Now specify specific trees to back up /etc
11.2 Legato NetWorker + + + + + # # # -
173
/home /root /usr/local /var/mail /var/backups And exclude everything else /*
Since this is using ssh (OpenSSH, ssh protocol 2) and it is a cron job (i.e., you can not supply a password or passphrase), create a ssh public key for adding to kayon@caravan’s authorized keys file: modena# ssh-keygen -t dsa -N "" Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: ce:b3:e5:82:ab:72:3d:50:2e:96:65:e0:15:a3:4e:de root@velox modena# scp .ssh/id_dsa.pub [email protected]:.ssh/authorized_keys.n modena# ssh kayon@caravan caravan$ caravan$ caravan$ caravan$
cd .ssh cat authorized_keys.n >> authorized_keys rm authorized_keys.n exit
Then the ssh connections will go straight through to kayon@caravan without the need to supply a password (or passphrase).
11.2
Legato NetWorker
Legato’s NetWorker is a network based backup system. A typical situation is to have the NetWorker server running on a Solaris backup server and installing the Legato client on your Debian workstation. Your workstation can then be backed up daily as part of the server’s schedule.
174
Backup
To install the client software and the manual pages (available as Red Hat packages) on your Debian workstation mount the supplied CD-ROM (which might be called the Solstice Backup 6.1: Servers, Clients and Storage Nodes, Volume 1 ) and then: $ wajig rpminstall /cdrom/LINUX86/LGTOclnt/lgtoclnt-6.1-1.i386.rpm $ wajig rpminstall /cdrom/LINUX86/LGTOman/lgtoman-6.1-1.i386.rpm
A daemon needs to be listening for connections to the workstation from the backup server. The daemon is called nsrexecd and to set things up in the Debian way create the following as /etc/init.d/networker: #!/bin/sh case "$1" in start) echo -n "Starting NetWorker daemons: " if [ -f /usr/sbin/nsrexecd ]; then echo -n " nsrexecd" # # Allow access from only the specified hosts. # /usr/sbin/nsrexecd -s nsrhost fi if [ -f /usr/sbin/nsrd ]; then echo " nsrd" /usr/sbin/nsrd fi echo "." ;; stop) echo -n "Stopping NetWorker daemons:" if [ -f /usr/sbin/nsr_shutdown ]; then echo -n " nsr_shutdown -a -q" /usr/sbin/nsr_shutdown -a -q fi echo "." ;; restart|force-reload) $0 stop $0 start ;; *)
11.2 Legato NetWorker
175
echo "usage: ‘basename $0‘ {start|stop|restart|force-reload}" exit 1 ;; esac exit 0
Make sure it is executable: # chmod a+rx /etc/init.d/networker
Now you can start the daemon and check that it is running (you will get 2 nsrexecds running): $ wajig start networker $ ps uaxxc | grep nsr root 3275 0.0 0.0 2356 564 ? S Oct10 0:00 nsrexecd root 3285 0.0 0.0 2496 1020 ? S Oct10 0:00 nsrexecd
To have the daemon start and stop at boot and shutdown time create the following symbolic links: # # # #
cd ln cd ln
/etc/rc2.d -s ../init.d/networker S95networker /etc/rc0.d -s ../init.d/networker K05networker
Note that in the init script above reference is made to nsrhost. This is the host name of the backup server (on the local network it might actually be called nsrhost). Replace this with the host name of your own backup server. Now to recover a file run the graphical interface nwrecover.
176
Backup
Chapter 12 Command Line: Bash When Bash is invoked as an interactive login shell it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash\_profile, ~/.bash\_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. When a login shell exits Bash reads and executes commands from the file ~/.bash\_logout, if it exists.
177
178
Command Line: Bash
Chapter 13 Booting Booting is simply the process of starting up the system when the computer is powered on. The computer’s BIOS (the Basic Input/Output System which is programmed into the hardware of the computer) takes charge and decides what is to be done. Usually the BIOS first runs a Power-On-Self-Test (POST) and then looks for boot information which typically resides in the Master Boot Record (MBR) of the hard drive (or in general the boot sector of any available device). For a GNU/Linux system the MBR contains a boot loader like lilo of grub. These will give you choices of operating systems to boot whenever you reboot your computer. To install a boot loader you will either overwrite the master boot record with one that will start up lilo, or, for MS-Windows/NT, you will add extra information in a configuration file to identify, for MS-Windows/NT, how to boot into GNU/Linux. The grub boot loader is quite a bit more flexible than LILO and is often a good choice. Lilo is the traditional GNU/Linux boot manager (and silo is the boot manager for Sparc GNU/Linux). A newer alternative that may replace lilo is the GNU grub (GRand Unified Bootloader). Grub can be set up to automatically identify newly installed kernels, making the installation of new kernels quite straightforward. Another emerging alternative is xosl, the extended OS loader. If you are using a GNU/Linux boot loader such as Grub then the Grub code will be loaded into memory and executed. Grub takes on the task of then loading an operating system, such as the GNU/Linux kernel. More information about the process is available from http://www.tldp.org/LDP/ 179
180
Booting
sag/index.html. In this chapter we also explore issues around dual booting. See Chapter 47 for what happens once the Linux kernel starts booting.
13.1
Lilo
Lilo can be installed into the Master Boot Record (MBR) or as the first part of some other disk partition. That is, you have the choice of the BIOS starting up lilo or some other program in your MBR. The MBR program that cames with Debian is installed when you run the command install-mbr. To overwrite the part of lilo that is installed on the MBR you simply install something else in the MBR! When lilo overwrites the MBR it keeps a copy of the old MBR in case you find you need to restore it for any reason.
13.1.1
Large Disks
On Velox (Section 5.9.26) lilo fails because the disk is too big. Use lilo -L (or add lba32 to /etc/lilo.conf), then: # lilo -L Added 2.2.18pre21 * # dd if=/dev/sda of=/root/bootsect.lnx bs=512 count=1 # mcopy /root/bootsect.lnx a: # lilo -u /dev/sda # reboot (into NT)
Then as above in Section 13.5 to update the MS-Windows/NT boot loader. Remember: Be sure to run the lilo command after you update /etc/lilo. conf or the changes will not be in effect.
13.1.2
Kernel Images
Note that new kernel images go into /boot/vmlinux. The old is put into /boot/vmlinux.old. Thus you can have a /etc/lilo.conf like:
13.2 GRUB: The Grand Unified Boot Loader
181
image=/vmlinuz label=linux root=/dev/hda2 image=/vmlinuz.old label=linux.old root=/dev/hda2
Note also that /vmlinux is a symbolic link into the actual file stored in /boot.
13.2
GRUB: The Grand Unified Boot Loader
Debian Pacakges: grub. Grub (the GRand Unified Bootloader) is a boot loader designed to address the limitations of lilo. It makes up for numerous deficiencies in many PC BIOSs while providing full-featured command line and graphical interfaces. Grub recognises fdisk partitions, can dynamically read Linux ext2fs, and MS-DOS FAT16 and FAT32 filesystems, and can boot multiboot-compliant kernels (such as GNU Mach), as well as standard Linux and MSWindows kernels. A good introduction to grub is available from http://www.gnu.org/software/ grub/grub.html and a good guide to multi-boot set up is http://www. tldp.org/HOWTO/Multiboot-with-GRUB.html. This latter resource looks at multi-booting 4 operating systems although the information is still useful if all you want is to multiboot just two. To switch from lilo to grub simply install it with: # wajig install grub # grub-install /dev/hda # update-grub
This creates a /boot/grub/menu.lst file which you might like to review just to make sure it looks okay. For most simple situations it should be, but if, like Mint, you have a dual boot with MS-Windows/NT on the first partition and Linux on the second, you need to change the default locations of Linux. Edit /boot/grub/menu.lst to change the following two lines from: # kopt=root=/dev/hda1 ro # groot=(hd0,0)
182
Booting
to # kopt=root=/dev/hda2 ro # groot=(hd0,1)
Also, add to the end of the file: title rootnoverify makeactive chainloader
Windows NT (hd0,0) +1
Once it looks okay, run update-grub then reboot! When installing new kernels you can have the new kernel automatically added to the menu by adding the following lines to (and in fact making the file look the same as) /etc/kernel-img.conf: # Turn off Lilo stuff do_symlinks = no do_bootloader = no # Initrds are OK for GRUB do_initrd = yes # Run cool GRUB stuff postinst_hook = /sbin/update-grub postrm_hook = /sbin/update-grub
If you start having problems booting, at the grub menu type c to get the command line. Try: root (hd0,4) (/dev/hda5) kernel /boot/vmlinuz-2.4.18-bf2.4 root=/dev/hda5 ro boot
13.3
Secure Boot
Disable booting from floppy in BIOS, password protect LILO.
13.4 Dual Boot: Multiple Operating Systems
13.4
183
Dual Boot: Multiple Operating Systems
Some operating systems, including MS-Windows, provide limited and sometimes inflexible support for multiple choices at boot time. GNU/Linux, on the other-hand, is well-equipped for booting multiple operating systems as is its philosophy of not restricting what one can do and encouraging choice and freedom. If you want to include MS-Windows on your system it is generally best to install it first. MS-Windows/NT, for example, has a boot loader that likes to be in control and MS-Windows/98 is not so clever with multiple operating systems. Installing them first allows them to have the control they sometimes demand. GNU/Linux provides a variety of tools for maintaining multiple operating systems on your one computer. There are plenty of options. In particular you can keep MS-Windows and install GNU/Linux as well. This will give you some sense of security in case GNU/Linux does not meet your needs. If GNU/Linux becomes your choice you can later remove MS-Windows and use the recovered disk space for GNU/Linux. Dual boot is a little misleading since there’s really no inherent limit (except for available resources) to the number of operating systems you might install on your PC. Generally it’s two or sometimes three, but could be four or more! These might include MS-Windows/2000, MS-Windows/XP, and one or two versions of GNU/Linux!
13.4.1
Dual Boot with MS-Windows/NT
MS-Windows/NT has it’s own boot loader that likes to be in charge. That’s okay. One solution is to simply tell the MS-Windows/NT boot loader what to do if you want to boot into GNU/Linux. This means copying the GNU/Linux boot code into a file, transferring that file to a MS-Windows/NT partition, and then adding a menu item for the MS-Windows/NT boot loader to select the GNU/Linux boot if required. Using grub we don’t need to do this as grub supports chain loaders that allows you to choose to load up the MSWindows/NT boot loader. If you wish MS-Windows/NT to remain in control, the do the following: Boot from floppy disk into GNU/Linux. Log in as the root user. Check
184
Booting
where the boot sector of your GNU/Linux partition is: # rdev /vmlinuz Root device /dev/hdc1 So on this particular machine the boot sector is on the second hard drive (/dev/hdc). When installing don’t let lilo install a boot loader over the existing master boot record on your hard drive (usually /dev/hda) unless you wish to wipe out the original NT – For dual boot using the MS-Windows/NT boot loader see the http://www.tldp.org/HOWTO/Linux+NT-Loader.html Linux with NT Loader mini HOWTO, but I detail the steps below. Use LILO You then copy the Linux boot sector to floppy disk, reboot to NT, and copy the Linux boot sector onto the NT hard disk. The NT boot loader is then told where to find the file (edit C:\boot.ini). It is all very clearly documented in the above mini HOWTO. On bootup you can then choose between GNU/Linux and Windows NT. # editor /etc/lilo.conf root=/dev/hdc boot=/dev/hdc append="hdc=13424,15,63" # /sbin/lilo Warning: /dev/hdc1 is not on the first disk Added Linux * # dd if=/dev/hdc1 of=/root/bootsect.lnx bs=512 count=1 # mcopy /root/bootsect.lnx a: # reboot (into NT) C:\>copy a:\bootsect.lnx c:\bootsect.lnx C:\>attrib -s -r c:\boot.ini C:\>notepad c:\boot.ini [boot loader] timeout=30 default=C:\bootsect.lnx [operating systems] C:\bootsect.lnx="Linux" multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ... multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ... C:\>attrib +s +r c:\boot.ini C:\>reboot (into Linux)
Note the inclusion of the append line above in my lilo.conf. This ensures /dev/hdc is found. Otherwise, sometimes it is not.
13.5 MS-Windows/NT or MS-Windows/2000
185
After you install a new kernel under Linux (either from a kernel-image package on the Debian archive or else your own compiled kernel-image) you will need to rerun LILO. By default lilo.conf identifies the image to boot as ”/vmlinuz”. This is a symbolic link to, for example, /boot/vmlinuz-2.0.36.
13.4.2
Boot NT from LILO
A simple trick to avoid using the MS-Windows/NT boot loader is to ensure that the primary MS-Windows/NT partition is less than 2GB in size. Then when you install GNU/Linux let LILO take control as normal and create LILO entries for both MS-Windows/NT and GNU/Linux. In all cases MS-Windows boots from /dev/hda1 (or perhaps /dev/sda1 for a SCSI disk) which is drive C a primary partition and the active partition. Add to /etc/lilo.conf: image=/dev/hda1 label=Windows2000
13.5
MS-Windows/NT or MS-Windows/2000
Set up MS-Windows/NT or MS-Windows/2000 and it will automatically set up a dual boot for any DOS or MS-Windows/95 system installed. If you install MS-Windows/95 after installing MS-Windows/NT it will break the MS-Windows/NT boot mechanism and you’ll have to repair it. Next install Linux but don’t let lilo install a master boot record (although in my recipe below I do). Instead have it install a boot record to the root partition. You probably also want to create a boot floppy so you can boot your Linux system the first time after installation. MINI and Velox (Section 5.9.26): After compiling the kernel set up dual boot. Use LILO to install boot sect in MBR. On MINI /etc/lilo.conf is: boot=/dev/hda root=/dev/hda2
Run lilo:
186
Booting
# lilo Added 2.2.18 *
After running lilo (if you overwrite the master boot record—MBR) you can no longer boot into MS-Windows/NT immediately. But, lilo stores a backup MBR in /boot/boot.0300, so don’t despair. Copy the lilo boot sector to file then restore the MS-Windows/NT MBR using lilo -u. The recipe is: # dd if=/dev/hda of=/root/bootsect.lnx bs=512 count=1 # mcopy /root/bootsect.lnx a: # lilo -u /dev/hda # reboot (into NT) C:\>copy a:\bootsect.lnx c:\bootsect.lnx C:\>attrib -s -r c:\boot.ini C:\>notepad c:\boot.ini [boot loader] timeout=5 default=C:\bootsect.lnx [operating systems] C:\bootsect.lnx="Debian GNU/Linux" multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows..." multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows..." C:\>attrib +s +r c:\boot.ini C:\>reboot (into Linux)
13.6
The Booting From Floppy Alternative
You don’t need to use any special boot programs if you are not comfortable with the process of using a boot loader and modifying the computer’s master boot record. Instead, all you need is to boot GNU/Linux from a boot floopy that will be created when you install GNU/Linux. You simply insert the floppy whenever you boot your computer into GNU/Linux and make sure it is not inserted if you want to boot into the original operating system. Booting from floppy is a little slower than booting from hard disk but otherwise functionally equivalent.
Chapter 14 Cameras Debian Pacakges: gphoto2
14.1
Setup of HP Photosmart 320
See Section 88.1.1 for information on setting up the camera through a USB connection. One time after deleting photos from the camera after mounting the camera as a USB Mass Storage Device and deleting all photos the camera thought it had no memory left and yet knew that it had no photos! Had to reformat the memory!
14.2
Accessing Photos
Use gphoto2: # gphoto2 --get-all-files
187
188
Cameras
Chapter 15 CD-ROM A clean install of Debian GNU/Linux is most likely to find your CD-R, CDRW, and DVD drives without the need for you to do anything. If not, then see Section 15.1. The simplest way to burn a CD is with the Naultilus CD Creator described in Section 61.3. Other approaches are details below.
15.1
Setup
To make use of a CD-ROM device you need to know what device it is mapped to. Let’s assume it is /dev/hde (but look through the output of the dmesg command to see which it is). If the device /dev/hde does not exist (for modern versions of Debian it usually does exist as the devices where identified at boot) you will need to create it with MAKEDEV as root: # cd /dev # ./MAKEDEV hde
As a common convenience /dev/cdrom points to the physical device /dev/ hde using a symbolic link: # ln -s /dev/hde cdrom
You can then mount any data CD-ROM: 189
190
CD-ROM
# mount /dev/cdrom /cdrom # ... # umount /cdrom
If users can not mount the CD-ROM device then they probably don’t have the right permissions. To allow general access to the CD-ROM edit /etc/fstab to add the following line. /dev/cdrom
/cdrom
auto
defaults,noauto,users,ro,nohide
0 0
Any user can then mount and unmount /cdrom, irrespective of who mounted it. Also note that the standard CD-ROM format is iso9660 and the auto in the above could have been this. However, as DVDs become more common using auto allows the udf format to also be recognised with no extra effort. The Gnome mount applets allow a user to mount and unmount the CDROM. Make sure you unmount the CD-ROM before you physically remove the media. (For most drives the eject button is disabled while the CD is mounted.) The various options in the /etc/fstab line above are: ro which mounts the file system as read-only; users which lets all users mount and unmount the file-system; noauto which means that the file-system is not automatically mounted at boot time; and nohide which shows hidden and associated files. With the above entry in /etc/fstab the command line mounting of the partition becomes: # mount /cdrom
By default the CD-ROM device belongs to group disk. For audio CD access the user will need to be a member of the group to which the device belongs. But do not add users to the group disk because this will give them read/write access to raw devices for all disks meaning that they can directly read the bits off the hard disk and effectively ignore file system permissions. Instead change the Unix group of /dev/hde from disk to cdrom and add users who need access to the drive to the group cdrom: # chgrp cdrom /dev/hde # adduser kayon cdrom
15.1 Setup
191
Next time user kayon logs on they will be in group cdrom in addition to the other groups they were already in. They will then have access to the CD-ROM device.
15.1.1
CD Writer as a SCSI Device
CD writing software for GNU/Linux (prior to kernel 2.6) targets SCSI devices, so you will need to install appropriate drivers so that your ATAPI IDE CD-RW (and your CD-R/DVD if you wish) pretends to be a SCSI device. It will then be identified as /dev/scd0 rather than /dev/hdd. Turning a IDE CD-RW into a SCSI CD-RW is pretty straightforward. First ensure the appropriate kernel modules are loaded (you need sg and ide-scsi ). Use the command lsmod to list the modules currently loaded in the kernel, and the commands modconf or insmod to load the modules. If you already have the drive under the control of ide-cd then you need to get rid of it (as below). You can ensure these happen at boot time, and the appropriate dependencies between kernel modules are identified, by creating /etc/modutils/cdrw: # # As suggested in CD Writing HOWTO # # This assumes IDE-CD is a module rather than copmiled into kernel. # options ide-cd ignore="hdc hdd" alias scd0 sr_mode pre-install sg modprobe ide-scsi pre-install sr_mod modprobe ide-scsi pre-install ide-scsi modprobe ide-cd
Note here that we are telling the IDE CD module to ignore the disk which we want the ide-scsi module to handle. The ide-scsi module won’t touch any disks already being driven. Change the hdd to the appropriate one of hda, hdb, hdc, or hdd. To check which one to ignore look through the output of the dmesg command for the CD-RW line which identifies the driver, which on Altrop (Section 5.9.20) is: hdd: ATAPI 40X CD-ROM CD-R/RW drive, 2048kB Cache
192
CD-ROM
Thus ide-cd should ignore hdd. If you want all CD drives to be SCSI (useful for some cases like cdrdao when asked to copy a disk) then don’t include either of the lines that mention ide-cd! Now update the modules.conf file with: # update-modules
Finally, tell the kernel to load the modules at boot time by adding the following to /etc/modules sr_mod sg ide-cd
You will now probably need to reboot to have the new configuration take effect. Also, don’t include ide-cd if you want all your drives recognised as SCSI. Once set up cdrecord can be used to identify the SCSI device on which the CD writer sits: For example, on Mint (Section 5.9.27) the device is 0,1,0. The LG CD-RW CED-8080B 1.04 on this host is identified using: # cdrecord -scanbus scsibus0: 0,0,0 0) ’_NEC ’ ’DV-5700A ’ ’3.07’ Removable CD-ROM 0,1,0 1) ’LG ’ ’CD-RW CED-8080B ’ ’1.04’ Removable CD-ROM
On Velox (Section 5.9.26) the device is 2,0,0. The SONY CD-RW CRX140E on this host is identified using: # cdrecord -scanbus scsibus0: 0,0,0 0) ’QUANTUM’ ’ATLAS10K2-TY184L’ ’DA40’ Disk scsibus2: 2,0,0 200) ’SONY’ ’CD-RW CRX140E’ ’1.0n’ Removable CD-ROM
15.1 Setup
193
Altrop (Section 5.9.20) and Velox (Section 5.9.26) have DVD drives (which remain as IDE devices as /dev/hdc) and a CD-RW writer (which with the above set up becomes /dev/scd0). Mint (Section 5.9.27) also has two drives but both are run as SCSI devices. If you are having problems with CD drives being found try adding ide-probe-modbefore ide-scsi in /etc/modules. A line that someone suggested to be added to lilo.conf: append = "apm=on apm=power-of idebus=N hdc=ide-scsi hdd=ide-scsi max_scsi_luns=1"
I’ve not used this.
15.1.2
Docking Station CD-ROM
Incx (Section ??), a laptop, has a CD-ROM located in the Docking Station. You will need a recent version of the kernel (at least post 2.2.15) so that it will be recognised on boot, displaying the following message: CMD646: IDE controller on PCI bus 01 dev 28 CMD646: chipset revision 0x03, MultiWord DMA Force Limited CMD646: 100% native mode on irq 10 ide2: BM-DMA at 0xfcc0-0xfcc7, BIOS settings: hde:pio, hdf:pio ide3: BM-DMA at 0xfcc8-0xfccf, BIOS settings: hdg:pio, hdh:pio ... hde: TOSHIBA CD-ROM XM-1802B, ATAPI CDROM drive ... ide2 at 0xfcf8-0xfcff,0xfcf2 on irq 10 .. hde: ATAPI 24X CD-ROM drive, 128kB Cache Uniform CDROM driver Revision: 2.56
15.1.3
LG CED-8080B Problems
On Mint (Section 5.9.27) this hardware seems to have some bad firmware. Others report a similar problem and yet others say they have no problem at all. If I knew how to obtain an update to the firmware and how to install it, no doubt it would all work! The problem is only for writing TAO. DAO seems just fine.
194
CD-ROM
# cdrecord -v speed=8 dev=0,1,0 -pad -audio -dummy *.wav ... Track 01: 0 of 29 MB written.cdrecord: Input/output error. write_g1: scsi sendcmd: retryable error CDB: 2A 00 00 00 00 00 00 00 1B 00 status: 0x2 (CHECK CONDITION) Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 64 00 00 00 Sense Key: 0x5 Illegal Request, Segment 0 Sense Code: 0x64 Qual 0x00 (illegal mode for this track) Fru 0x0 Sense flags: Blk 0 (not valid) ... cdrecord: Input/output error. mode select g1: scsi sendcmd: retryable error CDB: 55 10 00 00 00 00 00 00 10 00 status: 0x2 (CHECK CONDITION) Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 24 00 00 00 Sense Key: 0x5 Illegal Request, Segment 0 Sense Code: 0x24 Qual 0x00 (invalid field in cdb) Fru 0x0 Sense flags: Blk 0 (not valid)
Bill Unruh ([email protected]), posting on comp.os.linux.misc in January 2001, had the same problem with a 8080B compatible and mentioned that it works okay in DAO mode but not TAO. This is expected to be a transient problem as the driver catches up with the drive.
15.1.4
cdrecord Problem: Cannot . . . Bytes on /dev/zero
Under Debian, cdrecord version 1.10a18 was compiled with kernel version 2.4.x which has some incompatibilities with kernel version 2.2.x, resulting in an error in trying to mmap on /dev/zero. The typical scenario is: # cdrecord -dummy -v dev=2,0,0 -data test.iso Cdrecord 1.10a18 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling TOC Type: 1 = CD-ROM cdrecord: Invalid argument. Cannot get mmap for 4198400 Bytes on /dev/zero.
and again:
15.2 CD Software
195
# mkisofs -r cdr/ | cdrecord speed=8 dev =0,1,0 tsize=281056s -data Cdrecord 1.10a18 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling cdrecord: Invalid argument. Cannot get mmap for 4198400 Bytes on /dev/zero.
The solution is simply to recompile it: $ wajig build cdrecord
or $ wajig build cdrtools
Alternatively, install an older version of cdrecord that might be available on your machine in the archive of downloads: $ wajig install /var/cache/apt/archive/cdrecord_3%3a1.9-1_i386.deb
15.2
CD Software
Once you have set up your CD-R, CD-RW, or DVD driver you may be interested in packages like cdrecord, cdrdao, mkisofs, cdmaster, and videodvdrip.
15.2.1
cdrdao
The cdrdao package provides, by far, the simplest interface for burning CDs. By default cdrdao must be run as root, which is best set up for users through the use of sudo. If you trust all with access to your machine the you may want to allow anyone to run the program: # chmod u+s /usr/bin/cdrdao
The first step is then to find out where on the scsi bus your CD writer is and cdrdao does this with:
196
CD-ROM
$ cdrdao scanbus
Then create /home/kayon/.cdrdao, or /etc/default/cdrdao, with the following contents (replacing the 0,0,0 with your SCSI device address as identified by cdrdao scanbus, and the driver with the appropriate one for your CD writer - see the cdrdao man pages): write_device: "0,0,0" write_driver: "generic-mmc"
The following cdrdao commands can be specified on the command line without the need to identify the device each time: show-toc toc-info toc-size read-toc read-cd read-cddb show-data read-test disk-info msinfo unlock blank scanbus simulate write copy
15.2.2
-
prints out toc and exits prints out short toc-file summary prints total number of blocks for toc create toc file from audio CD create toc and rip audio data from CD contact CDDB server and add data as CD-TEXT to toc-file prints out audio data and exits reads all audio files and exits shows information about inserted medium shows multi session info, output is suited for scripts unlock drive after failed writing blank a CD-RW scan for devices shortcut for ’write --simulate’ writes CD copies CD
gcdmaster
Gcdmaster provides a Gnome GUI for cdrdao. For cdrdao be sure to create the following link: # cd /dev # ln -s cdrw cdrecorder
But gcdmaster failed for some reason (after cdrdao read the CD and then requested a RETURN!) and so why not just use the command line to copy a CD as described below!
15.3 CD Audio
15.2.3
197
xcdroast
This might be okay as a CD burner but gcdmaster seems to be easier to use. Note the following message that comes from xcdroast: I have installed xcdroast normally, so only root can run it. If you want non-root users to run it you can make it setuid. If you have suidmanager installed and use suidregister to make xcdroast setuid you will not need to do this again when you upgrade xcdroast. Please read /usr/doc/xcdroast/README.nonroot.gz before making xcdroast setuid.
15.2.4
MP3 Encoders
MP3 encoders are entwined in legal issues that are too complex to get into here. Recording your personal CDs to listen to the music you’ve already paid for appears reasonable. The encoder of choice is call lame. The Debian package is available at http://hive.me.gu.edu.au/ and the source is also at http://www.sulaco. org/mp3/. The issue with MP3 is that the MP3 codec is patented by Fraunhofer in Germany, and a license is required to use it. To address this a free audio format has been developed called Ogg Vorbis. There are many utilities that will rip CDs to Ogg Vorbis format.
15.3
CD Audio
15.3.1
Duplicate Audio CD Using cdrdao
Because Mint (Section 5.9.27) has no working cdrecord (at least for recording audio) we need to use cdrdao. The cdrdao package can be used to duplicate both data and audio CD-ROMs. To directly record an audio CD (or a data CD) from the SCSI device then burn it on the same device using cdrdao, add the following to /home/kayon/.cdrdao
198
CD-ROM
(replace the 0,1,0 with your SCSI device address as identified by cdrecord -scanbus, and the driver with the appropriate one for your CD writer): write_device: "0,1,0" write_driver: "generic-mmc"
Then: $ cdrdao copy
You’ll be asked to insert a new CD-R once the reading is complete and it is ready to write. The use of the .cdrdao file is simply to avoid having to specify the command line options of cdrdao which require --device and --driver. If you have both a CD drive (or perhaps a DVD drive) and a CD writer both as SCSI devices (see Section 15.1) then you can use cdrdao to record direct from the reader to the writer: $ cdrdao copy
To do a copy step-by-step, specifying the device and driver explicitly and using cdrdao you can do the following: $ cdrdao read-cd --device 0,1,0 --driver generic-mmc audiocd.toc $ cdrdao read-cddb --device 0,1,0 --driver generic-mmc audiocd.toc $ cdrdao write --device 0,1,0 --driver generic-mmc audiocd.toc
The read-cddb will look up the CDDB web database to find track information for the audio CD and generates a suitable table of contents that will be written to the CD-R if the CD writer supports CD-TEXT. To just create a table of contents for an audio disk: $ cdrdao read-toc --device 0,1,0 --driver generic-mmc audiocd.toc
To add CD-TEXT to the TOC from CDDB (not supported on many CD writers, including the LG)
15.3 CD Audio
199
$ cdrdao read-cddb --device 0,1,0 --driver generic-mmc audiocd.toc
The cd image is assumed to be in data.wav. Read the image (this command from gcdmaster): $ cdrdao read-cd --remote -v0 --read-raw --device 0,1,0 --driver generic-mmc --paranoia-mode 3 --datafile audiocd.bin audiocd.toc
15.3.2
Duplicate Audio CD Using cdrecord
On Altrop (Section 5.9.20) and Festival (Section 5.9.10) we can use cdrecord (which fails on Mint (Section 5.9.27)) to duplicate an audio CD in Disk At Once mode. The SCSI device for the CD-RW is 1,1,0 on Altrop (Section 5.9.20) and 0,0,0 and Festival (Section 5.9.10). First extract the audio from the source CD into individual WAV files: # cdda2wav -v255 -D /dev/hdc -B -Owav
Record the individual WAV files to CD: # cdrecord -v speed=8 dev=2,0,0 -dao -useinfo *.wav
Using cdrecord to record Track At Once mode (with a resulting 2 second gap between each track) # cdrecord -v speed=4 dev=0,1,0 -pad -audio -dummy *.wav
15.3.3
Audio CD From Collection of MP3s
We can use cdrdao to create an audio CD from a colleciton of mp3 files. On Mint (Section 5.9.27) this is the way to do it since cdrecord fails. The only complication is the need for a table of contents file, but it is easy to produce. There are issues to do with gaps but this can safely be ignored. Either wav or cdr files can be written by cdrdao to a CD-R disk. Put the following into /usr/local/bin/mkcdrtoc:
200
CD-ROM
#!/bin/sh for i in *.mp3; do if [ ! -e $(basename $i .mp3).cdr ]; then mpg123 --cdr - $i > $(basename $i .mp3).cdr; fi done printf "CD_DA\n" > disk.toc for i in *.cdr; do printf "TRACK AUDIO\nFILE \"$i\" 0\n" >> disk.toc done printf "\n========== disk.toc ==================\n" cat disk.toc printf "========================================\n" printf "\n>>>>>>>> Now run \"cdrdao write disk.toc\" <<<<<<<<<<\n"
Then the following two steps will convert all mp3 files in the current directory to cdr, then burn them to a CD-R or CD-RW. If you want to change the order of the tracks, simply edit disk.toc. $ mkcdrtoc $ cdrdao write disk.toc
We can alternatively use cdrecord: $ for i in *.mp3; do mpg123 --cdr - $i > $(basename $i .mp3).cdr; done $ cdrecord -v dev=0,1,0 -audio -pad *.cdr
15.4
Copy a CD image to Disk
$ dd if=/dev/cdrom of=/tmp/cdimage.iso
15.5
CD Data
Nautilus provides by far the simplest approach to burning data CDs. See Section 61.3 for details.
15.5 CD Data
15.5.1
201
Intermediate Image
First build the iso9660 image:
$ mkisofs -r -o cdimage.raw /home
Check that it looks okay:
$ mount -t iso9660 -o ro,loop=/dev/loop0 cdimage.raw /mnt/tmp $ ls /mnt/tmp $ umount /mnt/tmp
Write the CD:
# cdrecord -v speed=8 dev=1,1,0 -data cdimage.raw # cdrecord -v speed=8 dev=0,1,0 -data cdimage.raw # cdrecord -v speed=16 dev=0,0,0 -data cdimage.raw
15.5.2
Altrop Mint Festival
No Intermediate Image
The output of mkisofs can be fed directly into cdrecord if the CPU is fast enough (better than 400MHz). Note that the default installation requires cdrecord to be run as root. The first step is to determine the image size:
# IMG_SIZE=$(mkisofs -R -q -print-size /home 2>&1 | sed -e "s/.* = //") # echo $IMG_SIZE
Then write the data CD:
# [ "0$IMG_SIZE" -ne 0 ] && > mkisofs -r /home | > cdrecord speed=8 dev=0,1,0 tsize=${IMG_SIZE}s -data -
202
15.5.3
CD-ROM
Direct Copy Data CD from /dev/cdrom to SCSI burner
This works for Altrop (Section 5.9.20), Mint (Section 5.9.27) and Festival (Section 5.9.10) and only for root (unless cdrecord is configured to install setuid ), by default. # cdrecord -v dev=1,1,0 speed=8 -isosize /dev/cdrom # cdrecord -v dev=0,1,0 speed=8 -isosize /dev/cdrom # cdrecord -v dev=0,0,0 speed=16 -isosize /dev/cdrom
15.5.4
(Altrop) (Mint) (Festival)
Copy Video CD
To copy a Video CD (these use audio CD disks—the common CD-R) the following should do the trick: $ cdrdao read-cd --paranoia-mode 2 --read-raw data.toc
There are other tools including readvcd, vcdimager, and vcdgear.
15.6
CD Mixed Data Audio
With the following disk.toc: CD_ROM TRACK MODE1 DATAFILE "cdimage.raw" TRACK AUDIO FILE "drumnbass.wav" 0
was able to write a CD with 2 tracks, the first being data and the second being audio. The audio can be played on a CD. The CD can be mounted to read data. Swapping order on Mint (Section 5.9.27) did not allow the CD to be mounted? Perhaps need newer kernel? But first audio track could be played okay.
15.7 CD-RW
15.7
203
CD-RW
Rewritable CD’s (identified as CD-RWs) can, obviously, be rewritten. While they remain a little more expensive that CD-Rs (perhaps twice the cost) they can be reused many times. But note that not all home audio CD players can read CD-RWs. One that can is the Marantz CD5000. Burning a CD-RW is essentially no different to burning a CD-R. In fact cdrdao identified the CD-RW correctly and dropped its recoding speed down to 4x to suit the CD-RW, all automatically. To re-record the CD-RW you need to blank it first. With cdrdao this is done with: > cdrdao blank
Although the command returns quite quickly the blanking process continues for quite some time while it performs a long write (you can instead do a minimal blank with the option --blank-mode minimal. After this has completed you can burn to the CD-RW as if it were a new blank CD-R.
15.8
Multi Session CDs
First burn: > mkisofs -r -o cdimage.raw files > cdrecord --scanbus > cdrecord -v -multi speed=4 dev=0,0,0 -data cdimage.raw
You may want to add some other options to mkisofs. Check out: > mkisofs
-pad -l -r -J -v -V "CD Label" -b base/boot.img -c base/boot.cat -hide -rr -moved -o cdimage.raw files
Second burn: $ NEXTTRACK=‘cdrecord -msinfo dev=0,0,0‘ $ mkisofs -r -o cdimage.raw -C $NEXTTRACK -M /dev/cdrom files $ cdrecord -v -multi speed=4 dev=0,0,0 -data cdimage.raw
204
15.9
CD-ROM
CD Labels
The package cdlabelgen provides a useful tool to quickly put together covers for CD: $ cdlabelgen -c "Debian GNU/Linux" -s "Version 2.2r2 (potato) netinst" \ -D -e openlogo-nd.eps -S 0.8 -f contents.list | gv -
The main title is Debian GNU/Linux with subtitle Version 2.2r2 (potato) netinst. No date will be written, but the front cover will include the image from the file openlogo-nd.eps, scaled by 0.8. The back cover will contain the text from contents.list. Once it looks okay in Ghostview (gv) replace the gv - with lpr.
Chapter 16 Chinese Get chinese fonts showing up in Epiphany: install ttf-arphic-bsmi00lp ttfarphic-bkai00mp ttf-arphic-gbsn00lp ttf-arphic-gkai00mp x-ttcidfont-conf Then restart xserver!
205
206
Chinese
Chapter 17 ChRoot: Multiple Distributions The chroot allows multiple installs on the one machine without rebooting! In this way you can then keep an older “stable” release that some applications might require, and run those applications as in: sudo chroot /path/to/chroot /bin/sh Set it up with (from http://www.debian.org/doc/manuals/reference/ ch-tips.en.html#s-chroot): # cd / # mkdir /sid-root # debootstrap sid /sid-root http://ftp.debian.org/debian/ ... watch it download the whole system # echo "proc-sid /sid-root/proc proc none 0 0" >> /etc/fstab # mount proc-sid /sid-root/proc -t proc # cp /etc/hosts /sid-root/etc/hosts # chroot /sid-root /bin/bash # apt-setup # set-up /etc/apt/sources.list # vi /etc/apt/sources.list # point the source to unstable # dselect # you may use aptitude, install mc and vim :-)
I tried with a local mirror but failed: # debootstrap sid /sid-root http://mirror.aarnet.edu.au/debian/ I: Retrieving http://mirror.aarnet.edu.au/debian/pool/main/g/ glibc/libc6_2.3.2-4_i386.deb E: Couldn’t download libc6
207
208
ChRoot: Multiple Distributions
Chapter 18 Clock: An Explanation There are two clocks in your computer: a system clock and a hardware clock. The system clock is maintained by the running operating system (Debian). It is also said to be maintained by the kernel. The date command talks to the system clock. The hardware clock is part of the actual hardware of the computer and is usually battery backed up. The hwclock command talks to the hardware clock.
18.0.1
Timezones
With a dual boot system it is often best to set the clock to local time. If, on the otherhand, GNU/Linux is the only operating system installed then using GMT (Greenwich Mean Time) is recommended as the standard approach for Unix. To change the timezone use the tzconfig command. You also have to change the line in /etc/default/rcS which states the CMOS clock configuration.
18.0.2
System Clock Drift
Some system clocks do not run all that accurately. Some hints on dealing with clock problems can be found in the Clock mini HOWTO at http:// www.tldp.org/HOWTO/Clock.html, but the hwclock and adjtimex manual pages tend to be an easier read! Be warned though, the Debian suggestion is not to fiddle with hwclock. It is 209
210
Clock: An Explanation
highly recommended that you install the ntp-simple package (to run a daemon that checks regularly to keep your clock in sync) and/or ntpdate (to update your clock at each boot or to manually run a command to update your clock) to keep your clock accurate. These are discussed in more detail below. If you install both ntp-simple and ntpdate and you manually set up cron to run ntpdate every hour then you will probably receive email every hour to tell you that ntpdate can’t get the ntp socket (because the ntpd daemon from ntp-simple is probably using it!):
6 Oct 09:08:02 ntpdate[23856]: the NTP socket is in use, exiting
Just install one of them!
Using NTP The Network Time Protocol (NTP) daemon provided by the ntp-simple package is by far the easiest way to manage the accuracy of your clock, particularly if you are connected to the internet (even if only intermittently). The ntp-simple daemon (ntpd) effectively sets the cock by speeding it up or slowing it down depending on its natural drift so that it gets in sync and stays there. This avoids a “sudden shock” to the system with a dramatic change to the time, although mostly the system can handle it. The primary configuration required is to identify an NTP server. Look at the lists at http://www.eecis.udel.edu/~ntp/, for example. After running ntpd for a little while your clock will be set to an accurate time and will maintain an accurate time. However, if the amount of difference is too great then ntpd will not modify the clock. After setting up ntp-simple you can install ntpdate and on install (and reboot) the clock will be updated to the correct time according to the server you have chosen for ntp-simple. With ntp-simple installed on one of your hosts, Velox (Section 5.9.26) for example, on the local network you can now use Velox (Section 5.9.26) as a ntp server simply by installing ntp on each machine and pointing them to Velox (Section 5.9.26) as the server.
211 ntpdate If you only have irregular access to the Internet then ntpdate is useful. The package provides the ntpdate command to query an NTP server and to update your clock. You can do this manually as you see fit with: $ ntpdate ntp.togaware.com
The advantage is that you will not have regular net transmissions as with the NTP server. This could save you up to 4MB per day. This could also be done as a cron job, for example. For irregular access through a modem using PPP though, a good idea is to create a script file in /etc/ppp/ip-up.d called ntpdate containing: #!/bin/sh #invoke ntpdate to set time from system clock if [ -x /usr/sbin/ntpdate ]; then /usr/sbin/ntpdate -s -t 5 ntp.togaware.com /sbin/hwclock --systohc fi
Make sure the script is executable: # chmod a+rx /etc/ppp/ip-up.d/ntpdate
Then each time you connect the local clock will be synchronised with the NTP server.
18.0.3
chrony
For dialup connections the suggestion is to use the chrony package. This does the same thing as ntp but works well with a dialup. The default installation installs the necessary script and the default configuration works out of the box (but you should change the default timeserver to one near you).
212
Clock: An Explanation
Using adjtimex The adjtimex command can be used to counter systematic drift in the system clock. It is tricky to fine tune, and it is recommended that you use ntp instead if you can. To set the system clock do: # date -s "13 Jun 2001 10:10:00"
Then monitor how the system (and hardware) clock varies over 24 hours. The adjtimex command communicates with the kernel to change the number of ticks in a day (default is 10000 which corresponds to about 8.64 seconds per tick) and the frequency (default is 0) of the system clock. In Debian you can use the command adjtimexconfig to automatically tune the tick and frequency to match the accuracy of the hardware clock (assumed to be accurate) and so that the change has effect on each boot. Alternatively, override the automatic settings by editting /etc/adjtimex.conf. INDY The system clock was losing (very) roughly 1 second per hour. (The hardware clock seemed to lose nearly one second each day.) Not too much on the face of it but considering the machine is rarely rebooted this can become a significant drift. For this machine a tick of 10002 and a frequency of 4000000 set the clock accurately: # adjtimex --tick 10002 --freq 4000000
On an old 486/DX66 the system clock was gaining about 22 seconds in 24 hours and the hardware clock gaining about 10 seconds in 24 hours. Removing 3 ticks had the dramatic effect of making the system clock pretty accurate. # adjtimex --tick=9997
Velox (Section 5.9.26) The system clock was losing about 1 second every hour (16 seconds in 24 hours). The hardware clock was very accurate as best I could tell. I Installed adjtimex then: # adjtimexconfig
213 This claims to adjust the ticks for the system clock against the hardware clock which is assumed to be, and generally is, accurate. However, after 24 hours the system clock was still about 5 seconds slow. I noticed the hwclock was also a few seconds out after a weekend (fix that another time). I decided to set the parameters myself by editting /etc/adjtimex.conf. Before I started it contained: TICK=10000 FREQ=1653461
At 1pm, 4 Jun, reset the clocks and reset the adjustment: # adjtimex --tick 10002 --freq 0
See how it goes. If it works then update /Path/etc/adjtimex.conf to match this. At 4pm, 5 Jun, the clock was 10 seconds slow? Reset the clock and try (in the absence of understanding): # adjtimex --tick 10002 --freq 4000000
At 2pm, 6 Jun (22 hours later) the clock was 9 seconds too fast. So let’s half the freq and see where that gets us. Really need to set things back to base (tick 10000 and freq 0) and do the actual calculations for the value. # adjtimex --tick 10002 --freq 2000000
18.0.4
Hardware Clock Drift
The hwclock command provides the interface to the hardware clock. If you are wanting to ensure the correct time then with a default Debian set up it is recommended that you use ntp instead if you can. When you reboot the system will save the current correct time to the hardware clock. Anyhow, the --adjust option of the hwclock command checks information stored in the configuration file /etc/adjtime and makes an actual correction to the time stored in the hardware clock to account for the drift that it (the
214
Clock: An Explanation
hwclock utility) has been monitoring. (Each time you set the hardware clock with the hwclock command the current time is compared to the previous time it was corrected to determine the amount of drift.) Thus, when setting the system clock from the hardware clock it is advisable to do the following: # hwclock --adjust # hwclock --hctosys
When updating the hardware clock from an accurate system clock do: # hwclock --systohc
Chapter 19 Commercial While the focus is on free systems in this book it would be unfair not to include some great commercial software. Free open source software may not always serve your needs. You have two options: implement (or pay someone to implement) what you need yourself on top of the base already provided by the open source software; or buy an off-the-shelf solution. The former will give you plenty of kudos in the GNU/Linux world, but the latter might be more practical. Here we do not delve into the individual products, but rather catalogue what is available.
19.1
Corel WPO Office Alternative
GNU/Linux thrives on the idea of independent, yet collaborative, tools. Micorsoft Office, on the other-hand is an integrated monolithic offering. Such tools are also available for Linux, commercially, and the premier offering is Corel’s WPO.
215
216
Commercial
Figure 19.1: Corel’s Word Perfect Office
Chapter 20 Configuration 20.1
System Configuration in /etc
/etc/debian\_version Contains the debian version. /etc/exports This file contains information to tell NFS (Network File Systems) which partitions are to be shared with other systems. /etc/fstab This file lists filesystems, possibly spread over multiple drives, partitions, and remote hosts, that can be mounted. At boot time, partitions identifed as auto mount will be auto mounted. Other convenient mount rules for CD-ROMS, DVDs, Floppy drives, etc., are usually also included. /etc/hosts.allow This file, and its companion /etc/hosts.deny control access to your computer. The file /etc/hosts.allow lists hosts that are allowed to access the system. If empty then no restrictions apply. Similarly, /etc/hosts.deny is a list of hosts that are not allowed to access the system. /etc/inetd.conf This file is the internet server configuration database and is used to identify services like ftp and ssh which should be started. As a security measure it is 217
218
Configuration
advisable to comment services which you do not use. /etc/inittab This file specifies the processes that are started at bootup and at different runlevels. /etc/motd This file (message of the day) is displayed when a user logs on. /etc/passwd This file contains user information including login name, password, default shell, and home directory. Because this file is readable (and needs to be readable) by everyone on the system, the password field usually contains an x indicating that the encrypted password is actually located in /etc/shadow, which is only readable by the root user. See Section 68.1 for details of sharing this information across multiple hosts. /etc/profile This file contains common user configurations for interactive shells, such as global environment variables. /etc/services This file contains a list of network services and identifies which port a service mentioned in /etc/inetd.conf will use. /etc/securetty This file lists the terminals (ttys) on which root is allowed to login. /etc/shells This file contains the pathnames of all shells installed in the system. A user is allowed to select one of these shells as their default login shell.
Chapter 21 CRON: Regular Tasks All Unix systems have a mechanism for running certain applications regularly. The mechanism is through a daemon called crond. Debian uses cron in a very neat and stylised fashion. Scripts to be run regularly are maintained in one of /etc/cron.daily/, /etc/cron.weekly/, or /etc/cron.monthly/. The entries in /etc/crontab then simply run any scripts in these directories on a regular basis. The daily scripts, by default, are run at 6:25am each day. The weekly scripts are run each Sunday at 6:47am and the monthly scripts are run at 6:52am on the first day of each month. The default /etc/crontab essentially contains just the following lines: 25 6 47 6 52 6
* * * * * 7 1 * *
root root root
test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly
The first line is read as: 25 minutes past 6am on every day of the month and every month of the year and every day of the week as user root run the rest of the line. The “rest of the line” tests to see whether anacron is installed and if not runs the scripts found in /etc/cron.daily/. If anacron is installed then it is used instead to ensure the scripts are run. The anacron package is a replacement for cron that does not assume the local host is always powered on (Unix and GNU/Linux systems rarely require rebooting and are happy to remain powered on indefinitely) and will ensure the regular scripts still get run appropriately when the local host is powered on. If the default times for cron don’t suit (e.g., you like to work early in the 219
220
CRON: Regular Tasks
morning and get annoyed by the sudden disk whirling each morning at 6:25 am) then simply change the times in /etc/crontab. Unlike traditional versions of cron, the newer versions do not require the running of the crontab command to install the new version when you edit /etc/crontab.
Chapter 22 CVS: Concurrent Versioning Debian Pacakges: cvs cvs-doc viewcvs CVS (Concurrent Versioning System) is the standard tool for allowing several developers or authors to work together on a shared set of documents. CVS maintains a central repository of all files associated with a project, including a history of all changes made to each file. Users checkout copies of the central repository (either on to a local machine or else any machine on the network), edit documents locally, then commit changes back to the repository. Multiple users can be working on the same project concurrently. All older versions of the documents can be retrieved, if required.
22.1
Managing a Project
22.1.1
Initialising your own Repository
You can create a CVS repository for yourself . Simply create a directory to hold the repository then initialise it: $ mkdir /home/kayon/cvs $ cvs -d /home/kayon/cvs init
You can then create new projects within this repository with $ cvs -d /home/kayon/cvs import wajig kayon start
221
222
CVS: Concurrent Versioning
You can check out projects from there with either of the following, the first for local hosts (which mount the file system via NFS perhaps) and the second for network hosts:
$ cvs -d /home/kayon/cvs checkout project/debian $ cvs -d :ext:[email protected]:/home/kayon/cvs checkout wajig
22.1.2
Creating a New Project
To create a new project consisting of all files in the current working directory use:
cvs import -m "Initial import" wajig kayon start
No commit is required after an import. Note that the files and subdirectories in the current directory will then be recognised as src/docs/spec. You can now remove the directory and use CVS to create a new one for you, with the new one now under CVS control:
cvs co src/docs/spec
This will create the whole directory hierarchy as well so be sure to be at the root of the hierarchy where you want this new hierarchy to live. To checkout a project from a remote host use:
cvs -d :ext:[email protected]:/var/lib/cvs checkout src/docs
This will use rsh (set CVS RSH to ssh to use ssh instead) to access the CVS server and checkout the src/docs directory. To check out a project and give it a different local name:
cvs checkout -d mydocs src/docs
22.1 Managing a Project
22.1.3
223
Adding Files to a Project
You mark files to be added to the CVS repository with, for example: cvs add .py
The files will be added to the repository when you next commit. If you are adding binary files then you probably don’t want keyword expansion and you’ll want to let the repository know that they are binary files: cvs add -kb .png
22.1.4
Updating Your Project Copy
You can edit the files you have checked out. It is useful to regularly ensure you are working on the latest copies by doing: cvs update
This will update your copy of the files from the archive. Any updates made to the archive by others will appear in your copy. If there are any conflicts you will be warned about them and will need to find and resolve them in the files updated. CVS will tell you of conflicts: Merging differences between 1.42 and 1.43 into main.py rcsmerge: warning: conflicts during merge cvs update: conflicts found in main.py
CVS will actually modify your file which ends up with both versions of the conflict: <<<<<<< main.py def detect_outlier(limit, score) ======= def detect_outlier(maximum, score) >>>>>>> 1.43
224
CVS: Concurrent Versioning
Here I added a limit variable to the method whereas someone else added maximum. I need to choose one or the other. To add any new directories that have been added to the repository to your local checked out copy, and to prune any directories that are empty from the local checked out copy, use: cvs update -dP
22.1.5
Identifying Changes
To see the differences between a file you are working on and the current version in the archive use: cvs diff -c0 main.py
You can also view changes between particular versions: cvs diff -c0 -r 1.24 -r 1.32 main.py
22.1.6
Removing Files from a Project
To remove a file from the repository first remove it from your directory then use: cvs remove stubs.py
The file is removed when you next commit. If you’ve removed and committed the remove but want to restore the file, then find the version of the removed file: $ cvs status stubs.py =================================================================== File: no file stubs.py Status: Up-to-date Working revision: No entry for stubs.py Repository revision: 1.3 /var/cvs/projects/kton/Attic/stubs.py,v
22.2 Tuning
225
So this is version 1.3. We restore it using: $ cvs update -j1.3 -j1.2 stubs.py U stubs.py
22.1.7
Committing Changes
Once you are happy with your changes (and you’ve made sure the program still works or the document is still printable) then it is time to update the repository with all changes you have made. You need to give a short message to describe briefly what has changed: cvs commit -m "Describe the changes you made"
22.1.8
Tagging a Release
You can tag a collection of files in a repository so that you can later restore all of the current versions of the files together. This is useful when you have a stable release of your software. Tag all the files and then start breaking the code again! To tag all files in the current directory and below simply: $ cvs tag release-0-2
22.2
Tuning
22.2.1
Location of Repository
Debian GNU/Linux uses /var/lib/cvs/ as the default system wide CVS repository. You only need to know the location of the repository the first time you checkout a project from it. You can set your environment variable CVSROOT to point to this when you check out new projects. Alternatively use the -d option to the cvs command. Once a CVS project has been checked out there will be a subdirectory called CVS in each newly created directory that contains the relevant information
226
CVS: Concurrent Versioning
about the repository (so you won’t need the CVSROOT environment variable or the -d option for any other cvs commands within this project). It may be convenient (but not necessary) to have a default CVSROOT defined in your /home/kayon/.bashrc: export CVSROOT=/var/lib/cvs
22.2.2
Using ssh Rather Than rsh
Set the environment variable CVS RSH to ssh to use ssh instead: $ setenv CVS_RSH ssh $ export CVS_RSH=ssh
22.2.3
if using csh if using sh or bash
Notify Users of Changes
Add to the file \$CVSROOT/CVSROOT/loginfo a line like: ^debbook mail -s "CVS update of
22.2.4
Debian book" [email protected]
Ignoring Files
The file /var/lib/cvs/CVSROOT/cvsignore can be created to list patterns of filenames to ignore for all users. Individual users can place their additions in /home/kayon/.cvsignore. The environment variable CVSIGNORE can also be used. An example to ignore many of the temporary files created by LATEX is: *.glo *.idx *.toc *.ilg *.ind *.pyc *.log *.aux
22.3 CVS for NT
227
*.out *.pdf *.cut .thumbnails tmp_*.png
22.3
CVS for NT
A packaged version of CVS for NT is available from http://www.cvsnt. org/.
228
CVS: Concurrent Versioning
Chapter 23 Desktop gnome (http://www.gnome.org/) is a Desktop and Session Manager. sawfish (http://sawmill.sourceforge.org/) is a Window Manager. kde (http: //www.kde.org/) is a gnome alternative and windowmaker and enlightenment are alternatives to sawfish. Both gnome and kde provide a desktop environment and an application development framework. A desktop environment usually consists of a window manager, task bar, and perhaps a file manager and documentation browser. A development framework provides libraries and a GUI toolkit for application development. Applications like windowmaker, and enlightenment are desktop environments which tend not to provide development frameworks. They do, however, tend to provide session management. While you can use these with desktop environments like gnome and kde their functionality sometimes overlap, and may even conflict. XFCE provides a simple and very small desktop requiring minimal resources but providing a sufficient feature set for the genral user. XFCE is actually based on the GTK+ toolkit as is the Gnome desktop.
229
230
Desktop
Chapter 24 DIA: Charts and Diagrams Dia is a vector-based drawing tool similar to Win32 OS Visio. It is suitable for graphical languages such as dataflow diagrams, entity-relationship diagrams, organisation flow charts, universal modelling language (UML) diagrams, electronic circuit diagrams and much more. It is ideal when the diagram has shapes that recur and are connected by lines. Dia is extensible through the use of sheets which contain collections of shapes for use in diagrams. The ER sheet, for example, has shapes for different types of entities, attributes and relationships as required when drawing entityrelationship diagrams for database design. Dia also runs under Win32 OS (see http://hans.breuer.org/dia) providing a free cross platform tool. Storing it’s diagrams natively as XML documents means that they are accessible on multiple platforms and from other applications. You could even edit the dia XML diagrams by hand. Some applications also generate dia diagrams. In this chapter we begin with some basics and then a walkthrough that should get you started with dia. We then review the functionality of dia. And we end with a walkthrough creating your own shape library.
231
232
24.1
DIA: Charts and Diagrams
Basic Operation
The main dia tools window allows you to create new canvases, select the tools you wish to use, and set your preferences. The application preferences are accessed through File→Preferences. Options include compression of saved files, the default size of new canvases, and characteristics of the grid displayed on the canvas (including its visibility and whether objects snap to the grid). These choices take effect from the next canvas that is opened (but not for currently opened canvases) and are saved in ~/.dia/diarc. The first step in drawing is to start a new canvas with File→New Diagram. You then select objects, lay them out on the canvas, add the lines to connect the objects, and add relevant text. The tools available on the main dia window fall into four distinct areas. The Pointer and Standard Shapes generally occupy the top half of the window. The Sheets area is next with an option menu that may be showing UML as the currently selected sheet. Below this (in a scrollable window if required) are the actual shapes provided by this sheet. The next area selects the pen colour and type. Finally, line types are selected with the final row of buttons. If you are unsure of the purpose or intent of a shape or button simply move the mouse pointer to hover over the corresponding button and a tooltip will remind you. Click the left mouse button on the tool button to activate the tool.
24.2
Walkthrough: Creating Simple Diagrams
A new diagram is initiated through File→New Diagram. This will pop up a window containing an empty canvas ready for drawing, similar to that in Figure 24.1. The canvas is decorated with a grid to guide the drawing. The default grid is drawn every centimetre in both directions. Page borders are also shown as blue grids (the darker lines in Figure 24.1). Change the page margins for new diagrams with File→Page Setup.... Information on the current zoom level is displayed in the lower left. We are ready to create our diagram. A simple entity relationship (or ER) diagram will serve to illustrate the process. An ER diagram illustrates the
24.2 Walkthrough: Creating Simple Diagrams
233
Figure 24.1: The default new canvas ready for a new diagram. The right mouse button clicked over the canvas contains a menu of all the operations.
structure of a database and is an important tool in database design. The basic diagraming elements of an ER diagram are the entity (a rectangle), the relationship (a diamond) and the attribute (an oval). There are variations to each of these that identify different interpretations. These elements are connected with either single or double lines. All these diagramming elements are supplied by the ER sheet. Let’s put together a design for a Movies database that will store information about movies and their stars. We have two entities in our database: Movies and Stars. Entities are represented pictorially as rectangles containing text that names the entity. To create the entity Movie click on the Entity button of the ER sheet. Then move the mouse pointer to the canvas and click again (with the left mouse button) to place a rectangle containing a default label (Entity). You will now want to change the name of the entity to Movie. To do this double click this entity with the left mouse button to bring up the Object properties window. Now double click the word Entity that appears in the Name: text field and type Movie. Click the Apply button and you will see the entity name change on the canvas. You can click on OK or Close to close the Object properties window if you wish. Next we will create the attributes of this entity: a Movie has a Title, the Year in which the movie was made, and the Length of the movie. The procedure for creating attributes is the same as for all shapes. Select the Attribute tool (the oval) from the ER sheet and click on the canvas where you would like to
234
DIA: Charts and Diagrams
place the Attribute. Double click this to edit the Object properties to change the Name of the attribute to Title. This attribute is also going to be the attribute by which we uniquely identify every movie in the database. This is called Key, so select the Key checkbox. Click on the OK or Apply button for this change to take effect.
Figure 24.2: Sample entity-relationship diagram.
Another diagram (Figure 24.3) uses UML shapes although it is not itself a formal UML diagram.
Figure 24.3: Sample diagram.
24.3
Reference: Command Line Options
Before we get into the details it is useful to review the dia command line options. Dia supports all of the usual Gnome, GTK+ and Session Management options which are listed with the --help option. In addition dia has just a single option, --export, abbreviated as -e. This will generate an exported
24.4 Reference: The Tools Windows
235
Figure 24.4: Sample diagram saved as a graphic and imported into this book.
graphic of the supplied dia diagram in one of the supported export formats. The particular export format is determined from the supplied filename extension. Thus, dia --export survey-chart.eps survey-chart.dia
generates an Encapsulated PostScript image while dia --export survey-chart.png survey-chart.dia
generates a Portable Network Graphics image.
24.4
Reference: The Tools Windows
24.4.1
Pointer, View, and Text Objects
The top section of the main dia window contains the pointer and a collection of standard shapes. The pointer (the top left icon with the arrow) allows you to select objects on the dia canvas. Next to the pointer are the zoom and scroll buttons. The zoom tool will enlarge (zoom in on) the diagram each time you click the left mouse button somewhere within the diagram. By holding down the Shift key when using the zoom tool the diagram will be zoomed out. The scroll tool will scroll the diagram when you hold the left mouse button down within the diagram. This mimics moving the scroll bars. By holding down the Shift key when
236
DIA: Charts and Diagrams
using the scroll tool you can grab (as with a hand) the diagram and scroll the diagram around in this way. The fourth button selects the Create Text tool allowing text to be added to your diagram.
24.4.2
Standard Shapes
The second collection of four buttons on the main window consist of the standard shapes of a Box, Ellipse, Polygon, and a Beziergon. The next group of five buttons are line drawing tools consisting of a Line, Arc, Zigzagline, Polyline and Bezierline. The final button allows you to import graphics from other applications. Double click the left mouse button on the tool button to set the object defaults for that object (not all objects have defaults). For example, double clicking the Create Text tool button will bring up a window to set defaults for the alignment of the text, the font, and the font size. The Box object defaults include whether the background is drawn and how the corners are rounded. The Ellipse, Polygon, and Beziergon object defaults allow for turning off of the drawing of the background. The only other standard shape with object defaults is the Image tool which can identify a default image file, whether a resize of the image should keep the aspect ratio, and whether to show a border around the image. Objects from the various sheets may also offer object defaults.
24.4.3
Handles and Connection Points
All objects have handles that generally allow the object to be resized. The usual handles are small boxes with a green fill. You can move these handles by dragging them with the mouse. This will resize the object. If the handles have a dark blue fill instead then the object can not be resized. This is typical of boxes that resize automatically as you enter text into the box. Lines have handles at each end that are also green (but also have a small internal cross identifying it as a connection point—see below). Once again you can resize the line simply by grabbing these handles with the left mouse button and moving the handle around.
24.4 Reference: The Tools Windows
237
Some lines (e.g., a polyline) have internal handles that are coloured orange. These handles have restricted movement and may also move as you move the line end-points. Most objects also have connection points that identify locations on the shape to which lines can be snapped. (An Arc, for example, does not have any connection points.) They are identified as the small blue crosses on the edges of the objects. The handles on the end of lines also have crosses identifying connection points. A line’s connection point becomes attached to the connection point of an object, as indicated by the line’s green handle becoming red. Moving the object will also move all of the attached lines. The Line shape can have extra connection points added to it through the middle mouse button menu. Each new connection point is added to evenly space all of the connection points along the line.
24.4.4
Sheets
The next section of the main dia window begins with a choice of sheets (i.e., shape libraries). Many are included by default and new ones can be added (see Section 24.7). Selecting one of the available sheets (by choosing from the pull-down menu that is labelled UML for the Universal Modelling Language in the above sample window) will display a collection of shapes associated with the particular sheet. (The sample window includes the shapes useful for drawing UML diagrams.) Some shapes, when selected and placed onto the canvas, have text associated with them and will grow in size depending on the text you type. An example is the Text box button. Increasing the height of the main dia window will often allow you to see all of the available shapes of any of the sheets at one time.
24.4.5
Pen
The lower section of the window contains the pen colour chooser.
24.4.6
Lines
The line thickness and line types. These affect the standard shapes rather than shapes from the sheets. The smallest line width is 0pt (hairline).
238
DIA: Charts and Diagrams
A variety of lines are supported. You can add arrows to the lines by clicking on the button at the bottom right (or bottom left for backwards pointing arrows) of the Dia control window. Figure 24.5 shows the button before and after selecting an arrow.
Figure 24.5: Selecting the arrow and line type for the various line drawing tools. The first shows the default Dia window with undecorated lines (as indicated by the bottom three buttons being straight lines). We have chosen the straight line tool in the top half of the window. An arrow is added in the second, a backward arrow with a hollow head in the third, and the line is changed to a dotted line in the fourth.
24.5
Reference: The Right Mouse Button Menu
The right mouse button anywhere on a canvas will bring up a diagram specific menu. From here all of the operations are available, including those to save, print and export the file, to cut and paste, to select various objects or regions, to group objects and to layer objects, to operate on objects with various tools, and to edit the object properties and layout. The middle mouse button will bring up an object-specific menu. Double clicking an object will bring up the properties editor for that object.
24.5.1
The File Menu
The File menu provides the usual New diagram, Open..., Save, and Save As operations. Once again F3 (open) is the keyboard shortcut to open a dia-
24.5 Reference: The Right Mouse Button Menu
239
gram from a file and Ctl+S (save) is the shortcut to save a diagram to a file.
Preferences With the Preferences... menu item you set the various options allowed by dia (this is the same as selecting File→Preferences from the main dia window. These options affect new diagrams only, not currently open diagrams. To change options like Snap To Grid for a currently open diagram, use the right mouse button View menu. The three categories of preferences for new dia diagrams are shown in Figure 24.6.
Figure 24.6: Setting preferences.
Under the User Interface the first option indicates whether the tools in the main window are reset to their defaults after creating a new canvas. The native dia save format uses XML which can be quite verbose. As with many Gnome applications it is common to compress the saved document (using the gzip format) and you can control this behaviour here. dia supports only a limited number of undo levels which can also be set here. Finally, reverse dragging, when enabled here, allows you to drag-select from the right to the left (unlike normal dragging which usually goes left to right) to have a different effect. It selects all objects that intersects the dragged rectangle rather than just those that are fully contained in the dragged rectangle. View Defaults controls the size and initial magnification of the new window when you create a new canvas. You can also control whether the connection points (the blue crosses) are visible.
240
DIA: Charts and Diagrams
Grid Lines can be turned on and off. Objects can be made to snap to the grid (i.e., when you place or move objects they will move automatically to the nearest grid when placed). The size of the grid (both along the x and y axes) can be changed as can the colour and style of the grid lines. Page borders can be displayed on the grid using different colours and line styles.
Export Export... is used to generate output suitable for other applications with a variety of formats supported. The format is either specified using the option menu or else determined by the filename extension: Computer Graphics Metafile Native Dia Diagram Drawing Interchange File: This format is used by other vector graphics applications such as the computer aided design packages like AutoCAD and QCad. eps Encapsulated PostScript hpgl Hewlett-Packard Graphics Language png Portable Network Graphics: This is the standard free graphic format for the Internet. svg Scalable Vector Graphics tex TeX PSTricks macros: Diagrams in this format can be used directly in TEX and LATEX documents. wpg WordPerfect Graphics cgm dia dxf
Export to the common gif format is not supported because of licensing restrictions placed on users of applications that produce gif images. The use of gif images is not encouraged in the free software community because of this restriction. The png format is a superior replacement.
Export to TeX PStricks TeX is a sophisticated document typesetting system. The PSTricks TeX packages provides considerable support for PostScript within TeX. This export filter generates a tex file for processing by TeX (although usually LATEX, an easier to use macro package written in TEX, is used). To include the diagram in your LATEX document you will need to import the pstricks package for LATEX and input the actual diagram (as saved in diagram.tex for example: \documentclass[12pt,a4]{article}
24.5 Reference: The Right Mouse Button Menu
241
\usepackage{pstricks} \begin{document} \include{diagram} \end{document}
Depending on the version of LATEX and PStricks you are using, you may need to uncomment some macro definitions in the diagram file. If LATEX gives you the error something like: ! Undefined control sequence. \setfont
You will need to remove the initial percent sign (LATEX’s comment command) from the definitions in diagram.tex and it is best to rename the newcommand to providecommand in all three cases (to avoid problems when including more than a single diagram in the one LATEX document: \newcommand{\setlinejoinmode}[1]{} \newcommand{\setlinecaps}[1]{} \newcommand{\setfont}[2]{}
All should then work.
Printing When dia is compiled it will be compiled with either internal print support or support through the Gnome printing library. An alternative to printing is to export the diagram as PostScript which can then be printed. You can scale the diagram to fit the page when printing through the use of the File→Page Setup... menu. Here you can also set up the size of the page, orientation, and the page margins.
Quitting The usual Close and Exit items are part of the File menu with their common keyboard shortcuts of Ctl+W (close) and Ctl+Q (quit) respectively. Close will close the current document while Exit will exit from dia completely.
242
24.5.2
DIA: Charts and Diagrams
The Edit Menu
The Edit menu allows you to Copy, Cut, Paste and Delete objects with the common keyboard shortcuts of Ctl+C (copy), Ctl+X (cut), Ctl+V (paste), and Ctl+D (delete), respectively. Edit operations can be undone and redone. The number of undo levels is controlled by an option in File→Preferences as we saw in Section 24.5.1. The default is 15. That is, you can recover from the last 15 actions!
24.5.3
The View Menu
The View menu affects how you view the diagram. Zoom In enlarges the viewed diagram and Zoom Out contracts the viewed diagram. Particular scales can be chosen with the Zoom submenu. The Diagram Properties. . . menu allows the background colour to be changed and the grid characteristics (spacing and visibility) to be modified. These changes affect the current diagram only and are saved with the diagram. Various features can be turned on or off with the following option items. New View pops up a new canvas showing the same objects. Editing any object in any of the views will affect that object in all of the views. Show All zooms the diagram to fill the viewable area of the canvas.
24.5.4
The Select Menu
The Select menu provides shortcuts for selecting objects. All objects can be selected or None. Those currently not selected can be selected in place of those that are selected (Invert). For any selected objects you can cause those objects directly connected to them to also be selected (Connected). Doing this repetitively results in all connected objects being selected, which is the same as selecting Transitive. Finally, you can select all objects that are of the same type as the currently selected object. Selecting same type actually works even if objects of different types are selected. The following five check buttons modify how new objects are selected. Usually a new selection replaces the old selection as the final set of selected ob-
24.5 Reference: The Right Mouse Button Menu
243
jects. With Union the final set of selected objects consists of the previously selected object plus the newly selected objects. Intersection results in those object that were previously selected and now selected again to be in the final selection, but no others. Remove removes from the old set of selected objects those that are newly selected. And Invert causes those objects newly selected to have their state of selection inverted—that is, those previously selected and now newly selected be no longer be selected, and those not previously selected but included in the new selection will become selected.
24.5.5
The Objects Menu
The Objects menu allows you to layer objects and to group and align objects. Objects can be selected individually with the left mouse button by clicking on the object. This allows a single object to be selected at a time. To select multiple objects you can hold down the Shift key while you click the left mouse button. Selecting with the left mouse button actually toggles the selected state of the object. You can also select a group of objects simply by dragging the left mouse button (hold the left mouse button down and move the mouse around) on the canvas to define a rectangular area. When you release the left mouse button all objects in the rectangular region will be selected. Of course, you can also use the Select menu described above to select objects. Once you have objects selected the menu items in the Objects menu become available. Send to Back and Bring to Front have the obvious meaning. Figure 24.7 shows the effect of selecting a Text object which is on top of a Box object and sending it to the back. The Box object ends up occluding the Text object.
24.5.6
The Tools Menu
The Tools menu simply provides menu access to all of the tools located on the upper area of the main window. You will find the pointer (Modify), Magnify, and Scroll tools. Remember, Shift with Magnify or Scroll changes their behaviour. See Section 24.4.1 for details. Next comes the four standard shapes (Box, Ellipse, Polygon, and Beziergon) followed by the five lines (Line, Arc, Zigzagline, Polyline, and Bezierline). Finally Image objects can be selected. There is a significant reason for repeating the Tools here: keyboard shortcuts
244
DIA: Charts and Diagrams
Figure 24.7: Demonstration of Send to Back: The Text object is selected and then sent to the back, being occluded by the Box object.
can be easily assigned to each of the tools through this menu. Simply move the mouse to highlight one of the menu items and type the keystrokes you which to associate with that tool (e.g., Ctl+Alt+E for the Ellipse). The shortcut should appear on the menu.
24.5.7
The Dialogs Menu
The Dialogs menu allows the Properties of the selected object to be modified (if it has modifiable properties). For shape objects you can, for example, select line width, colour, and style and a fill colour. The fill can be made transparent (by specifying that the background should not be drawn). You can also edit the Layers.
24.6
Reference: Sample Sheets
We describe some of the sheets that are supplied with dia. For each we list the collection of shapes (objects) provided and give an example diagram made from the shapes. The specification of each sheet is an XML document usually located in /usr/share/dia/sheets/.
24.6.1
Chronogram
The Chronogram sheet contains just two shapes, but with functionality that allows a considerable variety. XXXX Check samples/chronograms.dia for a
24.6 Reference: Sample Sheets
245
trailer and require a lot of explanations to be usable.
24.6.2
Circuit
The Circuit sheet contains shapes useful for drawing electrical and electronic circuit diagrams. The sheet includes, in order, a Vertical Resistor, Horizontal Inductor, Vertical Inductor, and a Horizontal Resistor as the first row with their European counterparts as the second row. Then Horizontal and Vertical Capacitors, npn and pnp Bipolar Transistors, Horizontal and Vertical Diodes and Zener Diodes, Ground Point, Operational Amplifier, Horizontal and Vertical Fuses and Power Sources, Lamp, Speaker, Horizontal and Vertical LEDs, NMOS and PMOS Transistors, and a Horizontal Jumper. All objects have object defaults accessible by double clicking the left mouse button on the corresponding object within the sheet. In general you can set the default text padding, alignment, font, and font size for each object.
24.6.3
ER
Entity-relationship diagrams are commonly used to design relational databases. The basic elements of an ER diagram are provided, including an Entity, Weak Entity, Relationship, Attribute, and Participation.
24.6.4
Flowchart
The Flowchart sheet provides the diagram elements usually associated with drawing flowcharts of all types. All elements allow text to be included and the object properties can be used to set the fonts and for boxes to set the corner rounding. The elements supplied are a Box, Parallelogram, Diamond, Ellipse, Display, Transaction File, Off Page Connector, Document, Manual Operation, Preparation, Manual Input, Predefined Process, Terminal, Magnetic Disk, Magnetic Drum, Magnetic Tape, Internal Storage, Merge, Extract, Delay, Summing Junction, Collate, Sort, Or, Punched Card, Punched Tape, Transmittal Tape, and Offline Storage.
246
24.6.5
DIA: Charts and Diagrams
FS
The FS sheet provides support for Function Structure Diagrams. There are three shapes: A Flow, an Orthogonal Polyline Flow, and a Function. The Flows have object defaults where default labels (text) and flow types can be identified. These can also be changed by double clicking a Flow or Orthogonal Polyline Flow object on your canvas. The different flow types (Energy, Material, and Signal) change the properties (colour and type) of the line. The text label can be grabbed by the mouse and moved around. The Function object is a box with a text label. It has object properties with which the Function can be identified as a Wish Function and/or a User Function. A Wish Function has a dotted box and a User Function has a double box.
Figure 24.8: A sample of the Function Structure (FS) Diagram sheet objects. This is not a true function structure diagram, but does illustrate the variety of shapes.
24.6.6
GRAFCET
GRAFCET charts have been standardised outside of France as Sequential Function Charts (IEC848). THey are often used to describe the mandated behaviour of sequential automates. They are in fact an offspring of Petri nets but oriented towards specification of actions and mandated evolutions rather than simple descriptions of state and possible evolutions. XXXX Grab sample chart from dia’s samples directory. The supplied shapes of the GRAFCET sheet include a Regular Step, Initial Step, Macro Entry Step, Macro Exit Step, Macro Call Step, Macro SubProgram Call Step. These are essentially variations of the same shape and
24.6 Reference: Sample Sheets
247
one can be changed to another by editing the object properties. Next are an Action, Condition, Transition, OR Vergent, AND Vergent, and an Arc. The first nine shapes have object defaults for setting the font, font size and pen colour. The Arc can have arrow heads.
24.6.7
Ladder
Ladders are used as a pseudo-electric representation of boolean expressions. They are used by some vendors of industrial automats (including Schneider/T´el´em´ecanique and Siemens).
24.6.8
Networks
Network diagrams include local area networks (LANs) and wide area networks (WANs). The Network sheet provides a collection of shapes often used in network diagrams. The sheet includes, in order, a Computer, Monitor, Storage, Ethernet Bus, Printer, WAN Connection, Hub, Modular Switch, RJ45 Wall-Plug, scEAD Wall-Plug, Modem, Antenna (for wireless transmission), Network Cloud, Router Symbol, Switch Symbol, and an ATM Switch Symbol.
24.6.9
Pneumatic/Hydraulic
The Pneumatic/Hydraulic sheet provides tools to draw pneumatic and hydraulic schematics. It’s a very incomplete sheet, and there are some tricks to using distributors properly.
24.6.10
SADT
SADT stands for Structured Analysis and Design Technique which is a trademarked and copyrighted by Softech Inc. A SADT model is a collection of diagrams organised in a tree structure. Each SADT diagram is composed of Boxes (representing activities) connected by Flows (arrows) representing flows of materials, data or information. The SADT sheet provides the three basic components required for drawing SADT diagrams: Activity/Data Flow, Activity/Data box, and Flow Anno-
248
DIA: Charts and Diagrams
tation. The activity/data flow can be one of several styles, including Normal, Import Resource, Imply Resource, Dotted Arrow, or with Disabled Arrows. The default is Normal but can be changed in the Object Defaults window (double click the Activity/Data Flow button).
Figure 24.9: A sample of the SADT digram objects.
Flows have different roles in relation to the activities. The middle mouse button (or control right click on Windows) is used to add or remove segments. The default flow is Vertical-Horizontal-Vertical. It is sometimes useful to do a bit of middle mouse button clicking to build a Horizontal-VerticalHorizontal variant which can then serve for copy-and-paste in your diagram. A non Vertical-Horizontal-Vertical flow will be shown in black instead of the default grey. While this is not in the original SADT specification it is often handy to untangle a heavily loaded sheet (with more than 4 or 5 functions— though these sheets should be avoided). Connections points can be added to or removed from the sides of an SADT box by clicking the middle mouse button. Function identifier (A0, A1, etc.) can be changed by opening the box properties. The associated function (the contents of the box) is changed by simply selecting the box and typing any text.
24.6.11
Sybase
The Sybase sheet provides various objects for the design of Sybase replication domain diagrams. The sheet includes a Dataserver, Replication Server, Log Transfer Manager or Rep Agent, Stable Storage Device, Client Application, and a Replication Server Manager.
24.7 Walkthrough: Creating Your Own Shapes
24.6.12
249
UML
Support for the Universal Modelling Language (UML) includes all of the static structure diagram elements specified in the UML specifications. The sheet includes, in order, a Class, Template Class, Note, Dependency, Realization (implements a specific interface), Generalisation (class inheritance), Association, Aggregation (one class is part of another), Implements (class implements a specific interface), Constraint, Small Package, Large Package, Actor, Usecase, Lifeline, Object, Message, Component, Node, Class Stereotype Icon, State Machine, and a Branch.
24.7
Walkthrough: Creating Your Own Shapes
You can create your own shapes and include them in your own sheet simply be defining the shapes in XML (using a subset of SVG, the scalable vector graphics format based on XML). Installing a new shape is simply a matter of installing it into ~/.dia/shapes.
24.7.1
Simple Example
A shape consists of at least a name and a SVG element. That is, every shape, at a minimum, has a name and a description: Sample - Minimal Shape
You can place this in a subdirectory of your own dia shapes directory, perhaps called Sample as in ~/.dia/shapes/Sample/minimal.shape. The actual filename in which the shape is stored (minimal.shape) is not so important— dia will find the file.
250
DIA: Charts and Diagrams
Now you need to create a sheet into which this shape is placed. Again, a sheet is specified using XML. This example is placed in the file ~/.dia/ sheets/Sample.sheet: SampleA collection of sample shapes.
Now start up dia and you should see this new sheet, called Sample, containing a single button with a default icon. You can now create a new canvas and add this shape to your canvas. Note that dia takes care of the resizing of the shape and the other characteristics. The XML describing the shape begins with the usual xml meta element followed the actual shape element, identifying the appropriate XML namespaces (xmlns). The shape has a unique name used to identify the shape by dia. Next we have the actual SVG description of the shape which is 10 by 10 in size (actually these are ignored by dia but are required by the SVG format), and consisting of a single polygon. The shape is a simple triangle (a polygon with three points) pointing downwards. The polygon is drawn from the top left corner (0,0) to the top right (10,0) then to the bottom middle (5,10) and then back to the top left to finish off the polygon. The XML for the sheet then identifies this shape as belonging to the Sample sheet, which contains just one object, the Sample - Minimal Shape shape. The description for the object is used as the tooltip for the resulting button.
24.7.2
Shape Elements
An icon can be associated with the shape through the icon element. An example is:
24.7 Walkthrough: Creating Your Own Shapes
251
minimal.xpm
which comes after the name element. The specified X pixmap file is used as the icon in the dia toolbox. The filename can be relative to the shape file (e.g., icons/minimal.xpm or ../icons/minimal.xpm). When no icon is specified a default icon is used. Connection points can be added to the shape with the connections element which allows any number of point elements. For example you can add two connection points to the above Minimal Shape by inserting the following after the icon element (or after the name element if there is no icon element):
This adds a connection point to the top and another to the bottom of the triangle. The coordinate system used for connection points is the same as for the shape itself. Next an aspectratio element can be specified to indicate how the shape is to be distorted. The default is as if the following was specified:
This indicates that there is no restriction on the aspect ratio (i.e., you can stretch the shape arbitrarily in the X and Y directions independently). A fixed aspect ratio requires Y to change in the same proportion as X, and vice versa. A range can be specified, with two attributes, min and max, identifying a range of allowable amounts of distortion. For example,
A textbox element can appear next. This is used to provide a box that automatically adjusts the size of the shape to fit the supplied text. The location of the text box is specified using the same coordinate system:
252
24.7.3
DIA: Charts and Diagrams
SVG Support
From SVG the supported elements are: line, polyline, polygon, rect, circle, ellipse, path and g. For the path element only the M, m, L, l, H, h, V, v, C, c, S, s, Z, and z commands are supported. User units are supported but not CSS units (only a limited set of the CSS attributes are supported). Transformations are not supported.
24.7.4
Sheet Elements
24.7.5
Installing New Sheets
Sheets are often distributed as compressed tar files (having the filename extension of .tar.gz). To install the sheet (assuming the tar file has been created properly) open the tar file in the Gnome archive tool (guitar). Select all files in the archive (Ctl+A or Archive→Select all) then click the Extract button. You will be asked where to extract the files to—choose the .dia folder in your home directory. Next time you start up dia the new sheet will be available.
24.8
Reference: The dia Save Format
24.9
Acknowledgements
dia was written by Alexander Larsson. It is being actively developed by further by James Henstridge and Lars R. Clausen with significant contributions from Fredrik Hallenberg, Emmanuel Briot, Francis J. Lacoste, Alejandro Aguilar Sierra, Jerome Abela, Cyrille Chepelov, Henk Jan Priester, Jacek Pliszka, Steffen Macke, and Hans Breuer. Cyrille Chepelov implemented the Ladder, Pneumatic/Hydraulic, Chronograms, and Grafcet sheets and provided the descriptions included in this chapter. The dia home page (http://www.lysator.liu.se/~alla/dia/) provides background information, a features list, and a pointer to Harry George’s on-line tutorial introduction.
24.9 Acknowledgements Lars R. Clausen has provided valuable commentary on this document.
253
254
DIA: Charts and Diagrams
Chapter 25 Directories: Linux Folders A basic user operation expected from a computer is to be able to manage documents, to place them into folders, open them to view, edit, or print them, and to share the documents with others. While the Apple Macintosh had Finder Unix has had a variety of File Managers. MS-Windows of course has the MS-Windows Explorer. Linux shares the Unix file managers and more. But the crowning glory of GNU/Linux is Nautilus, a file manager that builds on many of the great ideas that have been demonstrated in previous file browsers. Before introducing Nautilus we begin with a review of the standard GNU/Linux directory structure. Having a basic understanding of how GNU/Linux organises directories (also commonly known as folders) will uncover some of the basic concepts of Unix and GNU/Linux.
25.1
The Standard Linux Directory Structure
Debian can install files almost anywhere within the filesystem, except for /usr/local. The Debian Policy Manual and the FSB (Filesystem Base) definition provide guidelines on what goes where. • /usr/local contains programs and data files that have been added locally to the system, independently of the particular GNU/Linux distribution. These are intended to be kept separate from the main system directories that are managed by the distribution. 255
256
Directories: Linux Folders
• /var contains administrative files (such as system logs) and data that changes frequently (such as spool directories and caches like incoming mail and news). Other file managers for GNU/Linux are also available, including the KDE offering, Konqueror, and the Midnight Commander which has a long history and provides both a Gnome interface and a terminal interface (for those not into GUIs).
Chapter 26 Disks 26.1
New Disk Setup
Use cfdisk to partition. Use mkfs.ext2 /dev/sdb1 to format.
26.2
Ext2 to Ext3
Converting from a standard ext2 disk format to a journalled ext3 format is easy, since it simply involves adding a journal file. It can be done while the system is running with: # tune2fs -j /dev/hda1
Then change ext2 to ext3 in /etc/fstab and unmount/mount for it to take effect. If /dev/hda is your root partition, then you’ll need to reboot for it to take effect.
26.3
Disk Parameters
After installing Debian on Bach (Section 5.9.15) a serious performance hit was noticed every time the disks were busy. With the use of hdparm the 257
258
Disks
hard disk parameters could be set and with hwtools we could ensure the parameters were set on each reboot. See Section 5.9.15 for an example. To test your current performance (this one shows results after tuning): # hdparm -Tt /dev/hda /dev/hda: Timing buffer-cache reads: Timing buffered disk reads:
128 MB in 0.56 seconds =228.57 MB/sec 64 MB in 1.60 seconds = 40.00 MB/sec
Here’s one before tuning: # hdparm -Tt /dev/hdg /dev/hdg: Timing buffer-cache reads: Timing buffered disk reads:
128 MB in 0.55 seconds =232.73 MB/sec 64 MB in 49.39 seconds = 1.30 MB/sec
To determine the current settings for a disk drive use: # hdparm /dev/hda /dev/hda: multcount = 0 (off) I/O support = 0 (default 16-bit) unmaskirq = 0 (off) using_dma = 0 (off) keepsettings = 0 (off) nowerr = 0 (off) readonly = 0 (off) readahead = 8 (on) geometry = 116301/16/63, sectors = 117231408, start = 0 busstate = 1 (on)
Then to get information about a disk drive use: # hdparm -i /dev/hda /dev/hda: Model=ST360021A, FwRev=3.19, SerialNo=3HR0VNYY
26.3 Disk Parameters
259
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4 BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117231408 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 AdvancedPM=no WriteCache=enabled Drive Supports : Reserved : ATA-1 ATA-2 ATA-3 ATA-4 ATA-5
Various parameters can be set, such as turning on direct memory access (-d1), 16 multiple sectors (-m16), and 32 bit I/O support (-c1): # hdparm -d1 -m16 -c1 /dev/hda
Be careful though as some settings may cause the disk to stop responding! This may require a hard reboot after which the default settings are returned. For example, on Bach an additional IDE controller (a CMD680 from Silicon Image) with 2 ST360021A disks, identical to the disk on the PIIX4 IDE controller, but setting the parameter -d1 hangs the shell on a test with -Tt. Also see http://linux.oreillynet.com/pub/a/linux/2000/06/29/hdparm.html for further introductory explanations.
260
Disks
Chapter 27 Documentation Documentation for Linux abounds but finding it is sometimes a little challenging. Sometimes you find it as a man page, sometimes as an infotex document, sometimes as a html document, and sometimes as a Gnome document. And that’s just on your local system—searching the Internet for documentation is often very fruitful. To read documentation see dhelp or browse http://localhost/doc/HTML/index.html file://localhost/usr/share/doc/HTML/index.html
27.1
Debian doc-central
Debian has a central utility to view all locally installed documentation, called doc-central. Other Debian packages for browsing Debian documentation include dwww and dhelp. The newer doc-central has several improvements over the previous tools, with an improved interface and requiring no further effort than installing the doc-base package. Doc-Central is a collection of scripts that give you a convenient way to browse the documentation installed on your Debian system. Doc-Central uses a local http server (like apache) to present a list of all registered documents. Depending on the type of document other tools are used to view the document: for info files we use info2www. All other types are currently linked to directly. To get the list of installed documentation the docbase registration entries as used. For more information on doc-base please 261
262
Documentation
install the doc-base package and read the documentation in /usr/doc/docbase. it uses doc-base registrations for documentation. This means that unless maintainers register the documents for their pacakges doc-central won’t know about them. So please check your packages to see if you register all the documentation.
Chapter 28 Email Numerous tools work together to set you up with email. Fetchmail can retrieve email from multiple POP/IMAP servers and deliver it to your (possibly local) MTA. Exim, postfix, qmail, and sendmail are MTAs— they will dispatch email to users. Procmail can sort incoming email into different mailboxes for a user.
28.1
Setting up EMail
Suppose your local machine is called misty. In /etc/hosts you will see:
127.0.0.1 misty
localhost
In /etc/hostname you would see:
misty
The host misty does not exist outside of my local network. Externally my email comes through [email protected]. You can set up your mail in /etc/exim.conf to include: 263
264
Email
qualify_domain = togaware.com qualify_recipient = rose.togaware.com local_domains = localhost:rose.togaware.com host_accept_relay = localhost
This will ensure all outgoing mail appears to come from [email protected]. Local mail is delivered locally without leaving rose. All incoming mail is collected by fetchmail, detected by Exim and delivered.
28.1.1
Exim
The default email server for Debian is exim. This can be set up in one of several ways, depending on how you will access your email. The exim configurator will list the options. The newer exim4 will become the default at some time and its configuration is somewhat simpler. To configure it: > wajig reconfigure exim4-config
The file /etc/exim4/update-exim4.conf.conf contains the simple configuration information which is used to generate the more complex exim4 configuration files. The file /etc/email-addresses can be used to generate a From: address for each user (so that the From address will not be the default of the user@host).
28.2
Retrieving and Filtering Email
28.2.1
Fetchmail: Collect Mail from Remote Hosts
The fetchmail package will retrieve email from remote hosts (via POP or IMAP, for example) and have it delivered locally. The following scenario for user kayon with the following .fetchmailrc will use ssh to tunnel to POP to avoid sending clear text passwords, and to also encrypt all the communications. poll localhost with proto POP3 and port 5110: user ’kayon’ there with password ’XXXX’ is ’kayon’ here
28.2 Retrieving and Filtering Email
265
preconnect "ssh -2 -f -a -C -L 5110:pophost:110 lynx sleep 5" keep
A similar example using IMAP instead and some other options: set postmaster "kayon" set bouncemail set no spambounce set properties "" poll localhost with proto IMAP and port 5143: user ’kayon@NEXUS’ there with password ’XXXXX’ is ’kayon’ here preconnect "ssh -2 -f -a -C -L 5143:imaphost:143 merak sleep 20s" fetchall
This gives user kayon access from their desktop Linux machine to the host lynx (Section ??) which might be inside the company firewall and which has access to the mail server imaphost (Section ??). Kayon’s email comes from an MS Exchange server (called imaphost (Section ??)) on the same company network with IMAP enabled. But for security reasons the company network does not allow IMAP access externally. Then start fetchmail with one of the following: > fetchmail > fetchmail -v > fetchmail -d30
(Show what it does) (Run fetchmail every 30 seconds)
An alternative is to have a tunnel up all the time: altrop> ssh -2 -N -f -a -C -L 5143:mailhost:143 lynx
The -N indicates that no command should be run on the remote host, which is suited to tunnelling where the connection is required to simply sit there. This will link localhost:5143 to mailhost:143. You can confirm connection by trying: > telnet localhost 5143 Trying ::1...
266
Email
Trying 127.0.0.1... Connected to localhost. Escape character is ’^]’. * OK Microsoft Exchange IMAP4rev1 server version 5.5.2655.37 (saab-bt.togaware.com) ready
Now run fetchmail with something like the following in .fetchmailrc:
poll localhost with proto IMAP and port 5143: user ’kayon@NEXUS’ there with password ’XXXX’ is ’kayon’ here
The fetchmail-ssl package is SSL-enabled for POP3, APOP, IMAP. Perhaps this is a better solution, but does it require SSL support from the POP3 server?
28.2.2
Procmail to Filter and Split Email
A sample .procmailrc:
# DEBIAN :0: * ^Resent-Sender.*[email protected] lists/debian-devel :0: * ^Resent-Sender.*[email protected] lists/debian-user
The :0 begins a recipe. The following : ensures the mail file is locked. A line beginning with * begins a condition. You can have multiple conditions within a recipe. The condition ^Resent-Sender.*[email protected] captures email sent to the debian-devel mailing list. This matches messages that include Resent-Sender: [email protected] in their header. The final line of a recipe is the mailbox into which procmail will send the mail.
28.2 Retrieving and Filtering Email
28.2.3
267
IMAP: Mail Server
To set up an IMAP mail server install task-imap which installs wu-imap. IMAP will then be running. A sample IMAP session: > telnet imaphost 143 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is ’^]’. * OK Microsoft Exchange IMAP4rev1 server version 5.5.2655.37 (imaphost.act.cmis.CSIRO.AU) ready
28.2.4
POP Mail Server
You can manually interact with a POP server to perhaps manually delete an email that your mail too is having trouble downloading, or simply to check things out. Here’s a sample manual session: > telnet pop.togaware.com 110 Trying 203.95.38.50... Connected to pop.togaware.com. Escape character is ’^]’. +OK Hello there. USER kayon +OK Password required. PASS Secret +OK logged in. LIST +OK POP3 clients that break here, they violate STD53. 1 2269 2 1498 3 2816 4 2113 . RETR 1 +OK 2269 octets follow. Return-Path: Delivered-To: [email protected]
268
Email
... . DELE 1 +OK Deleted. QUIT +OK Bye-bye. Connection closed by foreign host.
28.3
Reading Email
An excellent graphical tool for reading email is evolution. A separate chapter (Chapter 30) covers this. A powerful alternative without all the gloss is mutt. If you live within emacs then gnus or vm might be the way to go.
28.3.1
Mutt
Mutt is a fast, flexible, console-based (meaning remote access is easy) email tool. It has many handlers and mail management capabilities with built-in cryptography and signing capabilities. It supports scoring, multiple mailbox formats, and many handy accelerators. Usage: Select all messages dated July: T~d 1/7-31/7 To execute a command on all tagged mesages (e.g., delete using d), preceed it with ’;’.
28.3.2
Gnus
To incorporate a file (inbox.old that contains old email messages in Unix mbox format: 1. Go to the group buffer. 2. G f inbox.old creates nndoc group. 3. enters the group.
28.4 Email Tools
269
4. M P b process mark all articles. 5. B r nnml respools all the process marked articles. 6. q
28.4
Email Tools
28.4.1
Grepmail: Search mail archives
Grepmail searches mailboxes to build a new mailbox with all emails containing the results, so that they can be reviewed with your favourite mail tool. The default is to search for the pattern in both the head and body of the email. Only email headers are searched if you specify -h; search is restricted to email bodies with -b. To be case insensitive use -i and to ignore MIMEencoded blocks use -M. Date searches are effected with -d which allows a date string in a variety of formats, including -d yesterday, -d "5/18/2001" for email since 18 May 2001. The basic use is: $ grepmail [] >
So, for example, you might search for the email containing that meeting: $ grepmail -RMi "that meeting" ~/mail > meeting.mbox
This takes about 10 minutes to search my 2GB of mail files. But perhaps you want just a report of files in which the email appears: $ grepmail -RMir "that meeting"
More complex patterns are possible: $ grepmail -RMih "^From.*Freddy" ~/mail
And to search specific headers: $ grepmail -RMiY ’(^TO:|^From:)’ [email protected] ~/mail
270
Email
28.4.2
EMail Attachments
28.4.3
MS-TNEF attachments
Have a look at http://freshmeat.net/appindex/1999/10/13/939847359. html
28.4.4
Uuencode and Uudecode in Mail
Before the development of the MIME standard a common way to include attachments within an email message was to transform 8bit data format into a 7bit US-ASCII text format using the uuencode command. To decode the attachment you need to use the uudecode command. This command can be applied to the whole mail message and it will find the relevant sections and extract the encoded attachments into the files they specify. One way to effect this is to save the mail message to a file (say message.uu), then do: $ uuencode message.uu
You may want to do this in a temporary directory to deal with the potential of uuencode overwritting pre-existing files.
28.4.5
Mailing Lists
Debian Pacakges: mailman Install mailman. Run mmsitepass to set the site password. Visit http://ktware.com/cgibin/mailman/admin/ However, a simple use of /etc/aliases on the machine may sometimes suffice for a small local network. Then use rdist to distribute the aliases file to the local machines.
28.5
Spam
Debian Pacakges: spamassassin
28.6 SMTP Direct
271
The spamassassin package is extremely useful for dealing with unwanted emails. If your arriving email has already been passed through spamassassin (by your ISP or else through using fetchmail yourself), then you simply have to check for the appropriate header field in the email (i.e., check if X-Span-Flags exists and contains YES). Set up an evolution filter to do this. Select Tools→Filter and click on Add. The search criterion will be to look at a Specific header (X-Spam-Flag) and to check that it contains YES. For the action choose a folder into which the identified spam should be placed (rather than deleting it, just in case spamassassin gets it wrong). Click OK and that’s it. To call spamassassin for use within evolution create a script file (perhaps in /home/kayon/bin/spam-filter.sh with: spamassassin -e
The -e option indicates that we should run spamassassin and return an exit code that indicates whether the email looks like spam. Make the script executable with: > chmod u+x /home/kayon/bin/spam-filter.sh
Now tell evolution to filter you email with this script. So, create a new filter with Tools→Filter and click on Add. Call the new filter something like ‘SpamAssassin’. Select ‘Pipe Message to Shell Command’ as the first part of the criteria. Then fill in /home/kayon/bin/spam-filter.sh as the command to run. Set ‘Does Not Return’ and ‘0’ for the other fields. For the action choose a folder into which the identified spam should be placed (rather than deleting it, just in case spamassassin gets it wrong). Click OK to close the filter and then OK to close the filter editor. You are now done!
28.6
SMTP Direct
You can talk directly to an SMTP server, for example to test that it actually works for you. Here’s a sample interaction. > telnet mailhost.act.togaware.com.au 25
272 Trying 105.83.2.11... Connected to mailhost.act.togaware.com.au. Escape character is ’^]’. 220 mailhost.act.togaware.com.au ESMTP Postfix helo modern.act.togaware.com.au 250 mailhost.act.togaware.com.au mail from: [email protected] 250 Ok RCPT TO: [email protected] 250 Ok data 354 End data with . Subject: Testing manually through telnet to mailhost This is the body . 250 Ok: queued as 42DDE139919 quit 221 Bye Connection closed by foreign host.
Email
Chapter 29 Eye of Gnome: Image Viewer The Eye of Gnome is an image viewing and cataloging program. It can deal with large images, and zoom and scroll while keeping memory usage constant. You can drag a collection of filenames into a window and EOG will open each of them.
273
274
Eye of Gnome: Image Viewer
Chapter 30 Evolution: GNU Personal Information Manager Personal Information Managers (PIMs) provide address books, calendars, to-do lists, and email readers. Evolution, from Helix Code, is the Gnome allin-one PIM similar to Microsoft’s Outlook. Evolution provides an integrated desktop environment providing a mail client, address book, and calendar.
30.1
Managing Email
30.1.1
Using Virtual Folders
Virtual Mail Folders is a concept familar to many GNU/Linux users, but often not found in the Win32 OS. A virtual folder groups together email messages into separate folders, using canned queires. The folders don’t actually exist as physical folders on the file system at all—the original inbox is maintained. Through this mechanism the mail in the inbox can be separated according to the mailing list that it originates from, or a group of colleagues working on a project, etc. A significant advantage of virtual folders is that you can easily change the organisation of your inbox without actually physically reorganising your inbox or extracting messages from your inbox into other physical folders. You can delete a virtual folder without actually deleting the messages in it! 275
276
Evolution: GNU Personal Information Manager
Figure 30.1: The Evolution Welcome Screen showing some email from the Evolution development team at Helix Code.
30.2
Contacts and Address Book
30.3
Managing Your Calendar
30.4
Tracking Your Tasks
Chapter 31 File Systems The default GNU/Linux file system (which defines how data is stored on a storage device like a hard disk) is call the ext2fs. Ext2fs is an inode (information node) based filesystem. Inode based file systems store pertinent file data in inodes. Such file systems have been around since the early days of Unix. Other inode-based file systems include XFS and BSD’s UFS. Ext3fs extends ext2fs with journaling. Thus, when you reboot without properly shutting down the machine, for example, no more messages about non clean un-mounts of the file system. ReiserFS is a very different file system based on fast-balanced trees. It was proposed by Hans Reiser who took the theoretical concept of AVL-trees to the task of a filesystem.
277
278
File Systems
Chapter 32 Firewalls THIS IS OLD. USE IPTABLES NOW. Debian Pacakges: bastille A firewall can be set up on a machine connected to the Internet and can then relay network traffic to machines connected on a local network. The bastille package provides both a firewall and Network Address Translation (NAT—also referred to as IP Masquerading). When installing the package use the defaults and all should be just fine.
32.1
IPMASQ
To set up your Debian GNU/Linux machine as a firewall use: wajig install ipmasq
Then set up your /etc/network/interfaces file and ipmasq will set up firewall and routing tables automatically.
32.2
IPCHAINS
With a update to the klogd package (or perhaps it was an update to the netbase package which contains ipchains, I started getting the following log 279
280
Firewalls
messages written to my console (in addition to /var/log/syslog and in dmesg!): Packet log: input DENY ppp0 PROTO=88 125.83.4.1:65535 224.0.0.10:65535 L=60 S=0xC0 I=0 F=0x0000 T=2 (#11)
These packets are coming from actdial.togaware.com (125.83.4.1—my connection to the internet) and their CISCO router sending regular EIGRP (PROTO=88) packets. Nothing untoward about this but for some reason the log messages were appearing on the consoles! Every 4 seconds! Looking at the current ipchains rules we see rule 11 is the default catch-all: DENY
all
----l-
anywhere
anywhere
n/a
With the following ipchains command the log messages are stopped: # ipchains -I input 11 -i ppp0 -d 224.0.0.10 -j DENY
So that rules 11 and 12 of the input chain are now: DENY DENY
all all
---------l-
anywhere anywhere
IGRP-ROUTERS.MCAST.NET n/a anywhere n/a
Note that you can save the current rules using: # /etc/init.d/ipchains save
which places the saved rules into /etc/ipchains.save. Load them in again with: # /etc/init.d/ipchains load
It seems to be okay to flush the old ones when asked. Unfortunately, this rule is lost each time ppp restarts! But the actual problem has been found: The log messages have a log level of less than 7, meaning they are more than debug messages. The klogd logger will display messages with a log level less than 7 to the console! This is “fixed” by changing, in the file /etc/init.d/klogd the line that says:
32.2 IPCHAINS
281
KLOGD=""
to KLOGD="-c 5"
The messages are now gone from the console, but still remain in dmesg and /var/log/syslog. Indeed, /var/log/syslog gets filled with these so it still may be best to turn them off with the ipchains rule.
282
Firewalls
Chapter 33 Floppy Disks The floppy disk device (i.e., the code that knows how to deal with the floppy disk drive) is usually /dev/fd0. Under MS-Windows this would be referred to as drive a:. In this chapter we cover topics relating to using floppy disks on a GNU/Linux system.
33.1
Floppy Drive Access Permissions
In some installations users might not, by default, have access to the floppy drive. Generally the floppy device (/dev/fd0) belongs to group floppy and the administrator may need to add a user to this group to grant them access. This can be done simply with the Gnome interface from Applications→System Tools→Users and Groups. Refer to Chapter 44 for details on managing groups. Alternatively, from the command line the following has the same effect: # adduser kayon floppy
33.2
Format a Floppy
The Gnome tool to format a floppy disk is gfloppy, as shown in Figure 33.1. This can be accessed from Applications→System Tools→Floppy Formatter. 283
284
Floppy Disks
Figure 33.1: The Gnome floppy formatter.
From the command line there are several options. You can format the floppy with: $ superformat /dev/fd0
Similarly the command: $ fdformat /dev/fd0
will also format a floppy, but does not create an file system. A file system can be created with mkdosfs. You could put, instead of a MS-DOS file system on the floppy, a Linux file system with: $ mkfs -t ext2 /dev/fd0
33.3
Using DOS-Like Commands
This user, guest, can then use the mtools commands to access the floppy disk. These are tools that mimic the Microsoft DOS commands: mdir, mcd, mcopy, mdel.
33.4
Mounting Floppy Disk Device
Edit /etc/fstab to add the following line to allow any user to mount /mnt/ floppy which is particularly convenient from the Gnome mount applets which
33.4 Mounting Floppy Disk Device
285
you can click on to cause a mount or unmount. Or create symbolic links for Gnome from your ~/.gnome-desktop directory to /floppy. Then Gnome seems to magically do the mounting for you when you open them (they will appear on your Gnome desktop and you can change the icons to more appropriate symbols such as a floppy). I guess you better make sure you unmount the floppy before you physically remove the media. /dev/fd0
/mnt/floppy
auto
defaults,noauto,users,rw
0
0
286
Floppy Disks
Chapter 34 Fonts: X Window System 34.1
Setting Up Fonts in X
Let’s assume you are not using a font server. A good guide to setting up fonts in X is available from http://egads. ertius.org/~rob/font_guide.txt. The following provides a summary! We assume you are using xserver-xfree86 version 4.1 or later. First install x-ttcidfont-conf and defoma. Then add the following to the top of the Files section of /etc/X11/XF86Config-4, so that TrueType fonts are available. FontPath
"/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
After installing any new TrueType fonts while in X be sure to run $ xset fp rehash
to ensure the new ones get noticed. The order of fonts in the Files section has an impact on what fonts are used by XFree86. Be sure to give Type1 fonts (often rendered poorly in XFree86) a low priority by placing the following line at the end of the list of FontPaths: FontPath
"/usr/lib/X11/fonts/Type1"
287
288
Fonts: X Window System
Another trick is to avoid XFree86 rescaling fonts by giving a higher priority to the unscaled fonts, by placing the following two lines relatively higher in the lits of FontPaths: FontPath FontPath
"/usr/lib/X11/fonts/100dpi:unscaled" "/usr/lib/X11/fonts/75dpi:unscaled"
Direct from the above web page:
Now that it’s all setup, install some font packages. ttf-bitstream-vera is a rather nice set of fonts, and is Free (http://www.debian.org/intro/free) enough to go into Debian itself. It’s not in woody yet, but you can download the .deb from http://http.us.debian.org/debian/pool/main/t/ttf-bitstream-vera/ttf-bitstream-vera_ (or your local mirror) and install it with "dpkg -i ttf-bitstream-vera_1.10-3_all.deb" (as root). sid and sarge users are just an "apt-get install ttf-bitstream-vera" away from it. Another option is ttf-freefont, which is in all three current versions of Debian. For Japanese and other non-roman languages, you might want to try these fonts: tfm-arphic-bsmi00lp, tfm-arphic-bkai00mp, tfm-arphic-gbsn00lp, tfm-arphic-gkai00mp, hbf-jfs56, hbf-cns40-b5, hbf-kanji48, ttf-baekmuk and ttf-thryomanes. Another alternative is to install Microsoft’s Corefonts. They removed the fonts from their website, but the msttcorefonts package will download them for you from a mirror. Note that these are NOT Free (in the Debian sense), but you’re permitted to at least use and download them. Both of these packages (and the other ttf-* packages in Debian) should now Just Work, and appear available to all X programs that use the regular "core" font system. This includes things like xterm, emacs and most other non-KDE and non-GNOME applications. Now, run "xfontsel" and select either "Microsoft" or "Bitstream" in the fndry menu (click on the word "fndry"). Now look at the ungrayed out entries in the "fmly" menu. You should have a bunch of either Microsoft fonts (Verdana, Trebuchet, etc) or some Bitstream ones (or both). For KDE2.2 and GNOME1.4 (with libgdkxft0, which is a hack to get GTK
34.2 Fonts are too Large
289
1.2 to do anti-aliased font rendering), you need to setup Xft1, as well. Xft1 is highly deprecated, and is basically only used by GNOME1.4 and KDE2.2. For GNOME2 and KDE3, you need to setup "fontconfig" which Xft2 uses to find fonts. I’ll get to that in a minute. Edit /etc/X11/XftConfig and add a line like dir "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" before the other dir lines. I don’t have any xft1 stuff on my machine anymore, so I’m not sure if you need to restart X or not before this change will take effect. I seem to remember that "xftcache" would update the Xft1 cache, but it’d be good if someone could confirm that for me. Now, for fontconfig, which does *not* exist in woody. You shouldn’t need to install anything extra for this, since all the packages using fontconfig will Depend on it (indirectly) already. First, look in /etc/fonts/fonts.conf. There should be a line like the one below. If not, open up /etc/fonts/local.conf and add this /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType just after the line. Fontconfig should pick these up immediately, and "fc-list" should list your new fonts. Another neat feature of fontconfig is that you can just drop fonts in ~/.fonts/ and all your fontconfigified programs will have access to them immediately.
34.2
Fonts are too Large
Depending on your setup you might find that the default fonts used by the X Window System are too big. Generally, the default setup is good for 1024x768 resolution but on laptops and older hardware that only support 800x600, for example, it is best to use smaller fonts. To achieve this simply edit your /etc/X11/XF86Config file so taht the 75dpi (dots per inch) fonts come before the 100dpi fonts. A snippet from a typical installation is: Section "Files"
290 RgbPath FontPath FontPath FontPath FontPath FontPath FontPath FontPath FontPath FontPath FontPath FontPath EndSection
Fonts: X Window System "/usr/X11R6/lib/X11/rgb" "/usr/X11R6/lib/X11/fonts/local/" "/usr/X11R6/lib/X11/fonts/misc/" "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" "/usr/X11R6/lib/X11/fonts/Type1/" "/usr/X11R6/lib/X11/fonts/Speedo/" "/usr/lib/ghostscript/fonts/" "/usr/X11R6/lib/X11/fonts/75dpi/" "/usr/X11R6/lib/X11/fonts/100dpi/" "/usr/X11R6/lib/X11/fonts/freefont/" "/usr/X11R6/lib/X11/fonts/sharefont/"
Chapter 35 Ghemical: Chemical Modelling Ghemical is a package for computational chemistry being developed at the Department of Chemistry, University of Kuopio, Finland. The package supports all-atoms molecular mechanics and reduced protein models. Geometry optimisation, molecular dynamics, and visualisation tools are available. Ghemical can be directly linked into the quantum chemistry program MPQC for quantum-mechanical calculations, effectively serving as a graphical frontend for the MPQC program, thus providing various 3D-plots for electron densities, molecular orbitals, and molecular orbital densities.
291
292
Ghemical: Chemical Modelling
Figure 35.1: The Gnome Chemistry Modeller
Chapter 36 GIMP: Image and Photo Manipulation The GNU Image Manipulation Program (the GIMP) is the open source image and photo manipulator which gives Adobe’s very popular and powerful Photoshop a serious run for its money. GIMP is a very powerful tool for editing images and creating impressive graphics. It is one of the highlights of all open source software, and demonstrates the quality that can be achieved through open source development. This chapter provides a number of recipes for some common tasks using the GIMP. Many excellent books that unleash the full power of the GIMP are available and some are mentioned in Section 36.3.
36.1
Remove Red Eye
Use the lasso selection tool to select the red eye region (zoom in first). Then bring up the Channels dialogue and de-select Green and Blue. Then from the menus choose Desaturate a few times. That should fix it.
36.2
Image Quality
Image resolution (dots per inch or just dpi) is an indication of the quality of an image. It is less important for screen images but more so for print293
294
GIMP: Image and Photo Manipulation
Figure 36.1: Sample GIMP screenshot.
36.3 Gimp Resources
295
ing. Common image resolutions include 72, 120, 300 and 600 dpi (dots per inch). When producing graphics for web pages or for viewing on the screen then 72dpi is generally the more popular resolution (and keep the images to less than about 30K). For scanning and printing, 400dpi is a good quality resolution. For printing 100dpi is generally exactly 100 dots per inch. On screen however this is not always so, as it depends on the resolution of the monitor (so a 72 pixel wide image on a 17” monitor at 640x480 might come out at about an inch but at 1280x1024 it will be half the size, and so about 144dpi). When scanning or printing dpi is something that becomes important. For images meant for display on a screen, as in web design it is the pixel dimension that is more important. Consider two images that are both 100x100 pixels, but one is say 100dpi and the another is 300dpi. They will be exactly the same size on your monitor but when printed the first image will be 3 times larger then the second. The GIF format doesn’t store any dpi information—only the pixel dimensions so when the GIMP saves to GIF you “lose” your printer settings! When opening a GIF the resolution will be set to 72dpi. When designing for screen display of images consider what monitor size will you want to design for (640x480, 800x600, 1024x768, etc). Then ensure your final image is not any larger then your screen. You will also need to take into account that the actual area of your browser is smaller then the screen and so you should keep images as small as possible.
36.3
Gimp Resources
GIMP Visual Quickstart Guide by Phyllis Davis. 306 pages, published May 2000 by Peachpit Press, ISBN 0201702533. Gimp for Linux Bible by Stephanie Cottrell Bryant, Tillman Hodgson, and Bryan Livingston. 728 pages, published April 2000 by DG Books Worldwide, ISBN 0764533983. Grokking the Gimp by Carey Bunks. 352 pages, published February 2000 by New Riders Publishing, ISBN 0735709246. Sams Teach Yourself GIMP in 24 Hours by Joshua Pruitt and Ramona
296
GIMP: Image and Photo Manipulation
Pruitt. 334 pages, published March 1999 by Sams, ISBN 0672315092. Arists’ Guide to the GIMP by Michael J. Hammel. 340 pages, published December 1998 by Specialised Systems Consultants, ISBN 1578310113.
Chapter 37 Glade: GUI Builder Glade is a graphical user interface (GUI) builder for creating applications using the GTK+ and Gnome toolkits. It provides a visual tool (c.f. Visual Basic) to interactively create the GUI on a canvas from components (widgets) provided by the toolkits. Interfaces can be rapidly developed and source code in a variety of languages can be automatically generated. Glade directly generates C source code with support for C++, Ada95, Python, Perl, and Eiffel available within Glade via external tools. Alternatively, LibGlade can be used to dynamically create the user interface directly from the XML data at run time. As with many Gnome products Glade’s native save format is XML (gzip compressed) allowing the interface to be modified, transformed, and viewed by many other XML tools (or even edited manually in your favourite text editor if desired). Independent applications that allow differently structured C source code to be generated directly from the XML data, for example, exist. In this chapter we begin with an overview of using Glade. We then proceed through the development of a sample Glade application by way of a walk-through that will build the interface. This is followed by walk-throughs that will turn this interface into a fully functional application. These walkthroughs begin with a C implementation and include packaging the application for distribution using the GNU packaging tools (automake, autoconf, and tar). We then walk through the use of the LibGlade library as an alternative for C. Versions of the application in Python and C++ are also presented. We complete this chapter with reference sections covering all aspects of Glade and some basics of the Gtk+ and Gnome toolkits. 297
298
37.1
Glade: GUI Builder
Using Glade
Together with the GTK+ toolkit Gnome provides an extensive collection of user interface building blocks called widgets. These are components like text fields, labels, numeric entries, check buttons, menus, and so on. In your programming language of choice you access these widgets to compose a graphical user interface for your application. This often involves careful programming to place your widgets correctly and to associate code with actions that are performed on the widget (such as clicking on a button). Glade simplifies this task by providing a GUI-based GUI-builder. With Glade you choose widgets from a graphical palette of available widgets and place them onto your evolving application window (the canvas). You edit the properties associated with the widgets through another graphical interface where you also add the appropriate connections between your widgets and externally written code. This is done by identifying the names of functions that will be called when a widget receives a signal. For example, you can associate a function that you might call on button1 clicked with the “clicked” signal associated with a button). These functions (callbacks) you code up in your programming language of choice, whether that be C, C++, Ada95, Python, Perl, or Eiffel. When you are happy with how the interface looks you will either generate the source code that implements the interface you have created or else you will use a library (LibGlade) that directly loads the saved description of the interface at run time and dynamically creates it. Your main coding task is to write your callbacks (the functionality behind the interface) and the associated support functions.
37.2 Glade Walkthroughs
37.2
Glade Walkthroughs
37.2.1
Building the GUI
299
We will use a simple application to illustrate Glade in action. Our sample GUI will be for a tool to count the number of lines, words and bytes in a file—nothing complex but suitable for demonstration. The Glade Windows Start Glade from the Programs→Development menu of the Gnome desktop (or else use Ctl+F2 and then type in glade to start the application). You will see three new windows popup. These constitute the Glade interface.
The left most window above is the main Glade window which will list the windows and dialogs of your own project. Currently it is empty. The middle window is the Palette window from where you choose the user interface widgets to include in your interface. The right window is the Properties window where you can edit the properties of each widget such as it’s size, behaviour, and signals it responds to. There are two other Glade windows not shown but which can be displayed by selecting them from the main window’s View→Show Widget Tree and View→Show Clipboard menus. We will see them later.
300
Glade: GUI Builder
Project Options Our first task is to start a project by editing the Project Options through the Options button of the main Glade window (or else through the File→Project Options menu). By default the Project Directory listed is set to /home/guest/Projects/ project1 (where guest is the current username—it will be your username in your case). In the figure on the right the user has edited this to replace the default project1 sub-directory with gwords—a more descriptive name for this application. Note that the Project Name, Program Name and Project File have automatically changed to reflect the change in the Project Directory. We will leave these defaults as they are since they represent good choices. See Section 37.3.4 for details. The remaining options we won’t change either. Again they are generally good choices. Note in particular though that we have the Enable Gnome Support option turned on. You can take a look at the other two option tabs, C Options and LibGlade Options, to get an idea of what else you can configure (see the Reference sections later for details). When satisfied simply click the OK button. The main Glade window’s title will have changed to be ‘Gwords,’ the name of our application, replacing the previous ‘.’
The Gnome Application Window Now we are ready to start building our Gnome interface. We first need to create our main Gnome Application Window which will be the window displayed when our application starts up. Select the Gnome button of the Palette window to display in the palette the Gnome widgets (which are extensions to the GTK+ Basic widgets which are displayed by default). Identify the Gnome Application Window widget by hovering the mouse over the various widgets to display their tool tips. It is the top left widget in the palette. Simply click on it with the left mouse button to create one. There are many other widgets available on this Gnome palette. They include
37.2 Glade Walkthroughs
301
dialog boxes, message boxes, a standard Gnome About Dialog, file entry field with a browse button, a pixmap entry field with built-in preview, and a druid. We’ll see some of these later and all of them in the reference sections. For now we simply create the Gnome Application Window. You will be presented with a new window that has many of the characteristics of a Gnome application window. There is the menu bar along the top with the usual File, Edit, View, Settings, and Help menus, most including standard menu items within them. This is followed by the default toolbar with the New, Open, and Save buttons. Below this is the canvas area where you will construct your interface. At the bottom is the status bar and a progress monitor. Note that not all menus and toolbar buttons will be useful for your application and you will have others in mind that you may wish to add. Feel free to click around the window and see the menus by clicking the menu twice—once to select the menu itself then once to open up the menu to show it’s sub-items. Also note how widgets are identified in the Properties window as you select the widgets.
Adding Widgets For now let’s ignore the excess of decoration. Instead we will build the basic interface components. There’s not much that we need in the interface. Certainly we need to identify the file to be word counted. Also we want to identify whether to just count the words or also the lines and bytes. We go back to the GTK+ Basic palette for one of the layout widgets. These are towards the bottom of the palette—third row from the bottom in fact. Hover the mouse over each of them to find the Horizontal Box, Vertical Box, Table, and Fixed Positions. Click on the Vertical Box layout. Now on the central canvas area of your Gwords interface click the left mouse button. You will be asked for the number of rows for your box—the default of 3 will do for now so just click on the OK button. Your canvas will be divided into 3 rows. Each one of the 3 rows can now be constructed independently—each can contain a different widget, including further layout widgets. We will use the first row to identify the name of the file whose contents we
302
Glade: GUI Builder
will be counting. We will use a file entry box to allow for the entry of the filename. We will also add a label so that we know what the file entry box is for. That means two widgets and all we have is a single row—so we need to add a Horizontal Box with two columns. Find the Horizontal Box on the GTK+ Basic palette, click it with the left mouse button and then click in the top row of the three rows of our canvas. When prompted select just 2 (rather than the default 3) columns for this Horizontal Box. Labels should probably go to the left of the entry box so we will place the label first. Select the Label widget from the GTK+ Basic palette—the first item on the second row. Now click in the top left box of our canvas (this is the left most of the two cells we have just created). A GtkLabel widget should now appear with the label label1 (and some resizing of the cell might occur). This is now our first “real” widget. Of course we don’t want the label to read label1 (even though we might leave it’s name—as distinct from it’s label text—as label1 for now). We can change the label text through the Properties window where you will find the fields relevant to this widget (assuming it is still the selected widget). Change the Label field to be ‘File:’ (replacing label1). For good measure set the X Pad field to be 10 (so that the widgets won’t look so cramped). You will see the effect of these immediately. To summarise so far. A basic Gnome Application Window has been created with the default menu bar and toolbar and a Gnome Application Bar at the bottom. We have added a 3 row Vertical Box and in the top row of this a 2 column Horizontal Box. In the resulting top left cell we have added a Label widget and changed the text to be ‘File:.’ It also has it’s X Padding set to 10 to give a less cramped layout. Removing Widgets You can remove widgets easily through the menu on the right mouse button. First click on a widget with the left mouse button to select it. The right mouse button will then list the actions you can perform on this widget,
37.2 Glade Walkthroughs
303
including cut and delete. Note also the list of “parent” widgets all the way up to the root widget which is called app1. Before proceeding let’s explore this widget pathway in a little more detail.
The Widget Tree All widgets in an interface are organised into a tree viewable directly through the View→Show Widget Tree menu of the main window. When a widget on your canvas is selected the right mouse button menu allows you to view the path up the tree from this selected widget to the root widget. The path from the filename label (label1) above consists of hbox1, vbox1, dock1, and finally app1. Each of these have submenus from which you can choose to perform actions on those widgets. For example, if you delete vbox1 then that widget and all of it’s children will be deleted from the canvas—so be careful! We can see the Widget Tree window expanded above. Thus, app1 contains dock1 which is made up of three sub-components: dockitem1 contains the menu bar; dockitem2 contains the toolbar; and vbox1 is the Vertical Box that we added above. The Widget Tree window provides an alternative mechanism for selecting widgets.
Gnome File Entry Now we add the widget for entering the filename. The one we will use is the one provided by the Gnome palette. We could use the text entry field of the GTK+ Basic palette and add a Browse button ourselves, but the Gnome palette Gnome File Entry widget does it all for us, and more. Click on this widget in the palette then click in the top right cell of your canvas. The browse button might look a bit strange (stretched out) but don’t worry, it will sort itself out!
304
Glade: GUI Builder
You can save the work you’ve done so far by clicking on the Save button of the main Glade window (not the Save button of the window you’re working on though!). Then, for fun, open the project again—load /home/ guest/Projects/gwords/gwords. glade. Then, on the main Glade window double click the app1 widget. You may like to change the Border Width property of fileentry1 to be 10 (using the Properties window after selecting the file entry widget in the canvas). This makes it appear less cluttered. Tooltips Where possible you should think about tooltips—those small popup frames that appear while you hover the mouse over some item and contain useful information about the item. Tooltips provide the basic reminders that help the user ignore the application’s written documentation. Tooltips should be just a little verbose, perhaps taking up 3 or 4 lines of text. Aim to inform with the minimum number of words. You add tooltips to widgets by first selecting the widget. Select the text area of your fileentry1 widget—this will select something called combo-entry1 which is contained within the Gnome File Entry widget. Then in the Properties window click on the Basic tab. On that page you will see the Tooltip text entry about halfway down. Simply type in the required text, such as: Name of the file whose contents is to be counted. Now hover the mouse over the file entry field on your canvas and the tooltip should pop up. An interesting question is whether the tooltip should be associated with the file entry field as we have done or with the label of the field, or both? The answer is left as an exercise for the reader! We prefer to associate the tooltip with just the entry field itself since that is where the mouse will be hovering while you are thinking about it. On the other-hand Glade’s own interface associates the tooltips with the labels.
37.2 Glade Walkthroughs
305
Check Buttons
We will now add a label and 3 check buttons to the next row of our canvas. This will be used to indicate what we want counted: words, lines, and bytes. So we need space for 4 widgets which we achieve with the Horizontal Box widget of the GTK+ Basic palette. When prompted change the default 3 columns to 4 columns. Add a Label to the first cell of this row and change the text of the label to ‘What to count:.’ This label is called label2 in our collection of widgets. You may like to set the X Pad field to 10. Now add a check button for ‘Words’ in the next cell of this row. The check button widget is the third widget of the third row of the GTK+ Basic palette—the third row contains 4 different types of buttons. Select the Check Button from the palette with the left mouse button then click the left mouse button in the second cell of the second row of your canvas. This creates a new widget called checkbutton1. Change the Label: text field in the Properties window for this new checkbutton to read ‘Words.’ Similarly add check buttons for ‘Lines’ and ‘Bytes.’ That is, select the Check Button on the palette again then click in the next cell of your canvas. Note that after you place a widget on your canvas the selected widget button on the palette becomes in-active and the left mouse button reverts to being used for selection. By default we will only count words so the Words button should be on by default. This is easily achieved by editing the widget properties. Select the Words button on your canvas. Then in the Properties window under the Widget tab click on the button that says No alongside the Initially On label. This will change this property’s button to be indented and to read Yes and the corresponding check button on your canvas is now also turned on. Also add tooltips for each check button, selecting each of the check buttons, in turn, and adding text to the Tooltips field of the Basic tab of the Properties window.
306
Glade: GUI Builder
Removing a Row We now realise that we didn’t really need 3 rows for vbox1. Two are sufficient. Select the third row. You may notice that the Properties window goes blank and from the right mouse button menu this row of our canvas is nothing more than a Placeholder. The right mouse button menu Delete will remove it for us. You could put it back anytime (or indeed place any row within vbox1) through the right mouse button menu. Select any widget within vbox1 (e.g., the Words check button checkbutton1) and then with the right mouse button traverse the menu to select vbox1→Insert After.
Editing the Toolbar The Run and Stop Buttons and the on run button activate callback.
Editing Menus We will now tidy up the menus, removing those that don’t apply, and adding a new one to perform the actual word count.
Adding an About Dialogue File Not Found Dialogue Display Results After the words, lines, and bytes have been counted we will write the results to the Status Message area of the Gnome Application Bar at the bottom of the window.
Running Your Interface You can now run your interface, even though you have yet to write the code to perform the counting. Each of the following walkthroughs begins with the minimum required to run the interface without any actions behind it. You’ll want to give this a try just to make sure you can!
37.2 Glade Walkthroughs
37.2.2
307
Building the C Code
Once you have your basic user interface constructed tell Glade to save the project (using the Save button—this updates the file that contains the XML description of the interface) and then to build the project (using the Build button). Start up a terminal window, such as the gnome-terminal, and change to the project directory. There you should see an executable file called autogen. sh. This shell script takes care of the initial configuration of your package, running automake to automatically generate the appropriate support files for the configuration. It also runs the appropriate automake components leaving you with a collection of Makefiles. $ cd Projects/gword $ ./autogen.sh **Warning**: I am going to run ‘configure’ with no arguments. If you wish to pass any to it, please specify them on the ‘./autogen.sh’ command line. processing . deletefiles is Creating ./aclocal.m4 ... Running gettextize... Ignore non-fatal messages. You should update your own ‘aclocal.m4’ by adding the necessary macro packages gettext.m4, lcmessage.m4 and progtest.m4 from the directory ‘/aclocal’ Making ./aclocal.m4 writable ... Running aclocal -I macros ... Running autoheader... ... creating creating creating creating creating creating Now type
Makefile macros/Makefile src/Makefile intl/Makefile po/Makefile.in config.h ‘make’ to compile the package.
You can now simply run the make command to perform the compilation
308
Glade: GUI Builder
(making use of the generated Makefiles). Once completed, run the command src/gword to start up your application. $ make $ src/gword
And that’s all there is to it.
The GNU Package Management Tools The first time you build the project all of the necessary files and sub-directories are created. From then on each time you build only the relevant files that need to be changed as a result of changes in the interface are modified. Glade generates all the necessary files to be GNU compliant and to essentially run your application immediately (although without any callbacks the application won’t do much). The primary location for your C source code is in a subdirectory called src. In there you will see 3 header files (support.h, interface.h, and callbacks.h) and 4 source files (support.c, interface.c, callbacks.c, and main.c). Of these you should never edit support.h, support.c, interface.h, and interface.c. The first pair contain code that Glade supplies to support your application and the latter two are the actual interface code. Glade manages these files. You will be making changes primarily in callbacks.c to add the code for each callback. Glade will add new callbacks to the bottom of callbacks.h and callbacks.c. Now that you have built your interface (perhaps without any callback code just yet) you are in a position to configure, compile and run your application. The GNU automake and autoconf packages are used to simplify the management of the configuration, compilation, and installation of your application. These packages are a great help in the task of managing software projects. Discuss the files generated by the build and how they conform to the GNU Standards.
Counting the Words Now on to the code to actually do the word count and the appropriate callbacks.
37.2 Glade Walkthroughs
309
To recompile we simply run make again, either directly in the src directory or else in the gword directory. Packaging For Distribution Describe the make dist and make dist-check functionality.
37.2.3
Using Libglade C
Counting the Words
37.2.4
Using Libglade with Python
Using LibGlade with python is an excellent option for rapid prototyping and even build full strength applications. Like the use of LibGlade in C there is never any need for you to convert the .glade file (containing the XML description of the interface) into Python code. Instead, LibGlade reads the XML and directly builds the interface using the LibGlade library (written in C but with an interface for Python). The basic code is: #! /usr/bin/env python import gtk import libglade import gnome.ui def init_app (): "Initialise the application." global wTree wTree = libglade.GladeXML ("gwords.glade", "app1") dic = {"on_quit_button_clicked" : gtk.mainquit, "on_exit1_activate" : gtk.mainquit} wTree.signal_autoconnect (dic) def main (): init_app () gtk.mainloop ()
310
Glade: GUI Builder
if __name__ == ’__main__’: main ()
Here we have linked the interface callback on exit1 activate to the library callback gtk.mainquit. The on exit1 activate is associated through Glade with the Exit menu item and is supplied by default by the Gnome Application Window. Save this code into a file called gwords.py in your /home/guest/Projects/ gwords directory. Make the file executable with chmod u+x gwords.py. Then run the program with ./gwords.py. Your interface should come to life. Problems arise if you don’t have the appropriate packages installed. At a minimum make sure you have python-gnome installed (this package will depend on various other python and gnome packages which should be automatically installed by choosing to install python-gnome if you are using Debian). You may also need to ensure that the PYTHONPATH environment variable includes the gnome and gtk modules, but check this only if you have problems running your Python program.
Counting the Words Now we need to write some Python code to perform the counting of the words. This will not be much of a challenge though as we’ve already got the logic of the algorithm under control! It’s now just a task of knowing the appropriate Python syntax.
37.2.5
Using Libglade with Perl
In this section we cover some of the commonly used functions and concepts you need to know about when writing code to add functionality to your interface.
37.3 Glade Reference
37.3
Glade Reference
37.3.1
Writing Your Code
311
Finding Your Widget If you use Glade to generate source code for your interface (rather than using LibGlade) you should make use of the lookup widget() function that Glade defines for you (in support.c) to access your widgets. You pass this function a pointer to any widget in a window and the name of the widget that you want to get (where the name is a string and is the same as the Name in the Properties dialog for the widget). The function will return a pointer to the widget whose name matches the string you supply. The lookup widget() function relies on you giving a pointer to any other widget in the same tree (perhaps a pointer to the root of the widget hierarchy for that particular application window or dialog). Usually in a signal handler (the callbacks that you write in callbacks.c) you can use the first argument to the signal handler as the first parameter to lookup widget(). For example you may have a button in you window called button1 and when it is clicked you may want to access some text entry field that has the name “entry1.” In callbacks.c you may have a callback:
void on_button1_clicked
(GtkButton gpointer
*button, user_data)
{ GtkWidget *entry1; entry1 = lookup_widget (GTK_WIDGET (button), "entry1"); ... }
Internally Glade uses gtk object set data() for storing pointers to all the widgets in a window using the names set in the property editor as the key. Then, inside lookup widget(), gtk object get data() is used to retrieve the pointer indexed by this key. These two functions are also available to the developer for their own purposes.
312
Glade: GUI Builder
Using Libglade If you are using LibGlade to create the interface for you dynamically you will make use of glade xml get widget() to access you widgets. The LibGlade approach stores its widget pointers differently. Using the GTKExtra Libraries To make use of these libraries you will need to add the appropriate libraries to your src/Makefile.in and make appropriate modifications to autogen.sh and configure.in. Or perhaps you ONLY need to add to the appropriate LIBS line in src/Makefile.am. This seems more likely. Global and Local Pointers An eternal issue in GUI development is how to get hold of the pointer to the individual widgets when you need them. Should they be accessed from global pointers that then restrict you to a single instance (or a known number of instances) of the widgets a priori, or is there a better mechanism? Global Top Level Widgets One solution is to have the top level widgets global. This then allows all child widgets to be accessed using lookup widget() provided by Glade. Nothing Should be Global This is a pretty fundamental goal in programming and should be followed whenever possible. Here we identify how to avoid having globals.
37.3.2
Command Line Options
Normally you construct your GUI interactively with Glade and then choose to build the C code for the interface with the Build button. It is sometime inconvenient to fire up Glade just to build the C source code from the Glade XML file. Instead you can do the conversion from the command line with: $ glade --write-source
If the command line option is not supplied, but a gladefile is supplied, then Glade will start up and load the specified project.
37.3 Glade Reference
37.3.3
313
The Menus and Toolbar
We now explore each of the menus in a systematic and comprehensive way. There are five main menus and four of them (excluding View) should look pretty familiar to the Gnome desktop user: File, Edit, Settings, and Help. The toolbar provides a shortcut to some of the menu items. Rather than specifically covering them separately we identify their functionality below with their corresponding menu action.
The File Menu The File menu provides the usual New Project, Open..., Save, and Exit operations. In common with all Gnome applications F3 is the keyboard shortcut to open a project from a file, Ctl+S is the shortcut to save a project to a file, and Ctl+Q is the shortcut to quit from Glade.
New Project The New Project returns the project options to their default values (the same as when you start Glade without providing it a project file name). You will be asked to confirm that you wish to start a new project. Be sure you have saved the current project (if there is one) before you start a new project. Click the Cancel button on the popup if you have not yet saved the current project and wish to do so. Then choose New Project again. Click on the OK button to proceed.
Open If you have an existing Glade project you can Open it through this menu item, or through the Open button of the toolbar, or through the F3 shortcut, or else on the command line if you start glade from a gnometerminal. Via the menu, button, or keyboard shortcut you will be presented with a File Selection Dialog to choose the Glade project file. Like all Gnome (actually all Gtk+) applications tab-completion is active in the File Selection Dialog. Thus you can type Pr and it will be completed to Project/gwords if that is the unique completion. For non-unique completions you will see a list of possible completions in the File list.
314
Glade: GUI Builder
Save Glade currently does not keep tabs of whether you have saved your project. Be sure to do so with the Save menu item or the Save button or the Ctl+S keyboard shortcut. You can do this anytime and it is useful to be in the habit of saving your project regularly. Saving the project writes the current interface to a Glade project file which stores the interface in a compressed (gzip) XML format. See Section 37.3.7 for details of the save format. The first time a project is saved (when no project file already exists) Glade will present the Project Options dialog. This gives you an option to set the location of the project files and to set various source code options. Each time Glade saves the project the previous version is saved into a backup file (e.g. gwords.glade.bak). Only the most recent backup is kept. Build Source Code The File→Build Source Code menu item (and the Build button and the Ctl+W keyboard shortcut) will generate the source code that implements the interface. The language code generated is chosen from the Project Options dialog under the General options tab (see section 37.3.4). The default is C source code which is supported natively by Glade. Generation of C++, Ada95, Perl, and Eiffel is effected through helper applications from the packages glademm (for the glade– program), gate, glade2perl, and eglade respectively. These need to be available on your system if you are to build the interface in these languages. If Glade can not find the appropriate helper application it will pop up an explanatory window and show the message “Error writing source” in the main window status bar. See Section 37.3.3 for a description of the files generated by a build for C. When you select to build your project source code if you have not previously saved the project the Project Options dialog will be displayed allowing you to set the project paths and other options. Otherwise Glade will silently generate the source code. Project Options The File→Project Options... item will bring up the Project Options dialog. See Section 37.3.4 for details. Exit To exit Glade choose the File→Exit menu or else the Ctl+Q keyboard shortcut. Glade will ask for confirmation (but it has no indication of whether
37.3 Glade Reference
315
you have saved the project—make sure you have saved your project).
The Edit Menu Glade has a cut and paste facility, placing widgets into the a clipboard. The clipboard can be viewed by choosing View→Show Clipboard. Note the shortcuts are the standard Ctl+X for Cut, Ctl+C for Copy, and Ctl+V for Paste.
Cut The Edit→Cut menu item (and its Ctl+X keyboard shortcut) will remove the selected widget (and all of its children widgets) from the canvas. The widget (together with its children) will be placed on the clipboard as a single item. Later on you can select this widget on the clipboard and paste it onto your canvas.
Copy The Edit→Copy menu item (and its Ctl+C keyboard shortcut) is similar to Cut in placing the widget (and it’s children) on the clipboard, except that the widget is not removed from the canvas.
Paste After cutting or copying a widget the Edit→Paste menu item (and its Ctl+V keyboard shortcut) will place that widget onto the canvas to replace whatever is currently selected. This may mean that a currently selected widget will be replaced by the pasted widget. To avoid this ensure that what is currently selected is an empty place holder. What is actually pasted at any time depends on what is selected in the clipboard. By default the most recently cut or copied widget is selected in the clipboard. You can change the selected widget in the clipboard simply by clicking on it.
Clear The Edit→Clear menu item will delete the selected widget from the canvas. The widget is not saved on the clipboard—it is removed permanently.
316
Glade: GUI Builder
The View Menu The Settings Menu The Help Menu The Help menu provides access to three useful reference documents and the mandatory About... dialog. (Note that the reference documents are only available, currently, with the Gnome version of Glade.) The Help→Quick-Start Guide is a short document that reviews the main Glade interfaces and what happens when Glade generates source code. The Help→Manual is under development but provides details of all interfaces. The Help→FAQ contains a collection of typical questions asked by new users of Glade.
37.3 Glade Reference
317
The Help→About... menu item brings up the About dialog which identifies the version of Glade. This is useful if you need to report bugs or problems you are having. The copyright message identifies the owner of Glade. The author’s name and email address then appear followed by a short description of the what Glade is and a ULink for its home page. The Glade About dialog is a good example of how to use the Gnome dialogs.
37.3.4
Project Options
The Project Options dialog allows you to tune many aspects of the project you are developing with Glade. The types of options fall under three tabs: General, C Options, and LibGlade Options.
General The General options cover the project location, project names, programming language, and if to support Gnome.
Basic Options The Project Directory lists the directory in which the saved project file will be stored. This is also where the built source code will be written. Use the Browse button to identify a directory using a File Selection Dialog (which allows you to also create directories if you wish). As you change the Project Directory the Project Name, Program Name, and Project File values will also change, unless you have already changed these other fields separately to give them a different name.
318
Glade: GUI Builder
When you save or build a project the directories will be silently created as needed. The Project Name is the name of your project. This will be used as the title of the main application window you create (the Gnome Application Window). The name can have spaces and other characters. As you change the name of the project the Program Name, and Project File fields also change to reflect your project name (with spaces and other non-alphanumeric characters converted to dashes). The Program Name is the name by which the final executable program will be known. This is used by Glade to name the output executable file in the Makefile it generates. Once again, as you change this field the following field (Project File) automatically changes to be the same. The previous fields do not change. The Project File is then the file located in the Project Directory in which the interface is saved. This file has the extension .glade and is a gzip’ed XML document that records all of the project information. See Section 37.3.7 for details.
Subdirectories The Subdirectories fields indicate where Glade should place source code files it generates (Source Directory) and where Glade should place any pixmaps (graphics) used in the project (Pixmaps Directory). These subdirectories are located in the Project Directory and are silently created by Glade when it builds the project.
Language A choice of languages is available under Language. Only one can be chosen at a time. The choice tells Glade what to do when the Build button or menu is chosen. See Section 37.3.3 for details. The choices are C, C++, Ada95, Perl, and Eiffel. Note that this is not relevant when using LibGlade as the conversion is effectively performed at run time.
Gnome The Enable Gnome Support check button causes Glade to generate the appropriate calls to initialise a Gnome application (rather than a Gtk+ application). For a Gnome project this should always be enabled.
C Options
37.3 Glade Reference
319
The C Options dialog relates specifically to the generation of C source code for your project. Here you set various options relating to the generated code, the files that are to be generated, and their names. General Options The first general option indicates whether Glade should generate code to support the GNU gettext library so as to support internationalisation. It is a good idea to leave this on (which is the default). Internationalising your application is an important step in making your application user friendly. The Set Widget Names check button is used to tell Glade to generate code to set the names of all widgets in your interface. This is relevant if you find that you want to use the Gtk+ function gtk widget path(). The Backup Source Files check button will cause Glade to copy files to .bak backup files before overwriting them. This applies to the .glade file and also to the source code files. File Output Options Interface Creation Functions Signal Handling & Callback Functions Support Functions LibGlade Options The LibGlade Options includes just two parameters: whether to save translatable strings into a separate C source file, and if so, what
320
Glade: GUI Builder
file to save them in. This will facilitate the translation of interfaces loaded by LibGlade. This option is important if you are using LibGlade and you wish to internationalise your application. Details here
37.3.5
Widget Properties
37.3.6
Widget Palettes
List all of the widgets provided by each palette and basic description and functionality.
The GTK+ Basic Widgets The GTK+ Additional Widgets The Gnome Widgets The GnomeApp The GnomeApp widget is the basic Gnome application root window. It provides some standard menus, toolbar buttons and a status bar. The canvas area between the toolbar and the status bar is where you will layout your application. See page 301 for an example of the GnomeApp.
The GnomeDruid The GnomeDruid is the Wizardlike widget that has a sequence of windows with Next and Back buttons and a Finish button on the final window of the sequence. The GnomeDruid widget has a stylised start page (GnomeDruidPageStart
37.4 Glade Resources
321
widget) and a stylised finish page (GnomeDruidPageFinish widget) and in between is a collection of pages where information from the user can be obtained (GnomeDruidPageStandard widgets). On the start and finish pages you can only supply a title and some text. These pages are information pages and are not used to obtain responses from the user. The pages in between include a GtkVBox in which you can add your own widgets.
37.3.7
The Glade Save Format
37.4
Glade Resources
Once you get into writing code you will need the GTK+/Gnome API documentation and might find the tutorial at http://www.gtk.org/tutorial/ and the API documentation at http://developer.gnome.org/doc/API/ api-toc.html useful. You can find an introductory article on using LibGlade with Python at http: //www.linuxfocus.org/English/July2000/article160.shtml. Some useful books include: Beginning GTK+ and Gnome Programming by Peter Wright. 613 pages, published May 2000 by Wrox Press, ISBN 1861003811. Covers glib, Gtk+, and Gnome. Also covers Glade but rather skimpily. Suitable for the beginner. GTK+/Gnome Application Development by Havoc Pennington. 492 pages, published August 1999 by New Riders, ISBN 0735700788. Provides extensive coverage of the GTK+/Gnome APIs and is a good guide to getting up and started with Gtk+/Gnome. Developing Linux Applications with GTK+ and GDK by Eric Harlow. 512 pages, published February 1999 by MacMillan, ISBN 0735700214. Provides a basic introduction to using the GDK and GTK+ toolkits, but not the Gnome toolkit. Teach Yourself Gtk+ Programming in 21 Days by Donna Martin, et
322
Glade: GUI Builder
al. GTK+/Gnome Application Development by Havoc Pennington. Gnome/Gtk+ Programming Bible by Arthur Griffith. Linux Application Development by Michael K. Johnson, Erik W. Troan.
37.5
Acknowledgements
Glade was written by Damon Chaplin. The Glade home page (http://glade.gnome.org/) provides basic information, features list, download, links to the email discussion lists and related packages, and a list of the many applications developed using Glade. The Glade Reference Manual is being written by Michael Vance. Damon Chaplin has put together the Glade FAQ and Paul Drongowski has put together the Glade Turbo-Start guide. All three documents are available directly in Glade from the Help menu (only for the Gnome version of Glade at present but this may change).
37.6
Using Napster
FROM http://www.funky-penguin.co.uk/index.php Multimedia : Napster on Linux If you haven’t heard of Napster then you have been sitting in from of your Linux box staring at Emacs/vi (no arguments please). Napster is a file sharing system which can be used for pointing users towards other users who have the file the first user was looking for. The client that the user runs contacts the server and sends it a list of the files available for download, when a user does a search for a file the server searches through its database of users and files and gives the user a list of other users the file could be downloaded from. No files are stored on the server, it just acts a matchmaking system. The Napster system started as a client for Wintel systems, but the protocol was reversed engineer and many new clients and servers have been coded, many are open source.
37.6 Using Napster
323
There are plenty of Linux/BSD clients available we will cover gnapster in detail and I will run over some of the others. Gnapster as its name suggests is a gtk/Gnome client, clients also exist for the console and KDE. Gnapster (see bottom for download information) looks very much like the official Napster client but thats inevitable I suppose, it has full support for all download types, refinement of search based on bitrate/connection, able to browse a users mp3 collection, and has a nice implementation of the chat facilities of Napster. After you have downloaded an rpm, apt-got a deb or built from the tarball, the configuration of gnapster is extremely simple, you can create your account via the preferences dialog shown below.
Figure 37.1: Gnapster01 To create an account enter a username and password and ensure the new account option is selected. Select your connection type and where files you are willing to serve are stored and where you want files you have downloaded put, I have these put in a different directory from the rest of my collection. Before you close the window click ’Build mp3 list’ and a database of all the files in your upload directory will be recorded. When you have finished your configuration click ’OK’ and you will be able to connect to a Napster or Opennap server. The shot below shows a list of Napster servers you can connect to. The first time you login an account will be created for you. Using gnapster is extremely simple, after you have connected and read the
324
Glade: GUI Builder
Figure 37.2: Gnapster02
MOTD (Message Of The Day). Goto the seach tab and enter a search phrase, shortly a list of files matching your search will be displayed. Right click over the file you wish to download and select ’Dowload File’. You will notice that the text of the download tab goes white, this indicates something has changed whilst you are not looking at it. The download tab shows the files you are downloading and and the upload tab shows the files people are downloading from you. There are many cool features available in the download and upload sections which are beyond the scope of this document, have a fiddle and find out for yourself what they do. One area where I will go into detail is the console/chat section of the client. If you havent changed the default settings then when you connect you will automagically be dropped into the channel gnapster (shown below). You can join a channel using /join channel-name and leave a channel /part channelname. You can have multiple channel windows open and even chat with a person 1 to 1 using the /query username command. The chat system is very close to IRC and some other IRC commands are also supported /help gives you a full list. If the official Napster network has been closed down when you read this then dont worry as a network of interconnected Opennap servers is available for your use, your client will most likely provide you with a list of these.
37.6 Using Napster
325
Figure 37.3: Gnapster03
Figure 37.4: Gnapster04
326
37.7
Glade: GUI Builder
Gnome Hack
Gnome hack is a game that lets you have an adventure. First you choose who you want to be. You can be any character like an elf, wizard, caveman, knight etc. Then you read the history and your mission. Then you use the arrow keys to move your character. If you find something on the ground you go to the tool bar and then go to action and click on ‘get’. Sometimes jackal and bugs and gobiens can atak so you go to action if you don’t have any thing to throw go to ‘kick ’ if you do have something to throw then you go to ‘throw/shoot’ and then it will say ‘ in which direction ’[ when you pick up something it will have letter when you want to use your item press the letter after you click on what you want to do with it]
Chapter 38 Gnome: The Desktop Gnome is desktop for Unix and GNU/Linux delivering a high level of usability and interoperability. The Gnome Foundation, initiated in August 2000, brought together many of the major Unix vendors, including Sun Microsystems, IBM, HP and Compaq, to support the further development of Gnome. Sun, for example, has identified the Gnome desktop as the standard for Solaris, one of the most popular commercial versions of Unix. Gnome, an abbreviation for the GNU Network Object Model Environment, is a component-based system built around standards such as XML and CORBA. It offers a standard for look-and-feel and provides a platform for applications to share resources (like including graphics generated using the Guppi application in a spreadsheet within Gnumeric). While we refer to a common look-and-feel for Gnome there is much more. While all Gnome applications have the same look-and-feel, you can choose the look-and-feel (usually referred to as the theme) to suit your own style. The variety of different themes is extensive and includes themes that can make your desktop appear like MS-Windows or Apples Macintosh, to name just two. Once you choose a theme all of the Gnome applications will use that theme immediately. You can change themes (using the Toolbox) at any time. The theme used in this book is the Default theme that is similar to the HeliX theme but using a lighter grey in the background (and hence more suitable for the screen images used here). In this chapter we begin with the basics of the Gnome desktop and walk you though interacting with Gnome applications, including menus, toolbars and dialogs. This is followed by reference sections identifying Gnome applications. 327
328
38.1
Gnome: The Desktop
Using Menus
Menus in Gnome applications work in much the same way as other applications. The left mouse button is used to select a menu. You can either click the mouse button on the menu or else hold the mouse button down over the menu. In both situations the menu will stay until you make a choice or else click somewhere else on the window. Generally there are four types of menu items. The first have a right pointing arrow and lead to further sub-menus. The second type may have a small icon and some text followed by three dots. These items lead to dialogues that ask for further information. The third type also may have a small icon followed by some text but no dots. These items perform their action immediately on selection. Finally, some menu items represent options that can be turned on and off. All Gnome applications have at least a File menu and a Help menu. The File menu contains at least an Exit with keyboard shortcut to Ctl+Q. The Help menu contains an About item which opens a dialogue that identifies the application, author, version and date.
38.1.1
Tear-Off Menus
Gnome applications have tearable menus. That’s tearable menus, not terrible menus—menus that can be torn off and come up in a floating window of their own, and thus persist until you want to remove them. The menus that are tearable have an extra, and often overlooked, menu item: it is the first item in the menu and consists of a sequence of dashes. For example the figure on the right shows the bluefish HTML editor’s File menu after it has been torn off. Tear-off menus are useful to access common menu functions quickly. The original menu is still accessible. The menu can be removed by either selecting the first item again (the dashed menu item with the leading arrow) if it exists, or else simply by closing the window in the usual manner (usually the window’s rightmost button). Such tear-off menus are useful but their state is not recorded by the system so that next time you start up an application for which you have torn-off
38.1 Using Menus
329
menus this fact is lost and you will need to tear them off again.
38.1.2
Shortcuts
Menus will often have combinations of keys that can be used as a shortcut. These keyboard shortcuts will usually appear to the right within the menu itself as a reminder. The associated keyboard shortcut is usually a combination of keys beginning with Control or Alt. Pressing the specified key combinations has the same result as choosing the menu item. For example, if the Edit menu has a Cut choice with a keyboard shortcut of Ctl+X then holding down the Control key while you type the X key has the same effect as choosing the Cut menu item. Many shortcuts are in common usage amongst Gnome applications and will be familiar to users of the Win32 OS. These include: New Open Save Print Close Quit
Ctl+N Cut Ctl+O or F3 Copy Ctl+S Paste Ctl+P Select All Ctl+W Undo Ctl+Q Redo
Ctl+X Ctl+C Ctl+V Ctl+A Ctl+Z Ctl+R
Find Replace
F6 F7
A powerful feature is that you can choose your own shortcuts whenever you wish. To do this, simply move the mouse over the menu item whose shortcut you wish to redefine (or to define if it currently does not have one) and type the keyboard shortcut you wish to associate with that menu item. For example, to map Cut to Shft+Ctl+Alt+X simple move the mouse to the Cut menu item and press all four keys at the same time. This is probably not a very useful binding, but it’s unlikely to be used for anything else, so it’s a save choice to play with! Note that if the new shortcut previously was associated with another menu item, the previous binding is lost. If you use Shft+X as a shortcut it will be accepted but may not be useful. If the context is a text editor then Shft+X will be captured to capitalise the x rather than passed on as a shortcut. Other combinations involving the Shft key work just fine, such as Shft+Alt+X and Shft+Ctl+X. Some applications (e.g., nautilus) automatically save your shortcuts so that next time they will appear. Others (e.g., bluefish) provide an option for you to save them if you decide they are suitable. Finally, some shortcuts might be identified by the applications as immutable
330
Gnome: The Desktop
so that you are not able to re-bind them.
38.2
Toolbars
38.2.1
Floating Toolbars
Toolbars (and menubars) can float. The left end of each toolbar and menubar contains a raised dotted image like that above. By placing the mouse over it and holding the left mouse button down you can drag the toolbar to wherever you like before releasing the mouse button. Unlike floating (or tear-off) menus a floating toolbar or menubar does not remain in the main window. You will have at most just a single instance of a toolbar. A toolbar or menubar can be returned to the parent window simply by dragging it back there. You can even drag the toolbars to the bottom of the parent window if that’s where you like them to be.
38.3
Dialogues
38.3.1
Filename Completion and Hidden Files
When prompted to load or to save files the dialog does not show any hidden directories (those beginning with a period). To get them displayed, simply enter a period in the Selection text field and press TAB.
38.4
Gnome Applications
There are many Gnome applications freely available either from the Internet or else available for purchase from distributors. We identify here a selection
38.4 Gnome Applications
331
Figure 38.1: Toolbars and menubars can often be torn away from the main window or even located elsewhere within the main menu. Here, the dia application menubar is moved to the bottom of the main window and then out of the window altogether.
of these applications, sorted by category. Many of these applications are documented in this book.
File Managers • nautilus: See Chapter 61. • mc
HTML Editors See Chapter 45. • bluefish: See Section 45.1. • quanta. • screem.
332
38.4.1
Gnome: The Desktop
Other Applications
Personal Information Managers evolution Web Browsers galeon Email Clients banksia balsa spruce grin News Readers pan Word Processing abiword staroffice Spreadsheets gnumeric Presentation Tools presentation Graphics Tools dia gimp gnuplot
38.4 Gnome Applications imagemagick sketch xfig sane gphoto eog gqview xzgv Music grip gnapster Finance gnucash Database Management
333
334
Gnome: The Desktop
Games gnomehack memblocks Educational gperiodic ghemical
38.5
Desktop Managers
Gnome (http://www.gnome.org) is a Desktop and Session Manager. Sawfish (http://sawmill.sourceforge.org) is a Window Manager. KDE (http: //www.kde.org) is a Gnome alternative and WindowMaker and Enlightenment are alternatives to Sawfish. The LBX (Low Bandwidth X) server extension is useful for increasing the responsiveness of remote X applications. Remote Emacs windows are now being delivered to my desktop over a 33 K connection at about 3 times more quickly! (Also more quickly than my LBX connection from MS-Windows/NT using Exceed!)
38.6
Window Managers
There is an enormous variety of window managers for the X Window System. A good index of window managers and desktop enviroments under the X Window System can be found at http://www.plig.org/xwinman/.
38.7
Other Desktops
Both Gnome and KDE provide a desktop environment and an application development framework. A desktop environment usually consists of a window manager, task bar, and perhaps a file manager and documentation browser. A development framework provides libraries and a GUI toolkit for application development.
38.7 Other Desktops
335
Applications like WindowMaker, and Enlightenment are desktop environments which tend not to provide development frameworks. They do, however, tend to provide session management. While you can use these with desktop environments like Gnome and KDE their functionalities sometimes overlap, and may even conflict.
38.7.1
KDE
The one thing that significantly held back the wide acceptance of the excellent KDE desktop was the fact that it used the QT+ toolkit for its graphical user interface development. For many years this toolkit did not meet the requirements of the General Public License (GPL) and so could not legally be included in many distributions. Indeed, because of this the Gnome project was begun. By September 2000 when it was announced that the new version of QT+ (2.2) would be released under the GPL Gnome was already catching up to KDE in its development and many of the major Unix players had decided to adopt Gnome. Nonetheless, KDE remains a good alternative to Gnome providing a collection of well developed applications. It should be noted though that all of these applications can run under any desktop, including Gnome (but perhaps losing some functionality such as drag-and-drop between applications). And, conversely, Gnome applications can also run under KDE. The significance of the desktop is the look and feel of the associated applications and underneath how they inter-operate. Otherwise they are simple X Window System applications and can run whether you are running the corresponding desktop application or not. We will review some of the KDE applications as alternatives to the related Gnome application in the relevant chapters of this book.
38.7.2
XFCE
The aim of XFCE is to provide a simple and very small desktop requiring minimal resources but providing a sufficient feature set for the genral user. Xfce is actually based on the GTK+ toolkit as is the Gnome desktop.
336
Gnome: The Desktop
38.8
Troubleshooting
38.8.1
Locked File
If you have your home directory NFS mounted and log onto Gnome multiple times, make sure ORBIT can talk TCP/IP to communicate with your other gconf daemons. To enable this uncomment the following line in /etc/ orbitrc: ORBIIOPIPv4=1
Restart gconf with: $ gconftool-2 --shutdown
38.9
Gnome Resources
38.9.1
Gnome Books
Mastering Gnome by Bryan Pfaffenberger. 880 pages, published December 1999 by Sybex, ISBN 0782126251.
Chapter 39 GnuCash: Finances This software might be useful for running a business.
337
338
GnuCash: Finances
Chapter 40 Gnumeric: Spreadsheet From humble beginnings the spreadsheet has become one of the most useful tools on the computer desktop. Serving very many different purposes, all essentially dealing with numbers, spreadsheets provide a platform for tabulating numbers and automatically peforming operations on those numbers. Spreadsheets today provide a comprehensive array of functions for all kinds of purposes, together with impressive graphical reporting facilities. The Gnome desktop supplies the gnumeric spreadsheet modeled on Excel. When you start gnumeric for the first time you will get an empty spreadsheet ready for your to work with, as in Figure 40.1.
Figure 40.1: Initial gnumeric screen with an empty spreadsheet.
A simple spreadsheet is used to illustrate the basic functionality of gnumeric. 339
340
Gnumeric: Spreadsheet
The spreadsheet acts as a simple timesheet to monitor time spent on particular tasks and to keep an accumulated total earned. You might imagine your child keeping track of their pocket money!
Figure 40.2: A simple gnumeric spreadsheet illustrating thew basic operation of the spreadsheet.
The Gnumeric spreadsheet is part of the Gnome desktop environment: a project to create a free, user friendly desktop environment. As every other component of Gnome, Gnumeric is free software (Some other people like to call this OpenSource software) and it is licensed under the terms of the GNU GPL. Gnumeric will import your existing Excel, 1-2-3, Sylk, XBase and Oleo files. If you are a developer and you want to contribute new importers (or polishing and perfect existing importers) we welcome your patches. Gnumeric is intended to be a replacement for a commercial spreadsheet, so a lot of effort and work has still to go into it, but I believe we have the right framework to do it.
40.1 Other Spreadsheets
Figure 40.3: Sample Gnumeric screen
40.1
Other Spreadsheets
40.1.1
The StarOffice Calc
40.1.2
KSpread
40.1.3
ApplixWare Spreadsheet
341
342
Gnumeric: Spreadsheet
Figure 40.4: Sample Calc from StarOffice
40.1 Other Spreadsheets
Figure 40.5: Sample Calc from StarOffice
343
344
Gnumeric: Spreadsheet
Chapter 41 GQView: Viewing Images You can use gqview for presentations where your presentation is a collection of images (one image for each slide!). Click the button to go to full screen.
Figure 41.1: Sample gqview screen.
345
346
GQView: Viewing Images
Chapter 42 Graphics Graphics packages available include: • eog: Eye of Gnome • gthumb: A graphics file browser that displays thumbnail images. Also see R and Python for other graphics information.
42.1
Graphics Editors
Graphics editors include:
• gimp: The GIMP is an Adobe PhotoShop equivalent for sophisticated image manipulation and graphics creation. It is one of the most respected GNU/Linux tools. See Chapter 36 for details. • sodipodi: Edit SVG (Scalable Vector Graphics) figures. • xfig: A older, but very versatile and powerfull vector graphics editor. Highly recommended. 347
348
42.1.1
Graphics
Xfig: Vector Graphics Editor
With xfig figures are drawn using objects such as circles, boxes, lines, spline curves, and text. Images can be imported, supporting formats such as gif, jpg, and eps. Xfig saves its figures in its native Fig format that may be converted into various formats such as eps, gif, and jpg Other applications can produce output in the Fig format, including gnuplot and xgraph, both of which can generate graphs direct from the corresponding data. Alternatively, pstoedit can generate input suitable for editting with Xfig.
Figure 42.1: Xfig is an older Unix-based vector graphics tool. It has been quite popular and although its interface is showing signs of its age, it remains a useful and powerful vector graphics editor.
42.2 Common Operations
42.2
Common Operations
42.2.1
Charts and Plots
349
Many fine packages provide plotting capabilities. See Chapter 73 for plotting capabilities in the R statistical package. Gnuplot Examples using gnuplot: gnuplot> gnuplot> gnuplot> gnuplot> gnuplot> gnuplot> gnuplot> gnuplot> gnuplot> gnuplot>
plot [0:1] (1-x)/x, log((1-x)/x) set log y plot [0:1] (1-x)/x, log((1-x)/x) set nolog y set terminal svg set output "log1mxox.svg" plot [0:1] (1-x)/x, log((1-x)/x) set terminal postscript eps enhanced set output "log1mxox.eps" plot [0:1] (1-x)/x, log((1-x)/x)
GDChart This charting toolkit with bindings for Python is available from http:// athani.pair.com/msteed/software/gdchart/. However, for sophisticated plotting the R statistics package is recommended, particularly through it’s Python interface RPy. See Chapter 73. Some of the required packages include: python2.1-dev zlib1g-dev libpng2-dev libjpeg62-dev. Installation is straightforward. (Note that there is not currently a Debian package for python-gdchart so need to compile and install it. The installation is in /usr/local because of this.) $ wget http://athani.pair.com/msteed/software/gdchart/gdchart-py-0.6.tar.gz $ tar zxvf gdchart-py-0.6.tar.gz $ cd gdchart-py-0.6
350 $ $ $ # # # #
Graphics perl -pi -e ’s|local/include/python2.0|include/python2.1|’ Makefile make su cp gdchart.so /usr/local/lib/python2.1/site-packages/ chown root.staff /usr/local/lib/python2.1/site-packages/gdchart.so chmod o+rx /usr/local/lib/python2.1/site-packages/gdchart.so exit
Ggobi The Debian ggobi package is a GTK+ version of xgobi, an interactive dynamic data visualisation program. There is a Python interface to ggobi. However, for sophisticated control over the generation of plots and graphs, see the R statistics package (Chapter 73), particularly with its Python interface RPy (Section 72.2.2).
42.2.2
Screen Capture
At times one comes across the need to capture the screen. That is, to save what you see on your display, or in a window on your display, into an graphics file. Perhaps you want to impress your colleagues with how you’ve managed to settle upon a wonderful combination of Gnome and Sawfish themes (Section 87).
Gnome Screen-Shooter An excellent solution is the Gnome Screen-Shooter applet. This little applet sits in your gnome panel and is ready to take a snat at your whim.
Using ImageMagick Try imagemagick with screenshot...I think or something like that ...its part of the Gnome desktop environment
42.3 Conversions
351
Using xv
42.2.3
Thumbnails
Webmagick builds HTML and imagemap graphics of collections of graphics. Gthumb browses thumbnails of graphics, as does nautilus.
42.2.4
Transparent PNG Images
Suppose you have a PNG graphics file that you want to place on your web page but its background is white, whereas your web page is blue. Make the PNG background transparent with:
$ convert -transparent white example.png exampleT.png
42.3
Conversions
Using the imagemagick package:
$ convert -page a4 *.jpg pages.pdf
42.3.1
PostScript
A useful tool for converting from PostScript to other editable formats (including vector formats like fig and svg) is pstoedit. To convert from PostScript to XFig placing the output into example.fig: $ pstoedit -f fig example.ps
To convert from PostScript to SVG placing the output into example.svg: $ pstoedit -f plot-svg example.ps
352
Graphics
EPS to Encapsulated PDF Use: $ epstopdf image.ps
Strip Excess Postscript Border Some applications (e.g., Splus) seem to place extra white space around the encapsulated PostScript that they generate. This is a problem when importing into other packages, such as LaTeX. A simple solution is: $ ps2eps < original.eps > new.eps
This determines an accurate bounding box and trims the image to that box.
Chapter 43 Grip: CD Audio Extraction Debian Pacakges: Package[]grip Recording an audio CD to your hard disk allows you to listen to your music (which you have presumably purchased in order to listen to) without having to tie up the CD-ROM drive. To do this first extract the tracks from your audio CD (they are WAV files). These will take up to 600MB for each CD, quite a bit of hard disk storage, especially if you have a large CD collection. This is where MP3 and OGG come in. A 600MB audio CD can be encoded as a 50MB OGG file, allowing the storage of the equivalent of 12 WAV CDs in the space of a single DATA CD with OGG. Debian provides grip to handle this process for you. Grip is able to obtain information about your CD from the Free CD Database automatically over the web. This information includes the tack details and is displayed under the Tracks tab (see Figure 43.1). You may need to ensure the configuration for the Free CD Database server is set up—see Figure 43.2 for an example configuration. If the CD information is already available locally (because grip or some other CD utility has previously updated the database of disks in ~/.cddb) then it will be displayed. The process of reading the WAV tracks from an audio CD is called ripping. A popular GNU/Linux ripper is cdparanoia and Grip includes cdparanoia so you do not need to install the package separately. Also supported are the separately installed rippers cdparanoia and cdda2wav. See Figure 43.3 for an example configuration. The process of converting the WAV encoding to OGG is called encoding 353
354
Grip: CD Audio Extraction
Figure 43.1: grip-tracks
Figure 43.2: Here grip is configured to query the Free CD database server to find information about the CD. If this query fails then the non-free database is searched. If the CD information is found in the non-free database and not in the free database you will given the opportunity to update the free database with the information.
355 and again there are many alternatives. For MP3 encoding supported Debian packages include lame, bladeenc, l3enc, xingmp3enc, mp3encode, and gogo. The lame encoder is a good choice. Once again, see Figure 43.3 for an example configuration.
Figure 43.3: Configuring grip is straightforward. This setup uses cdparanoia to read the Audio CD data and lame to convert the resulting WAV files to MP3. Note also that a track number (%t) has been added to the file name.
Grip will rip and encode a CD in separate processes allowing the encoding to happen while the next track is being ripped. Now we are ready to rip and encode an audio CD. Insert your CD into the CD-ROM drive. The Tracks tab should list the available tracks. If what you get is a list like that in Figure 43.4 then for some reason the information is not available (probably because you are not connected to the internet or the CD is not know to the databases). In this case, enter the information yourself. This is useful because the information is then recorded in the MP3 file as the ID3 tag. This is used by various MP3 players to display track information. To enter the information yourself click on the Toggle disk editor button (the pencil icon along the bottom row of buttons). This will open up an area for you to enter the relevant information (see Figure 43.4). Once you have enetered the information be sure to share it by clicking on the Submit disc info button with the letter icon.
356
Grip: CD Audio Extraction
Figure 43.4: Grip is unable to find the information for this disk.
357 Next select the tracks you wish to encode. Click in the Rip column heading to select all tracks. Go to the Rip tab and click on the Rip+Encode button. Sit back and wait. This process takes quite a while and is quite resource intensive (so your games may be slow while you wait). The progress bars on the Rip tab show how things are going. For each CD a playlist is created in ~/mp3 and for each track two files are created, usually somehwhere in ~/mp3 as well, depending on the settings in Figure 43.3. You set the location of the playlist in the Config tab under MP3 Options (where you can also tell grip to automatically delete the temporary WAV files). The playlist is identified as an M3U file. The example configuration places both the temporary WAV file and the MP3 file in ~/mp3/\%a/\%d/\%t.\%n.wav and ~/mp3/\%a/\%d/\%t.\%n.mp3 respectively. That is, a folder is created having the same name as the artist (%a), and a sub-folder of this having the disc name (%d). Into this sub-folder all of the tracks are stored with names consisting of track number (%t) and track name (%n). So, for example, you might have: ~/mp3/pink_floyd/a_saucerful_of_secrets/04.corporal_clegg.mp3
This scheme works quite nicely but of course use whatever scheme suits you. If there are problems accessing the CD make sure /dev/sg0 has the correct permissions: # ls -l /dev/sg0 crw------1 root root 21, 0 Mar 15 # chgrp cdrom /dev/sg0 changed group of ‘/dev/sg0’ to cdrom # chmod g+rw /dev/sg0 mode of ‘/dev/sg0’ changed to 0660 (rw-rw----)
2002 sg0
358
Grip: CD Audio Extraction
Chapter 44 Groups: Managing Access Permissions Every file and folder in a GNU/Linux system belongs to a group. Each user is also a member of a group. Groups are used to control collections of users who may have access to particular files and folders. A Debian GNU/Linux system creates some standard groups and users. The system administrator can also create new users and may also create new groups. Groups can be managed using the Gnome users-admin tool, accessed from Applications→System Tools→Users and Groups. By default this shows only users, but you can access groups by selecting the More Options button. This allows you to add new groups and to add and remove users from groups.
Figure 44.1: Gnome interface for managing GNU/Linux groups.
We list below the standard groups and users, but the reader is referred to /usr/share/doc/base-passwd/users-and-groups.html for further details.
359
360
Groups: Managing Access Permissions
Group root daemon bin
gid 0 1 2
sys
3
adm
4
tty
5
disk
6
lp
7
mail
8
news
9
uucp proxy kmem
10 13 15
dialout
20
fax voice cdrom
21 22 24
Description This is root’s primary group. A group for non-root daemons. This group exists for historical reasons and some programs won’t run without it. This group exists for historical reasons and some programs won’t run without it. Most of the log files (in /var/log) are group readable by users who belong to his group. You can add users who need to monitor such log files to this group. Note though that sometimes private information can be accidentally included in logs, like passwords when connecting via PPP over a Modem. This should not happen (the scripts that write the logs should identify these as not being echoed) but the potential for mistakes is there. The terminal devices with names beginning with /dev/ tty are group accessible to group tty. Programs such as write and wall need access to /dev/tty and they set their group id (sgid) to tty. The disk device nodes are group accessible to disk so that programs that need access to them are sgid disk. Jobs associated with the lp (printer) daemon (lpd) are group accessible to the lp group so that lpd can access them without being root. mailbox spool directories belong to group mail, MUA software runs setgid mail. This makes dot locking possible. Also, mailboxes must be writeable by group mail (Policy Manual, 3.1.1.1, 5.6). standard group for user news. Why does news have its own group, and many of the other daemon uids don’t? uucp jobs are group accessible to uucp. web cache files are group accessible to proxy. /proc/kmem is group accessible to kmem. Programs that need access are sgid kmem. ppp- and isdn device nodes are group accessible to dialout. Include users allowed to initiate dialout in this group. fax jobs are group accessible to fax. voice messages are group accessible to voice (vgetty)
361 floppy tape
25 26
sudo audio
27 29
dip
30
majordom
30
postgres
32
www-data
33
backup msql
34 36
operator list irc
37 38 39
src
40
gnats
41
shadow
42
utmp
43
video staff
44 50
for device nodes. Include users allowed to access these in the appropriate groups. for device nodes. Include users allowed to access sound in this group For daemons running under their own uid/gid. Why are these static? For daemons running under their own uid/gid. Why are these static? For daemons running under their own uid/gid. Why are these static? This has been discussed in the past, and the discussion is not finally finished. Today, www data files belong to this group and the web servers run with that group, thus being able to write the files. This has been considered a security hole, but was not yet changed. For daemons running under their own uid/gid. Why are these static?
For daemons running under their own uid/gid. Why are these static? This group is intended for users who need to access source code, including files in /usr/src. Users in this group can thus manage system source code. Also, this group is the default group for access to the CSV repository in /var/lib/csv. For daemons running under their own uid/gid. Why are these static? Programs that should be able to access the shadow passwords are sgid shadow. Programs that should be able to access utmp are sgid utmp. This group is used to control access to /usr/local. Add users to this if they should be able to write to /usr/ local and /var/local.
362 games qmail users
Groups: Managing Access Permissions 60
games that store user independent high score values in /var/lib/games are sgid games 70 used for qmail 100 All users belong to this group. Place files that all users should have access to in this group.
Chapter 45 HTML Editors HTML editors include bluefish, screem and quanta. Bluefish is the standard Gnome editor.
45.1
Bluefish
Editing HTML (and indeed any type of XML document) is supported through bluefish, a purpose built editor based on the Gnome edit toolkit. Bluefish is described as a programmer’s HTML editor because it is not a graphical editor (in that you work directly with the mark-up, i.e., the actual HTML tags, rather than with how the final page might look, as with Netscape Compser). Features include a multiple file editor, multiple toolbars, custom menus, image and thumbnail dialogs, open from the Web, CSS dialogs, PHP, SSI and RXML support, HTML validation, and many wizards. Figure 45.1 shows the basic interface editing a simple HTML document. Syntax highlighting has been turned on under the View→Highlight syntax menu. You may also need to initialise a set of highlighting patterns with Options→Lists→Reset syntax highlighting. You can refresh the highlighting with View→Refresh highlighting or else F5. When you are ready to see what your marked up document will look like in a browser simply select View→Preview or use the F4 keyboard shortcut.
363
364
HTML Editors
Figure 45.1: Bluefish HTML Editor with syntax highlighting enabled.
Chapter 46 ImageMagick ImageMagick is the tool for transforming images. The command line mogrify is excellent for changing the size of an image. mogrify -geometry does that, maintaining the image’s aspect ratio (the specified width and height are maximum values) append the geometry with an exclamation point to force a change to aspect ratio. Rotate an image with -rotate Reduce the colors in an image: mogrify -colors 2 filename To also dither the image: mogrify -colors 4 -dither filename Monochrome image: mogrify -monochrome filename Annotate image: mogrify -comment ’Hi there’ filename Add borders to image (pixel width and height): mogrify -border 2x4 filename Decorative border: mogrify -frame 20x20 filename
365
366
ImageMagick
Chapter 47 Initialisations on Booting The Debian GNU/Linux kernel loads init very early on in the boot process, using /etc/inittab as its configuration file. This file defines the default run level and what should be done for each run level. If you have a look at the processes running on your system (with the command line ps or with the graphical Gnome utility gtop) you will see that the init process has process identifier of 1 (unless you are running a more secure GNU/Linux where random numbers are assigned to the processes). The initialisation table (/etc/inittab) is where system initialisations occur. This table consists of records with four fields separated by a colon: id:runlevels:action:process
The first field is an identifier. The second lists the runlevels for which this record is relevant. The third is the action to be performed. The fourth is the command to be run. In this chapter we look at how the GNU/Linux system is initialised. See Chapter 13 for an explanation of the boot process and how to control booting.
47.1
Run Levels
The runlevel is an identifier for each of the different states in which the GNU/Linux operating system can be running, such as in single user mode, 367
368
Initialisations on Booting
multi-user mode, and halt and reboot modes. Generally a GNU/Linux system is running in multi-user mode. The first script run by init, after booting into GNU/Linux, is /etc/init. d/rcS. The initialisation files for the default run level (usually 2) are then run. This is specified in /etc/inittab with the line: l2:2:wait:/etc/init.d/rc 2
This runs /etc/init.d/rc with the parameter 2. The /etc/init.d/rc script in turn runs the scripts in /etc/rc2.d/ (since the parameter 2 indicates rc2 as opposed to rc3, etc). The default runlevel is runlevel 2, unless you change it in /etc/inittab: # The default runlevel. id:2:initdefault:
In general the runlevels 2, 3, 4, and 5 are all multi-user run levels and Debian sets them up to be the same. # # # #
Runlevel 0 is Runlevel 1 is Runlevels 2-5 Runlevel 6 is
halt. single-user. are multi-user. reboot.
l0:0:wait:/etc/init.d/rc l1:1:wait:/etc/init.d/rc l2:2:wait:/etc/init.d/rc l3:3:wait:/etc/init.d/rc l4:4:wait:/etc/init.d/rc l5:5:wait:/etc/init.d/rc l6:6:wait:/etc/init.d/rc
0 1 2 3 4 5 6
Thus, when the system enters a runlevel it executes the scripts in /etc/rc.n where n is the runlevel in question. These scripts are in fact symbolic links (symlinks) to scripts in /etc/init.d/. A script starting with S starts a service. One starting with K stops a service. The number after the ‘S’ or ‘K’ specifies the order in which the scripts are run. For example, S25xdm will start before S35xdm.
47.2 Initialisation Scripts
369
To stop xdm, for example, from starting up by default on boot, simply remove the symbolic link of the corresponding ‘S’ script from /etc/rc?.d/S*xdm. See the man page for init for an extensive discussion. The init script is run with ”start” on changing runlevel (S) and runlevels 0 (the halt runlevel) and 6 (the reboot runlevel). To remove something (e.g., gdm) from the init scripts: # update-rc.d -f gdm remove
47.2
Initialisation Scripts
A collection of initialisations are performed through running the script /etc/ init.d/rcS as specified in the initialisation table (/etc/inittab) with the line: si::sysinit:/etc/init.d/rcS
The particular initialisations are performed through scripts located in the /etc/rcS.d/ folder. The names of these scripts are all of the form SNNmmmm where NN is numeric and mmmm is the name of some Debian package or application, such as setserial and hwclock. For example, you may find /etc/rcS.d/S30setserial and /etc/rcS.d/S50hwclock.sh. The script /etc/init.d/rcS will ensure all of these scripts are run, one after another, in numeric and alphabetic order. Order is often important. Any script ending with .sh is sourced as a shell script and the others are run as commands. Irrespective of how the script is invoked it is passed the parameter start indicating that the service that the initialisation script represents is to be started in some sense. This is the meaning of the single S in the scrip file names and in the name of the rcS script. You can add your own scripts into /etc/init.d/ folder and then link them appropriately to the particular run level directories. The update-rc.d command should be used to do this for you. Suppose you want to set up a firewall each time you boot the machine. You may create an executable script file called /etc/init.d/myfirewall (see Section 62.8 for sample contents). Then add this to the appropriate folders with:
370
Initialisations on Booting
# update-rc.d myfirewall start 40 S . stop 89 0 6 .
This creates the following symbolic links: /etc/rc0.d/K89myfirewall -> ../init.d/myfirewall /etc/rc6.d/K89myfirewall -> ../init.d/myfirewall /etc/rcS.d/S40myfirewall -> ../init.d/myfirewall
47.3
CTRL-ALT-DEL: The Three Finger Salute
The infamous CTRL-ALT-DEL of the MS-Windows world (to reboot or shutdown your computer) is enabled by default under Debian. It is the following line in the initialisation table that enables this: # What to do when CTRL-ALT-DEL is pressed. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
Thus, the ctrlaltdel action is enabled for runlevels 1, 2, 3, 4, and 5. If you want to disable the CTRL-ALT-DEL salute then simply comment out this line (by inserting a hash).
47.4
Terminals
There are six terminals enabled by default in Debian. This means that when you boot the machine you will have one terminal where you see the boot messages and eventually the login prompt (unless you are using a windowbased login such as gdm). This terminal is controlled as the device /dev/ tty1. By default there are five others: /dev/tty2. . . /dev/tty6. The entries in the initialisation table responsible for running the appropriate application to control each of these terminals are: # Format: # ::: 1:2345:respawn:/sbin/getty 38400 tty1 2:23:respawn:/sbin/getty 38400 tty2 3:23:respawn:/sbin/getty 38400 tty3
47.4 Terminals
371
4:23:respawn:/sbin/getty 38400 tty4 5:23:respawn:/sbin/getty 38400 tty5 6:23:respawn:/sbin/getty 38400 tty6
We can see that only the terminal on tty1 is initiated for all user run levels (2, 3, 4, and 5). The others are initiated only for run levels 2 and 3. To get more than the default six terminals add additional getty entries and inform the init daemon with: # telinit q
A total of 256 terminals are available with a default kernel. There are 64 virtual consoles available. More terminals can be provided for in the kernel by recompiling the kernel with different options. Note that exporting a serial console is in the default init script. This is particularly handy for Palms and similar handheld computers as a system rescue option. You can move to any of the consoles using left Alt-F1 to left Alt-F6 or left Ctl-Alt-F1 to left Ctl-Alt F6. You can also move between the consoles with Alt-Left and Alt-Right. If you have more that 12 virtual consoles (hence you run out of function keys for Ctl-Alt) you can access them directly with Alt-F1 (for console 13) etc. If you are running one of the X Window System display managers (i.e., you are presented with a graphical log on screen) such as gdm then this is usually running on virtual terminal 7 which you can access with Alt-F7. Note that X captures the Alt key so you will need to use Ctl-Alt-F1 to switch to virtual console 1.
372
Initialisations on Booting
Chapter 48 Java Debian can not distribute Sun’s Java because of Sun’s licenses which do not meet the Debian Free Software Guidelines. This is a problem since Java is such a widely used Internet language. However, you can manually install the Sun Java software development kit yourself, as long as you are happy to accept the Sun Java license. Alternatively, install one of the alternatives like kaffe.
48.1
Install Sun Java
Obtain j2sdk-1\_4\_2\_03-linux-i586.bin (this is the J2SE kit) from http://java.sun.com. It is a 34MB file so over a modem that could be 3 hours or so! Save the file into /usr/local/bin to save creating new paths. Then # sh j2sdk-1_4_2_03-linux-i586.bin
To accept the license type yes and the installation will begin. This will create a new directory in /usr/local/bin with the name j2sdk1.4.2 03. Now create the necessary links: # ln -s /usr/local/bin/j2sdk1.4.2_03/bin/* /usr/local/bin
To confirm it is installed: > java -version
373
374
Java
If there’s a problem it might be protections: # chmod -R go+rX j2sdk1.4.2_03
48.2
Java Alternatives
Version 1.3 might be at: ftp://ftp.tux.org/pub/java/debian/dists/. Alternatives include:
deb ftp://ftp.informatik.hu-berlin.de/pub/Java/Linux/debian woody non-free deb http://www.mirror.ac.uk/sites/ftp.blackdown.org/java-linux/debian woody non-f
The package is named j2sdk1.3 The Blackdown Java 2 Runtime Environment package (j2re1.3) is also available from:
deb ftp://metalab.unc.edu/pub/linux/devel/lang/java/blackdown.org/debian woody no
Java 2 Runtime Environment 1.4 (j2re1.4) is available from: deb ftp://ntama.uni-mainz.de/pub/debian unofficial/
The Debian Java FAQ is available from http://www.debian.org/doc/manuals/ debian-java-faq/.
48.2.1
Mozilla Java Plugin
Currently it is not possible to use a free Java Virtual Machine as a Mozilla plugin! This is because most of the free JVMs do not currently support the Java AWT (Java GUIs). So the non-free alternatives from Sun, IBM, or Blackdown are required. To get the Java plugin running with an installation of j2sdk1.4.2 03 (from Sun and installed as described in Section 48.1) for Mozilla 1.5, link the appropriate library to the mozilla plugin directory:
48.2 Java Alternatives
375
# cd /usr/lib/mozilla/plugins # ln -s /usr/local/bin/j2sdk1.4.2_03/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
Then run Mozilla and visit about:plugins to ensure the plug in is found. Old Recipes An older recipe for installing a Java plugin for the then new version of Mozilla (e.g., 2:1.3.1-3) which was compiled with gcc 3.3 was: $ $ $ $ $ $ $ $
mkdir j2sdk-1.4.1-01-linux-i586-gcc3.2 cd j2sdk-1.4.1-01-linux-i586-gcc3.2 wget ftp://ftp.easynet.be/blackdown/JDK-1.4.1/i386/01/j2sdk-1.4.1-01-linux-i586-gcc3.2.b wget http://twolife.free.fr/debian/j2se1.4-i586_1.4.1.0.1-4.diff patch -p1 -i j2se1.4-i586_1.4.1.0.1-4.diff debuild -uc -us cd ../ wajig install j2re1.4_1.4.1.0.1-4_i386.deb
Then visit the URL about:plugins to ensure it is recognised. Another approach was to leave it to Mozilla to download a Java Plug-in: As root start up Mozilla. Enable Java (Edit->Preferences->Advanced->Java) Visit a java page (http://datamining.csiro.au/ssh) Auto install the plug in. As root: cd /usr/lib/mozilla/plugins (make sure appropriate link exists) chmod -R go+rX java2 As user browse to "about:plugins".
Another, essentially same, recipe is: ftp://ftp.netscape.com/pub/netscape6/english/6.01/unix/linux22/xpi/jre.xpi # unzip jre.xpi -d $MOZILLA_FIVE_HOME/plugins ’jre-image-i386/*’ # cd $MOZILLA_FIVE_HOME/plugins # ln -s jre-image-i386/plugin/i386/ns600/libjavaplugin_oji.so .
376
Java
Chapter 49 Jigdo: Build CD-ROM Images Install jigdo-file To build snapshot of sid distribution:
$ jigdo-lite ftp://ftp.fsn.hu/pub/CDROM-Images/debian-unofficial/sid/jigdo/sid-i386-1.is ftp://mirror.aarnet.edu.au/pub/debian/ ftp://mirror.aarnet.edu.au/pub/linux/debian-non-US/
377
378
Jigdo: Build CD-ROM Images
Chapter 50 KDE: Desktop Management KDE is a popular alternative to Gnome. I don’t use KDE so there’s not a lot I can say about it. Feel free to contribute. Various KDE applications are described in this book, in limited detail. See Chapter 56 for Magellan, the KDE personal information manager, and Chapter 53 for Konqueror for the KDE file manager.
379
380
KDE: Desktop Management
Chapter 51 Kernel: Rolling Your Own Compiling your own Linux kernel may sound like a pretty scary task. Take a deep breath and “enjoy the experience.” It is actually not such a big thing to compile your own kernel. And Debian makes it even more straightforward by supplying the kernel-package to leave you with a kernel-image package that you simply install, just as you would any kernel-image package you might get from Debian. The advantages of compiling your own kernel include being able to tune the kernel to your specific hardware, and ending up with a smaller kernel. You may also need to compile your own kernel if the default kernel does not support some specific hardware you have. The distributed kernels though are becoming modular and it is becoming rare that you would need to compile your own kernel. If you do though, the recipe here should help and the introduction to compiling your own kernel at http://newbiedoc.sourceforge. net/tutorials/kernel-pkg/index-kernel-pkg.html should prove a useful read. The hardware we review in this book has occasionally required kernel compiles. For example, Bartok (Section 5.9.19) contains over 1GB of memory but the supplied kernels limit to less than 1GB (NOHIGHMEM). Mint (Section 5.9.27) had a specific kernel compiled for it with sound support through ALSA, IDE SCSI emulation support for CDRW, and with PPP and IPMASQ support. Velox (Section 5.9.26) had a kernel compiled with sound support through ALSA, IDE SCSI emulation support for CDRW, and support for dual processors. Some sample compiles of the kernel are included with specific installations in 381
382
Kernel: Rolling Your Own
Section 5.9. See Section 5.9.19 for an example of compiling kernel 2.4.16 with extra memory support (HIGHMEM) and multiple CPU support (SMP). See Section 5.9.15 for an example of obtaining the linux kernel source (kernel 2.4.19) directly and compiling it the Debian way for Bach (Section 5.9.15). See Section ?? for an example of obtaining the linux kernel source (kernel 2.4.19) and patching it with a pre-release (2.4.20-pre11) and compiling it the Debian way for Vivaldi (Section 5.9.12).
51.1
Getting Started
The first step is to install the appropriate packages: bin86 kernel-package kernel-source-2.4.16 debconf-utils alsa-source-0.5 pcmcia-source
(if you need ALSA’s extra sound support)
For the particular release of Debian being used the version numbers will be different. The kernel-package provides tools to generate, from the compiled kernel image, a genuine Debian package that you simply install as a standard type package. The resulting package can be installed (and uninstalled) cleanly and correctly with dpkg and wajig. Note that you do not need the kernel-headers package as all the headers required are in the kernel-source package. The headers were split out for other reasons (compiling other packages without installing all of the kernel sources). Installing the kernel-source package simply places the archived kernel source file (kernel-source-2.4.16.tar.bz2) into /usr/src. Similarly for any kernel modules you wish to also install (like alsa). Extract the actual source code into /usr/src/kernel-source-2.4.16: # # # #
cd /usr/src tar jxvf kernel-source-2.4.16.tar.bz2 tar zxvf alsa-driver-0.5.tar.gz tar zxvf pcmcia-cs.tar.gz
51.2 Kernel Configuration
383
You can also obtain a more recent (or even just any different) version of the kernel from the net yourself and still use the Debian kernel-package utilities.
51.2
Kernel Configuration
The next task is to configure the kernel to suit your setup. There are very many configuration options and most can be ignored. Each also has a brief but helpful piece of documentation in /usr/src/linux/Documentation/ Configure.help. There are three methods available for selecting the configuration. The first and most basic is config which presents each option, sequentially, for you to decide what to do. This is a long process. The menu-based menuconfig presents a menu in a terminal. Options are grouped hierarchically and you can navigate to the specific options you wish to modify. The X Window System configurator is xconfig. We might suggest xconfig as the more convenient of the methods, but menuconfig is a good alternative if there is no X Window System running. A good starting point for configuration is the basic configuration that is the default provided by Debian. You then refine the configuration. For an installed kernel-image you can find its configuration in /boot/config-2.4. 16, for example. A simple approach to configuration is to copy the installed kernel’s configuration as the starting point and simply enable the options missing from that configuration (e.g., SMP): # cp /boot/config-2.4.16-686 kernel-source-2.4.16/.config
However, you may be better off starting with no .config. A default configuration will be installed and you can then add to this support for your specific hardware. Below is a record of my configurations for Mint (Section 5.9.27) and Velox (Section 5.9.26) where configuration started with no /usr/src/kernel-source-2. 4.16/.config: # cd kernel-source-2.4.16 # make xconfig (or menuconfig or config) -> CONFIG_M686=y
384
Kernel: Rolling Your Own Plug and Play support -> CONFIG_PNP=y Block devices -> CONFIG_BLK_DEV_IDECD=m (previously y) -> CONFIG_BLK_DEV_IDESCSI=m -> CONFIG_BLK_DEV_LOOP=m Networking options -> CONFIG_FIREWALL=y Mint -> CONFIG_IP_FIREWALL=y Mint -> CONFIG_IP_MASQUERADE=y Mint -> CONFIG_IP_MASQUERADE_ICMP=y Mint SCSI support -> CONFIG_BLK_DEV_SR=m (previously y) -> CONFIG_BLK_DEV_SR_VENDOR=y -> CONFIG_CHR_DEV_SG=m SCSI support -> SCSI low-level drivers -> CONFIG_SCSI_AIC7XXX=y Velox Network device support -> Ethernet (10 or 100Mbit) -> CONFIG_NET_VENDOR_3COM=y -> CONFIG_VORTEX=m Network device support -> CONFIG_PPP=y Mint Filesystems -> CONFIG_ISO9660_FS=y -> CONFIG_JOLIET=y -> CONFIG_NTFS_FS=m -> CONFIG_FAT_FS=m -> CONFIG_MSDOS_FS=m -> CONFIG_VFAT_FS=m Sound -> CONFIG_SOUND=m (Will use ALSA modules)
For Altrop (Section 5.9.20) and Bartok (Section 5.9.19) the configuration began with a copy of config-2.4.16-686-smp and /boot/config-2.4.16 respectively and the following were modified for the extra memory and SMP.
Processor Type and Features CONFIG_MPENTIUMIII=y CONFIG_HIGHMEM4G=y (originally off) CONFIG_HIGHMEM=y (set automatically) CONFIG_SMP=y (already set)
51.3 Kernel Modules
385
For the laptop Inco the initial configuration was that of /boot/config-2.4. 16-686 then modified as: Processor Type and Features CONFIG_MPENTIUMIII=y
This is not really needed though as I believe this simply adds some minor tunings to the kernel.
51.3
Kernel Modules
The primary advantage of modules is that you compile to a smaller kernel for multiple machines with different hardware and have the hardware drivers loaded as needed. If you are compiling for a specific machine with specific hardware then you might as well compile the various drivers into the kernel rather than as modules.
51.4
Compiling the Kernel
# make-kpkg clean # make-kpkg --append-to-version -p3 --revision kayon01 --initrd kernel_image # make-kpkg --append-to-version -p3 --revision kayon01 --initrd modules_image
The use of --append-to-version will cause a new package to be created called kernel-image-2.4.16-p3 with revision 1.0. This package can then be installed without overwriting kernel-image-2.4.16 which may have been separately downloaded and installed. You will be left with /usr/src/kernel-image-2.4.16-p3_kayon01_i386. deb and /usr/src/alsa-modules-2.4.16-p3_0.5.10b-6+p0+kayon01_i386. deb and /usr/src/pcmcia-modules-2.4.16-p3_3.1.8-10+2:kayon01_i386. deb, depending on what you have. These are ready to install.
51.5
Installing the Kernel
Installing thee new kernel and module packages is no different to installing similar packages you would obtain from the Debian archives.
386
Kernel: Rolling Your Own
If you are installing a new version of a kernel that is already installed you should move the corresponding modules aside, or else you will be asked to do so during the install: # cd /lib/modules # mv 2.4.16-p3 2.4.16-p3.prev
Now we are ready to install the kernel: # cd /usr/src # wajig install kernel-image-2.4.16-p3_kayon01_i386.deb
You will be asked whether you wish to run lilo. Usually you would. If this wipes out a precious master boot record (MBR) you can recover it with lilo -u. Now install the modules (if any): # wajig install alsa-modules-2.4.16-p3_0.5.10b-9+p0+kayon01_i386.deb # wajig install pcmcia-modules-2.4.16-p3_3.1.8-10+2:kayon01_i386.deb
For Mint (Section 5.9.27) with support for CD-RW you now need to modify /etc/modutils/cdrw (as suggested in CD Writing HOWTO): options ide-cd ignore=hdd alias scd0 sr_mode pre-install sg modprobe ide-scsi pre-install sr_mod modprobe ide-scsi pre-install ide-scsi modprobe ide-cd
To get this information into the right place the following should be done: # update-modules
Again for Mint (Section 5.9.27) the following were added to /etc/modules (otherwise the modules must be loaded manually for some reason which can be avoid using char-major stuff but don’t understand this yet):
51.6 Lilo Configuration
387
sr_mod sg ide-cd
For alsa edit /etc/alsa/alsa-base.conf to set startosslayer=true to be sure snd-pcm-oss is loaded at boot, otherwise it needs to be added to /etc/modules also. # reboot
51.6
Lilo Configuration
image=/boot/vmlinuz-2.4.16-p3 label=2.4.16-p3 read-only initrd=/boot/initrd.img-2.4.16-p3
51.7
Kernel Versions
Note how the versioning interacts with Debian’s package management. By calling your own compiled kernel version 2:kayon.1 it will be a more recent version number than the standard Debian kernel-image package. That is, kernel-image-2.2.14 2:kayon.1 i386 is regarded as being more recent than kernel-image-2.2.14 2.2.14-1 i386. Thus, the packaging system will not try to install a more recent 2.2.14 over your own kernel image. Debian kernel packages always have the version number the same as the kernel version number.
51.8
Latest Kernel
If you have a kernel-source installed you can update to latest available kernel with: # cd /usr/src/kernel-source-NNN # uupdate -u ../linux.tar.gz
388
51.9
Kernel: Rolling Your Own
Why make-kpkg?
From Manoj Srivastava ¡[email protected]¿ on debian-user 6 Nov 2001. Using make-kpkg is a very convenient way of compiling your kernels for Debian GNU/Linux. The Package[]kernel-package takes all the required steps for compiling a kernel so that the user need not remember the actual substeps involved. Installation of the resulting kernel is then trivial. The Debian way allows you to keep multiple versions of kernel images on the same machine with little effort. Even multiple flavours of the same kernel version can easily be accommodated, You could have kernel-image-2.4.16686 and kernel-image-2.4.16-p3hmsmp available and choosable at boot time through lilo. Other kernel module packages are also hooked into the Debian way of dealing with kernels so that you can simply compile them as part of the kernel compile process. This includes pcmcia-source and alsa-source. Such modules generally rely on the particular kernel version. Debian also has the nice feature of keeping the configuration file for each kernel image in /boot. You can optionally apply patches to the kernel (supplied as .deb files) and build a patched kernel automatically. You can compile a kernel for another computer, for example using a fast machine to compile the kernel for installation on a slower machine. This is really nice since the modules are all included in the .deb; and one does not have to deal with modules manually. The postinst looks at a configuration file on the installation machine (as opposed to the machine that the image was compiled on), and allows the local admin to decide on issues of symbolic links, and whether the boot loader stuff must be run, and whether one wants to create a boot floppy or not. The postinst and the postrm scripts allow the local admin on the installation machine to add a script into runtime hooks; this can allow, amongst other things, grub users to add and remove kernel image stanzas from the grub menu (example scripts to do this are in the package).
51.10 Loading Kernel Modules
51.10
389
Loading Kernel Modules
The configuration file /etc/modules.conf is automatically generated by the update-modules command. It specifies module configurations that should survive a kernel reboot. The contents of /etc/modules.conf are updated using files found in /etc/ modutils/. Many Debian packages that have to manipulate modules when they are installed will make additions to /etc/modutils/ and then run update-modules. You can make your own additions to /etc/modutils/ automatically have them placed in the next generation of the /etc/modules.conf file. A simpler alternative is to add needed modules into /etc/modules. This is particularly useful for modules that need no options.
390
Kernel: Rolling Your Own
Chapter 52 Keyboard 52.1
Mapping a Key
First find the keycode of the key you wish to map. Do this by running xev and press the key you wish to map (e.g., the Windows key) and look for the keycode:
KeyPress event, serial 22, synthetic NO, window 0x4000001, root 0x26, subw 0x0, time 24756 22836, (129,34), root:(139,245), state 0x58, keycode 115 (keysym 0xffed, Meta_L), same_screen YES,
Create /home/kayon/.Xmodmap and map the keycode to any unused keysym. For example, assuming your keyboard has function keys F1–F12 then generally F13 and beyond are not used, so lets use F15:
keycode 115 = F15
For a complete list of keysyms, see /usr/X11R6/include/X11/keysymdef.h. (You omit the XK_ prefix when using them with xmodmap). Run xmodmap ~/.Xmodmap. You can do this interactively instead with:
$ xmodmap -e "keycode 115 = F15"
391
392
Keyboard
Now you should be able to bind F15 to any action with, for example, sawfish. Even better, sawfish supports custom modifier keys (i.e., modifiers apart from Ctrl, Alt, and Shift- and knows about Hyper). You can map the left windows key: keycode 115 = Hyper_L add Mod2 = Hyper_L
Then use Hyper_L for all bindings related to the window manager (thus freeing Ctrl and Alt-based bindings). This makes it a perfect window manager key. I end up with /home/kayon/.Xmodmap containing: keycode 115 = Hyper_L add mod3 = Hyper_L keysym Alt_L = Meta_L Alt_L add mod1 = Meta_L
Chapter 53 Konqueror: The KDE File Manager Konqueror is a file manager and web browser for the KDE desktop. It provides the usual file manager functionality including display of files and directories using an icon view or tree view, copying, moving and deleting by direct drag and drop or by using copy, cut and paste, and file properties.
393
394
Konqueror: The KDE File Manager
Chapter 54 LaTeX Debian Packages: tetex-bin tetex-extra LATEX and TEX are sophisticated document typesetting systems. LATEX is a mark-up language where you edit text documents (using any editor of choice) and include mark-up to tell the formatter how to produce the final printed page. Unlike proprietary word processing systems, like MS Word, LATEX is available freely on most platforms and documents produced on one platform will be identical to that produced on another platform.
54.1
LaTeX Documentation
There is an extensive collection of documentation for LATEX, in many different formats. The command texdoc can be used to find documentation on any LATEX package and employ the appropriate viewer for the format suitable for the documentation found: > texdoc geometry
54.2
Generating LaTeX
Many Debian packages can generate LaTeX. These include the Gnome office suite applications Gnumeric (Chapter 40), AbiWord (Section 9.1) and Dia (Chapter 24). 395
396
LaTeX
54.3
Creating LaTeX Documents
54.3.1
Using LyX
A great GUI for editing LaTeX documents is LyX. LyX provides much help for the novice LaTeX user in getting started with producing very nice looking documents.
54.3.2
Using Emacs
The AucTeX package provides a complete emacs environment for editing LaTeX documents. C-c = runs the reftex command reftex-toc which will split the current Emacs window to show two buffers, the top buffer showing the table of contents of the whole document, allowing quick navigation around the document. The preview-latex package will provide a preview of graphics and mathematics inside the emacs buffer where the LATEX file is being edited.
54.4
Processing a LaTeX Document
Use rubber to convert a source document into a PDF document: > rubber --pdf report
Rubber has a problem with warnings produced by PDFLaTeX, interpreting them as errors, and thus failing. A simple fix is to edit the file \_\_init\_\_. py in /usr/share/rubber/rubber/, in the definition of the errors function, insert the following: ... for line in self.lines: if line[0:23] == "! pdfTeX warning (dest)": print "PDF WARN: " + line[25:], return 0 if line[0] == "!": ...
54.5 LaTeX Tips and Tricks
54.5
LaTeX Tips and Tricks
54.5.1
Bibliography Starts on a New Page
397
The natbib package in LATEX checks to see whether the chapter command is defined. If so it decides to use that for the bibliography headings. This will generally place the bibliography on a new page, which is what you would expect for a book. However, the llncs LATEX document class does define the chapter command, but is used generally for writing articles! A simple solution is to tell natbib to use section rather than chapter for the bibliography: \usepackage{natbib} \makeatletter \renewcommand\bibsection% { \section*{\refname \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}} } \makeatother
54.6
TeX Capacity Exceeded
If you get an error while running TEX or LATEX like: TeX capacity exceeded, sorry [pool size = 67555]
Then edit /etc/texmf/texmf.cnf to set: pool_size = nnnnnn
where you add something to the current value of nnnnnn. This should take effect next time you run LATEX.
398
LaTeX
Chapter 55 Login 55.1
All Capitals Login
If you enter your username on the login prompt all in capitals then the login progam will be lead to believe that you have an upper-case only terminal (pretty rare devices these days but once upon a time they ruled the desktop). You will then enter into the system where uppercase letters rule. This is a feature and not a bug! Make sure your disable capslock before entering your userid.
55.2
Login Screen
Tricks with /etc/issue Category: Software All the software discussed in this small article can be downloaded here. This includes shell scripts called createissue and listansi. When you log in on the console of your Linux System, you are usually presented with a login screen with info about the system you are about to log in on. In this short article I will show you how to change what you see on your login screen, and also how to add a bit of colour. When your Linux System boots it starts ”getty” processes on a number of 399
400
Login
virtual terminals on your system. When getty starts, it prints the contents of /etc/issue to the terminal. To customize the look of your console, all you have to do is edit /etc/issue. You can also add colour by using the colour capabilities of the Linux console. The Linux console, like almost any other existing terminal, has escape sequences that can be used to change the appearance of text on screen. Piping the following script into /etc/issue: #!/bin/sh spaces(){ COUNT=0; while [ $COUNT -lt $1 ]; do echo -ne " "; COUNT=$[$COUNT+1] done } esc="\033[" echo -ne "${esc}H${esc}J\n${esc}44;37;1m" WELCOME="Welcome to "‘hostname‘" running Linux "‘uname -r‘ CHARS=$[(80-‘echo $WELCOME | wc --chars‘)/2] spaces $CHARS echo -ne $WELCOME spaces $CHARS echo -ne "${esc}0m\n\\l "
should produce this result: Welcome to gatekeeper.localnet running Linux 2.2.16 tty1 gatekeeper login: Note to newbies: Piping the output of a program into a file involves using the ¿ operator. For example, to send the output of ”ls” to a file called ”files.txt”, you would do this: ls ¿ files.txt The line responsible for all the color is this one: echo -ne "${esc}H${esc}J\n${esc}44;37;1m"
The 44;37 specifies White on Blue. To see how your terminal renders colours, use this script: #!/bin/bash
55.3 Midnight Commander
401
# Display ANSI colours. # esc="\033[" echo -n " _ _ _ _ _40 _ _ _ 41_ _ _ _42 _ _ _ 43" echo "_ _ _ 44_ _ _ _45 _ _ _ 46_ _ _ _47 _" for fore in 30 31 32 33 34 35 36 37; do line1="$fore " line2=" " for back in 40 41 42 43 44 45 46 47; do line1="${line1}${esc}${back};${fore}m Normal ${esc}0m" line2="${line2}${esc}${back};${fore};1m Bold ${esc}0m" done echo -e "$line1\n$line2" done
You can download both scripts here. Please note that Redhat Linux overwrites /etc/issue with each bootup. To keep your /etc/issue, edit /etc/rc.d/rc.local and remove the lines responsible for overwriting /etc/issue. Even better, change rc.local to use createissue instead. Any comments will be appreciated. You can email me at [email protected]
55.3
Midnight Commander
You can browse through the contents of a Deb package (*.deb file) with gmc as if it were a locally mounted fileystem,¿ without having to unarchive and untar all the constituent components. You can also browse tarballs, gzips, bzips, gzipped tarballs, bzipped tarballs, and zips as well, providing that the attendant gzip, bzip, tar, and zip programs are all installed. Double click the archive in question and you can browse the archive as if it were a directory.
55.4
Gnome Memory Blocks
402
Login
Figure 55.1: Gnome Memory Blocks
Chapter 56 Magellan: KDE Personal Information Manager Magellan is a KDE-based alternative to Evolution. It is a personal information manager handling email, contacts, notes, tasks, to do lists, and journals. For email it supports mail retrieval via POP3, IMAP4, and local mailboxes. An interesting feature is that it supports mixed-mode POP3 and IMAP4 accounts where each account can be a completely different identity (e.g., if you have multiple email accounts on different servers with different usernames).
403
404
Magellan: KDE Personal Information Manager
Chapter 57 Modems 57.1
Silence
If you want to turn the speaker of your modem off, then add ATM0 to /etc/ chatscripts/provider:
# ispnumber OK-AT-OK ATM0 OK-AT-OK ATDT12345678
57.2
No Dial Tone
From some hotels (e.g., while travelling overseas) telephone switchboards generates a tone that sounds like an engaged signal until a 0 is pressed. With this one can not dial up as the ppp chat script always finds ”NO DIAL TONE” and fails. A fix might be:
Replace ATZ with ATH1. May need to extend the time waiting from the 100 (1 sec) standard setting to 250, so the modem doesn’t send the ATDT(phone no.) too soon. 405
406
57.3
Modems
Chat Script Giving up Too Early
By default pon does not wait around too long to establish a connection. Sometimes it does not wait long enough. You can introduce a longer wait (e.g., two minutes) as below. Edit /etc/ppp/peers/provider (assuming your connection is the default, called provider ) to replace: connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
with connect "/usr/sbin/chat -v -t120 -f /etc/chatscripts/provider"
If you connection is not the default provider but something else, then edit the file with the same name in /etc/ppp/peers/.
Chapter 58 MSWindows For running MSWindows applications under GNU/Linux see Wine (Section 58.1) and Citrix (Section 58.2). Wine provides an implementation of many of the MSWindows libraries so that MSWindows applications can run diretly under GNU/Linux. Citrix uses the Windows Terminal Server to access a Windows machine and display the desktop within a window on the GNU/Linux desktop. For applications that can work with MSWindows documents see OpenOffice 65 and AbiWord 9. To simply view the contents of a MSWord document use wv.
58.1
Wine: Emultaing MS-Windows
Wine works well with MS-Windows/98 (e.g., winword and excel work just fine) but not so good with MS-Windows/NT, MS-Windows/2000, and MSWindows/XP.
58.2
Citrix: MSWindows Under Linux
Citrix provides remote access to MSWindows within GNU/Linux, using the Windows Terminal Server (WTS). This is commercial software, although the clients (for a variety of platforms, including GNU/Linux and Java) are 407
408
MSWindows
available for download.
58.2.1
Screenshot
Figure 58.1: Citrix: MSWindows inside Linux.
58.2.2
Installation
Citrix provides both a standard client and a Java based client that can run as an application or as an applet (although the Java application is only available as version 6, with version 7 only providing an applet). The clients can be downloaded from the Citrix web site, after agreeing to their licensing conditions.
Client Installation To install the client on GNU/Linux:
58.2 Citrix: MSWindows Under Linux
409
$ wget http://download2.citrix.com/files/en/products/client/ica/current/ICAClient-7.00-1 $ wajig rpminstall ICAClient-7.00-1.i386.rpm $ /usr/lib/ICAClient/wfcmgr Create new Entry Network Server [ACT] [citrix.togaware.com] Window Window Size [75%] Login [kayon,NEXUS,passwd] Tools -> Settings Drive Mapping H: /home/kayon/ Enable Drive Mapping $ /usr/lib/ICAClient/wfcmgr -desc ACT
Java Client Installation The Java client can be installed as in: $ wget http://download2.citrix.com/files/en/products/nfr/ica/setup.class $ java setup Install into /usr/local/share/citrix $ CLASSPATH="/usr/local/share/citrix/JICAEngJ.jar:$CLASSPATH"\ java com.citrix.pn
Create a connection, such as ACT. Then start up the connection directly: $ CLASSPATH="/usr/local/share/citrix/JICAEngJ.jar:$CLASSPATH"\ java com.citrix.JICA ACT
410
MSWindows
Chapter 59 Music Most computers today have hardware for producing great audio. In this chapter we explore how to get the most from your sound system. FIRST DISCUSS CD PLAYERS With the explosive growth of MP3 freely available on the web you will need an MP3 player. There are several to choose from, but we concentrate on xmms and qvmpeg. You may want to record your own audio CDs so that you can listen to them yourself or download them to your portable MP3 player. The grip package encodes an audio CD as a collection of MP3 files.
411
412
Music
Chapter 60 MySQL Debian Pacakges: mysql-client mysql-server mysql-navigator mytop MySQL is a common database system used in GNU/Linux. It is extensively used as the backend database server for the Apache web server. To quote the Debian information about mysql-server:
The main goals of MySQL are speed, robustness and easy to use. MySQL was originally developed because Tcx needed a SQL server that could handle very big databases with magnitude higher speed than what any database vendor could offer. They have now been using MySQL since 1996 in a environment with more than 40 databases, 10,000 tables, of which more than 500 have more than 7 million rows. This is about 50G of mission critical data.
Under Debian install the package mysql-client for connecting to a mysql database server (possibly remote). To run a database server on your local machine you will need to install mysql-server. Install mysql-doc for the full documentation for MySQL. The package mysql-navigator provides a very effective (but non-Gnome) GUI to MySQL. You can manage the MySQL database server using this. When started, open a connection to the MySQL server on the local host with user root. Most (but not all) admin operations can be performed through the navigator. 413
414
MySQL
A Gnome-based interface, and somewhat easier to use interface, is provided by the gmyclient. This is not yet packaged for Debian but using the alien package creates a Debian package that installs just fine. A beginner’s tutorial on using MySQL is available from http://www.devshed. com/Server_Side/MySQL/Intro/. Also see the full user manual in /usr/ share/doc/mysql-doc/index.html.
60.0.3
MySQL Root Password
Once mysql-server is installed it is ready for immediate use. However, it is best to at least set an admin password with: $ /usr/bin/mysqladmin -u root password ’new-password’
You will then also need to let cron jobs work on the database so create a personal mysql config file for root in /root/.my.cnf containing: [mysqladmin] user password
= root =
Make sure the permissions are set appropriately: # chmod 0600 /root/.my.cnf # ls -l /root/.my.cnf 4.0k -rw------1 root root
60.0.4
64 Oct 12 10:52 /root/.my.cnf
Creating New Database
Create a new database called nhds (National Hospital Discharge Suvery). The sample data we use comes from http://www.cdc.gov/nchs/. $ mysql -u root -p mysql Password: mysql> CREATE DATABASE nhds;
415 The data to populate a new table we will create is stored in the file nhds99. data as comma separated values. We can write a simple script to create the table and import the data. The script is called nhds99.sql: USE nhds; CREATE TABLE nhds99 ( svy_year int, newborn char(1), age_unit char(1), age int, sex char(1), race char(1), m_status char(1), dis_month int, dis_status char(1), days_care int, los_flag char(1), geo_region char(1), no_beds char(1), hos_ownership char(1), ana_weight int, dc1 char(5), dc2 char(5), dc3 char(5), dc4 char(5), dc5 char(5), dc6 char(5), dc7 char(5), pc1 char(4), pc2 char(4), pc3 char(4), pc4 char(4), p_src_payment char(2), s_src_payment char(2), drg char(3)); LOAD DATA LOCAL INFILE ’nhds99.data’ INTO TABLE nhds99 FIELDS TERMINATED BY ’,’;
Then simply run it through mysql:
416
MySQL
$ mysql -u root -p nhds < nhds99.sql
You can remove the table from the database with: $ mysql -u root -p nhds mysql> FROP TABLE nhds99;
Using mysql-navigator you can not currently create new databases (except by running an external script) but you can create tables. You can also run SQL scripts. So create your database for nhds as above. Then start up the navigator and open root@localhost. Then under the MySQL menu choose Script. Identify the script and a log file then Fire. The new table should then appear under the nhds database. With the navigator you can even edit the script files with the Edit item in the MySQL menu.
60.0.5
Create a New User
The mysql-navigator can be used to create a new user. Fire it up and open a connection to the localhost server with user root and database mysql. Under the MySQL menu select User. Choose the action to permform, prvoide the relevant information then Fire. Then under the MySQL menu select Privilege to grant database access. Note that you may still need mysqladmin -u root -p reload? Alternatively, you can do it as follows. The first insert adds this user’s password to the users table. The second then gives this user access to a particular database. $ mysql -u root -pYYYYY mysql mysql> insert into user (host,user,password,select_priv) -> values (’localhost’, ’kayon’, password(’XXXXXX’),’Y’); Query OK, 1 row affected (0.00 sec) mysql> insert into db (host,db,user,select_priv) -> values (’localhost, ’customers’, ’kayon’, ’Y’); Query OK, 1 row affected (0.00 sec)
417 mysql> exit altrop$ mysqladmin -u root -pYYYYY reload
Then this user can access the specified data base to perform SELECT queries: $ mysql -u kayon -pXXXXXX customers
60.0.6
Remote Host Access
Network access to a MySQL server under Debian is disabled by default for security reasons. You can enable it by commenting out the skip-networking option in /etc/mysql/my.cnf. If you don’t allow such access then your local MySQL client will report: ERROR 2003: Can’t connect to MySQL server on ’festival’ (111)
60.0.7
Remote User Permissions
On any host in domain togaware.com user kayon would like to connect to the customers database with select privileges on the MySQL server running on altrop.togaware.com. You can arrange this as follows. The first insert adds this user’s password to the users table. The second then gives this user access to a particular database. On altrop.togaware.com: altrop$ mysql -u root -pYYYYYY mysql mysql> insert into user (host,user,password) -> values (’%.togaware.com’, ’kayon’, password(’XXXXXX’)); Query OK, 1 row affected (0.00 sec) mysql> insert into db (host,db,user,select_priv) -> values (’%.togaware.com’, ’customers’, ’kayon’, ’Y’); Query OK, 1 row affected (0.00 sec)
418
MySQL
mysql> exit altrop$ mysqladmin -u root -pYYYYYY reload
Then on inco.togaware.com, for example: inco$ mysql -h altrop -u kayon -pXXXXXX customers -e ’show tables’
60.0.8
Basic MySQL
Connect to the local database server as user nhds: $ mysql -u nhds -p
Identify the current database: mysql> select DATABASE(); +------------+ | DATABASE() | +------------+ | | +------------+ 1 row in set (0.00 sec)
List all available databases with: mysql> show databases; +----------+ | Database | +----------+ | mysql | | nhds | | test | +----------+ 3 rows in set (0.00 sec)
Select a particular database:
419 mysql> use nhds; Database changed
List the available tables: mysql> show tables; +----------------+ | Tables_in_nhds | +----------------+ | nhds96 | | nhds97 | | nhds98 | | nhds99 | +----------------+ 4 rows in set (0.00 sec)
List details of the structure of a table: mysql> describe nhds99; +---------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------+------+-----+---------+-------+ | svy_year | int(11) | YES | | NULL | | | newborn | char(1) | YES | | NULL | | | age_unit | char(1) | YES | | NULL | | | age | int(11) | YES | | NULL | | | sex | char(1) | YES | | NULL | | | race | char(1) | YES | | NULL | | | m_status | char(1) | YES | | NULL | | | dis_month | int(11) | YES | | NULL | | | dis_status | char(1) | YES | | NULL | | | days_care | int(11) | YES | | NULL | | | los_flag | char(1) | YES | | NULL | | | geo_region | char(1) | YES | | NULL | | | no_beds | char(1) | YES | | NULL | | | hos_ownership | char(1) | YES | | NULL | | | ana_weight | int(11) | YES | | NULL | | | dc1 | char(5) | YES | | NULL | | | dc2 | char(5) | YES | | NULL | | | dc3 | char(5) | YES | | NULL | | | dc4 | char(5) | YES | | NULL | |
420 | dc5 | char(5) | YES | | NULL | | | dc6 | char(5) | YES | | NULL | | | dc7 | char(5) | YES | | NULL | | | pc1 | char(4) | YES | | NULL | | | pc2 | char(4) | YES | | NULL | | | pc3 | char(4) | YES | | NULL | | | pc4 | char(4) | YES | | NULL | | | p_src_payment | char(2) | YES | | NULL | | | s_src_payment | char(2) | YES | | NULL | | | drg | char(3) | YES | | NULL | | +---------------+---------+------+-----+---------+-------+ 29 rows in set (0.00 sec)
MySQL
Chapter 61 Nautilus: Navigating Folders—Near and Far The Apple Macintosh commercially pioneered the graphical user interface (GUI) invented by Xerox Palo Alto Research Center (PARC). The Macintosh Finder provided an ease of use that heretheto was lacking in computers. Microsoft came along much later with their File Manager and then MSWindows Explorer. Learning well from both of these and more, Nautilus was developed by Eazel, a startup company founded by some of the original Apple Macintosh developers, including Mike Boich, Andy Hertzfeld, and Bud Tribble. Nautilus is a component-based Gnome-based file manager for the GNU/Linux Operating System. Nautilus features a refreshingly new yet intuitive graphical user interface which is easily customised to suit individual tastes and expertise. Documents are, as we expect, represented by icons on a desktop. But the contents of those documents are previewed within the icon! Also users can share and manage files across a network.
61.1
Finding Your Way
Navigation will be familiar to any user, with the usual Back, Forward, Up, Reload, Home, Search and Web Search buttons in the toolbar. 421
422
Nautilus: Navigating Folders—Near and Far
The main window has two panels with the left hand panel containing tabs to access different components. The right hand panel displays folders and documents in a rich variety of ways. Users will be familiar with the View as List and View as Icons Folder displays. Folders containing MP3 music can be displayed using the View as Album component, which provides a specialised view of your music collection as an album, designed to allow easy music listening. Selecting an MP3 file starts it playing automatically.
Figure 61.1: Nautilus View as Music.
It can also display the album artwork if you have that available. To link the artwork in you need to.
61.2
Browsing HTML Documents
HTML documents (the type of documents that form the basis of the world wide web), whether they live on your local disk or somewhere on the web, are just another type of document, and Nautilus treats them as such. Open one and you begin browsing the web within the Nautilus shell! By default Nautilus uses the Embedded Mozilla to render these documents, but others can be plugged in, depending on your desires.
61.3 Nautilus CD Creator
61.3
423
Nautilus CD Creator
Debian Pacakges: nautilus-cd-burner Nautilus provides by far the simplest approach to burning data CDs. Simply copy documents into burn:/// (or select Go->CD Creator to get the burn:/// folder) then click on the Write contents to CD button. An option is provided to blank a CD-RW before burning. To burn an existing ISO image right-click on it to select the Write to CD... entry. If, when you select to Write to CD the only option is to write the CD image to file, then you probably have a permissions problem. XXXX How to fix this? XXXX
61.4
Browsing Remote Sites
To use ssh to access a remote host, enter the appropriate Location: ssh://festival/home/kayon/
Or ftp: ftp://kayon:[email protected]
424
Nautilus: Navigating Folders—Near and Far
Chapter 62 Networks 62.1
Introduction
The network provides access to a wide collection of resources. Most computers today connect to the network either through an Ethernet network card or else by modem. Once connected you have an IP address (and sometimes more than one) assigned to your computer by which all communications is effected. IP addresses are sequences of numbers. Two things need to happen to get your network going: loading a driver for your network card and specifying your network address and configuration. An Ethernet based network is usually started up at boot time by the system initialisation script /etc/init.d/networking. For pcmcia network cards the /etc/pcmcia/ tree provides its own scrips, including /etc/pcmcia/network, that is called whenever a network card is found in the PCMCIA socket. Your IP address bitwise ANDed with the so called netmask yields your network address. The network address bitwise ORed with the negated netmask yields your so called broadcast address. The IP address of the router through which you connect to the Internet is referred to as the gateway. A simple example is: IP: Mask: Network: Broadcast:
192.168.0.34 255.255.255.240 192.168.0.32 192.168.0.47
(0xc0a80022) (0xfffffff0) (0xc0a80020 = 0xc0a80022 & 0xfffffff0) (0xc0a8002f = 0xc0a80020 | ~0x0f)
425
426
Networks
62.2
Network Configuration
62.2.1
Graphical Tools
Debian Pacakges: gnome-system-tools. The gnome-system-tools package contains a graphical interface (networkadmin) to set up your network. The application is available from the standard Gnome menu as Applications→System Tools→Networking. You will be asked for the root password to effect changes to networking, as in Figure 62.1.
Figure 62.1: Dialogue requesting root password for network administration. You will then see the interface that will allow you to set up your networking. With a laptop, for example, with regularly changing network configurations you can create a number of appropriate Network Profiles, with one called home chosen in Figure 62.2. To establish a connection you can click on the unselected button for the appropriate network device in the Status column of the Connections tab (after choosing the appropriate Network Profile).
62.2.2
Manual Setup
To set up networking the key file is /etc/network/interfaces. Examples of what to add to this file are included below, illustrating both DHCP for automatically obtaining network information from a server, and a manual setup. When changes are made to the network manually, (e.g., by editing /etc/ network/interfaces), restart the network with: # wajig restart networking
Note that to have networking started in this way you need to have auto eth0 in /etc/network/interfaces. Otherwise the start-up script /etc/init.d/
62.2 Network Configuration
427
Figure 62.2: Configuration of networks using the Gnome network administration tool.
networking will not start eth0. The start-up script calls ifup -a which only starts those interfaces marked as auto. You can still manually start the network with ifup eth0.
62.2.3
Neighborhood Table Overflow
If you get a neighborhood table overflow message make sure the loopback device is running: # ifup lo
The ifconfig lo command should show, among other lines: UP LOOPBACK RUNNING
62.2.4
Example Configurations
We present here some example network configurations. The numbers will only make sense for very specific locations and you will need to obtain your specific addresses from your System Administrator. We illustrate these through the contents of /etc/network/interfaces but it is advisable to
428
Networks
use Applications→System Tools→Networking as discussed above to change the contents of this configuration file. The simplest configuration uses DHCP to automatically obtain network information from a server that allocates addresses: auto eth0 iface eth0 inet dhcp
Velox (Section 5.9.26) was initially set up to allow DHCP allocation of the IP address. The DHCP server delivered the appropriate information as demonstrated in /var/log/installer.log: got dhcp offer HOSTNAME: requesting velox ip: 183.44.70.122 next server: 0.0.0.0 netmask: 255.255.255.0 gateway: 183.44.70.177 dnsServers[0]: 183.44.72.1 numDns: 1 domain: togaware.com broadcast: 183.44.70.255 network: 183.44.70.0 configured interface eth0 The network has been successfully configured using DHCP/BOOTP.
A manual configuration requires the information to be specified: auto eth0 iface eth0 inet static address 105.229.8.151 netmask 255.255.255.192 broadcast 105.229.8.191 gateway 105.229.8.190
A computer with a 3Com 3c905 ethernet card: eth0: 3Com 3c905 Boomerang 100baseTx at 0xfc80, 00:c0:4f:f7:02:bf, IRQ 10 8K word-wide RAM 3:5 Rx:Tx split, autoselect/MII interface. MII transceiver found at address 24, status 7849. Enabling bus-master transmits and whole-frame receives.
62.3 Wireless Network
429
You can check that the eth0 interface is functioning: # ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:C0:4F:F7:02:BF inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:21 errors:0 dropped:0 overruns:0 carrier:21 collisions:0 txqueuelen:100 Interrupt:10 Base address:0xfc80
A computer with a SMC91C92 Ethernet network card. I had to configure the appropriate kernel module to have this card recognised. I used the modconf command to do this, select the Net modules and select the smc9194 module. Configuring this succeeded, returning the following message: SMC9194: SMC91C90/91C92(r:3) at 0x300 IRQ:10 INTF:TP MEM:4608b ADDR: 00:c0:4f:df:25:55
62.3
Wireless Network
Using a Cisco Air PCM350 series (PCM352) wireless PCMCIA card in a laptop. Card is recognised when inserted and the airo module is loaded and eth1 is identified. Card is also seen as wifi0! Install the CISCO Utilities (Version 2.0 from www.cisco.com as Linux-ACU-Driver-v2.0.tar.gz). Install as follows: # # # # # # # # # # # #
mkdir /tmp/cisco cd /tmp/csico wget http://www.cisco.com/pcgi-bin/Software/Tablebuild/download.cgi/Linux-ACU-Driver-v tar zxvf Linux-ACU-Driver-v2.0.tar.gz mkdir -p /opt/cisco/bin mv utilities/* /opt/cisco/bin mv helpml.tar.gz /opt/cisco cd /opt/csico tar zxvf helpml.tar.gz tm helpml.tar.gz cd /opt/cisco/bin/acu
430
Networks
For LEAP authentication you can login with a username and password. This can be set up with: # leapscript
Then start up a network connection on wifi0: # ifup wifi0
Trying a ifup eth1 freezes the machine (Kernel 2.4.23). DHCP fails at present. The wireless card is “associatied”. Have tried: • acpi=off for booting - no luck • removing the NIC module (3c59x) and reinserting wireless so that it becomes eth0 - no luck. • Perhaps you may need to first set your IP address to 0.0.0.0 subnet mask 255.255.255.0 before initializing the DHCP client process (a known problem when the DHCP server is Windows). How to do this? Fixed IP also fails to work. WARNING: On the laptop, suspend to disk fails to resume when the card is plugged in!!!! TODO Fix this.
62.4
Domain Name Searching
If you would like to search for hosts in other domains by simply listing the host name (e.g., inco, rather than inco.togaware.com) you can add those other domains to /etc/resolv.conf. Note that PPP will add its own ”ISP” related resolv.conf file on dial up. Thus, with ISP identified as ”provider” add the following line to /etc/ppp/resolv/provider:
search togaware.com
62.5 Hostname Changes
62.5
431
Hostname Changes
Changing your hostname is not so trivial because it sometimes permeates to various files in /etc/. But the starting point to change your hostname from porsche to zafira is: # hostname zafira
This alone will not suffice as the change in hostname will not survive a reboot. You need to edit /etc/hostname which is where the name is obtained at boot time. Then search through /etc, for example, for occurances of the old name, just in case: # grep -r inco /etc
Typically you will find the hostname hardwired in /etc/hosts, /etc/mailname, /etc/motd, and various apache, ppp, ssh, and exim files, depending on your setup. These can probably be edited by hand to replace the host name. Users have reported making such changes without problem. Some people have reported problems rebooting after making some of these changes so be careful!
62.6
Ports and Services
You can turn services on and off by the update-inetd command. For example, to turn telnet off: # update-inetd --disable telnet
You can also manually turn services off by directly editing /etc/inetd.conf. For example, if you have telnetd installed (not recommended) and wish to turn it off (rather than uninstalling it) then comment out the line in /etc/ inetd.conf that starts with telnet and restart inetd: # /etc/init.d/inetd restart
432
Networks
7 9
echo discard
13
daytime
17 20 21 22 23 25 37
quotd ftp-data ftp ssh telnet smtp time prints the current time as seconds sine the epoch in machine readable form. This can be useful if network clients expect the service for crude time synchronisation (some windows clients can use this service). Otherwise it is not generally needed. domain gopher finger http pop3 sunrpc auth The IDENT protocol. It is not useful but most IRC servers require this port to be open and returning information. Apparently some FTP servers and postgresql require this service as well. nntp is the Network News Transport Service if you are running a news server (e.g., inn or cnews). Otherwise it is not needed.
53 70 79 80 110 111 113
119
This is like /dev/null but for networks. This port is generally not needed, especially if you are worried about attacks. Prints the current date as a string (e.g., Mon May 23 07:14:21 2001). Not generally not needed. Can be turned off to avoid possible denial of service attacks where an attacker may link it to the echo port using spoofing. Also, the returned format could be used to guess the operating system type.
62.7 Getting the Cabling Right 123 143 161 194 194 220 389 443 873 2049 2049
ntp imap2 udp snmp tcp irc udp irc imap3 tcp ldap tcp https tcp rsync tcp nfs udp nfs
3306 6000 6667 8080 32860
tcp
433
Simple Net Management Protocol Internet Relay Chat
Lightweight Directory Access Protocol Secure HTTP Efficient protocol for copying and syncing files. This port will advertise the export list for NFS. Older versions of nfsd have bugs so make sure your nfs is up to date.
mysql X Window System udp ircd Internet Relay Chat tcp webcache WWW caching service udp nlockmgr Not known to be a security problem but could be turned off.
62.7
Getting the Cabling Right
62.8
IP Forwarding: Home Networks
Debian Pacakges: iptables. Consider a home network of GNU/Linux and MSWindows machines, connected via ethernet. A GNU/Linux machine can connect to the Internet via PPP. We want to provide network access from all machines. We use iptables (for kernel version 2.4). Suppose Modern (Section 5.9.6) is the host which will connect to the Internet using PPP. After installing iptables do the following on this host which will serve as the Internet gateway: # # # # #
iptables iptables iptables iptables iptables
--flush --table nat --flush --delete-chain --table nat --delete-chain --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
434
Networks
# iptables --append FORWARD --in-interface eth0 -j ACCEPT
This clears the rules for filtering and then adds a rule to provide the IP forwarding. Now we need to turn it on for the kernel: # echo 1 > /proc/sys/net/ipv4/ip_forward
And that’s it! This host, Modern (Section 5.9.6) will now act as a gateway to the Internet for your local machines. There is some setup needed to have this survive a reboot. One approach is to do this through init.d, as explained in Section 47.2. The first step is to create a script file called /etc/init.d/myfirewall containing: #! /bin/sh # # Set up a firewall for IP Masquerading # PATH=/bin:/usr/bin:/sbin:/usr/sbin case "$1" in start) echo -n "Starting IP Masquerading: myfirewall" iptables --flush iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE iptables --append FORWARD --in-interface eth0 -j ACCEPT echo 1 > /proc/sys/net/ipv4/ip_forward echo "." ;; stop) echo -n "Stopping IP Masquerading: myfirewall" echo 0 > /proc/sys/net/ipv4/ip_forward echo "." ;; reload) echo "Not implemented." ;; force-reload|restart)
62.8 IP Forwarding: Home Networks
435
sh $0 stop sh $0 start ;; *) echo "Usage: /etc/init.d/myfirewall {start|stop|restart|force-reload|reload}" exit 1 ;; esac exit 0
Then the firewall can be turned on and off with: $ wajig start myfirewall $ wajig stop myfirewall
To have it started at boot and stopped at shutdown: # update-rc.d myfirewall start 40 S . stop 89 0 6 .
This creates the following links: /etc/rc0.d/K89myfirewall -> ../init.d/myfirewall /etc/rc6.d/K89myfirewall -> ../init.d/myfirewall /etc/rcS.d/S40myfirewall -> ../init.d/myfirewall
Another approach is to only turn it on and off as a PPP connection is established. See the scripts in /usr/share/doc/iptables/examples for details. Now Rose (Section 5.9.29) and Inco (Section 5.9.24), machines on the local home network, can have their network interface set up: iface eth0 inet address network netmask gateway
static 192.168.1.2 192.168.1.0 255.255.255.0 192.168.1.5
(modern)
436
62.9
Networks
Multiple Ethernet Cards
On the Dell laptop Inco (Section 5.9.24) we have two Ethernet cards when the Laptop is docked and one when not docked. The card in the Laptop itself is identified as eth0 when not docked but as eth1 when docked, in which case the docking station Ethernet card is identified as eth0. The laptop’s internal Ethernet card is only used when the laptop is not docked. Thus we can get away with configuring eth0 for both situations and eth1 as a removable card so that it is not automatically configured when the machine is booted!
Chapter 63 NFS: Network File System Debian Pacakges: nfs-kernel-server nfs-client For managing a collection of networked Debian boxes the use of NFS to mount home directories is a good idea.
63.1
Setting Up NFS
Suppose Altrop (Section 5.9.20) is the host of the home directories that are exported to Cultus (Section 5.9.18). On Altrop install nfs-kernel-server: altrop$ wajig install nfs-kernel-server
Then edit /etc/exports to add the following line: /home cultus(rw)
Then restart the daemon: altrop$ wajig restart nfs-kernel-server
On Velox (Section 5.9.26), an earlier install, I used nfs-user-server rather than the usual nfs-kernel-server because the latter gave the following error when starting the daemons: 437
438
NFS: Network File System
nfssvc: Function not implemented
I use nfs-kernel-server on Punto (Section ??) and Prefect (Section 5.9.16) which are running kernel 2.4.9 and Altrop (Section 5.9.20), running 2.4.16. Errors will also be reported if you have not loaded the nfsd module into the kernel. Be sure to add the following to /etc/modules if you get errors: nfs nfsd
Now on Cultus (Section 5.9.18) add the following line to /etc/fstab: altrop:/home /home nfs defaults 0 0
Then on Cultus (Section 5.9.18) you can: cultus$ mount /home
You should also maintain common passwd, shadow, group and gshadow files between the various hosts. See Section 68.1 below for details.
63.2
Export Lists
Suppose you have a network that is a subnet of a C class network, as with the hosts on ktnet. They have addresses starting from 155.229.8.150 with a netmask of 255.255.255.192. To NFS export to all hosts in this subnetwork you can use the following: /home /usr/local /edmnet/altrop /var/lib/cvs /var/spool/mail
155.229.8.150/255.255.255.192(rw) 155.229.8.150/255.255.255.192(rw) 155.229.8.150/255.255.255.192(rw) 155.229.8.150/255.255.255.192(rw) 155.229.8.150/255.255.255.192(rw,no_root_squash)
63.3 Root Access On NFS
63.3
439
Root Access On NFS
By default root on a client is mapped to user nobody on an NFS server. This is a security measure. However, this may mean that evolution, for example, will not be able to read NFS mounted mail directories (i.e., where on machine Cultus (Section 5.9.18) you mount /var/spool/mail from, for example, Altrop (Section 5.9.20)). evolution (or something used by evolution) seems to be root when accessing the email. The solution is to allow root mapping to root for this export from Altrop (Section 5.9.20). Thus, on Altrop (Section 5.9.20) ensure the following exists in /etc/exports: /var/spool/mail
cultus(rw,no_root_squash)
440
NFS: Network File System
Chapter 64 NT File System Kernel 2.2.12 and beyond support read only access to NTFS, the file system of MS-Windows/NT. The kernel needs to be configured to use it: CONFIG_NTFS_FS=m
I have two NTFS partitions on the MS-Windows/NT side of the machine. So I edit /etc/fstab to include these two lines: /dev/hda1 /dev/hda2
/nt/c /nt/d
ntfs ntfs
defaults,user,ro,umask=002,gid=100 0 0 defaults,user,ro,umask=002,gid=100 0 0
The various options mean: ‘ro’ mounts the file system as read-only; ‘user’ lets any user mount the file-system; ‘nohide’ shows hidden and associated files; ’noexec’ avoids regular files showing up as non-executable. Then create directories for the mount points: # mkdir /nt/c # mkdir /nt/d
As any user can then mount the drives: # mount /nt/c # mount /nt/d
441
442
NT File System
These will be mounted each time you reboot, unless you add the ‘noauto’ option to the appropriate lines in [NTFS]/etc/fstab. Users are granted access to [NTFS]/nt/c and [NTFS]/nt/d through the use of the umask=002,gid=100 in the fstab, and then add trusted users to this group. You can allow access for only a specific user by adding ”uid=1000,gid=1000” to the options. Or you can remove all security and give complete access to everyone with umask=000 (this is dangerous as any login will be able to peruse your possibly private and password containing files on the NTFS partition). Note that permissions on the mountpoint itself ([NTFS]/nt/c are irrelevant: when you mount a filesystem the permissions of the mounted filesystem’s root directory replace the permissions of the mountpoint, even when the filesystem in question does not support permissions. If you need to transfer files from your linux partition to your NTFS partition then Explore2fs is an option. Have a look at http://uranus.it.swin.edu. au/~jn/linux/explore2fs.htm
Chapter 65 OpenOffice OpenOffice began life as StarOffice from the German company StarDivision. Sun Microsystems purchased it and made it open source and also sells it as StarOffice. To start up OpenOffice: $ openoffice
65.1
OpenOffice Writer
OpenOffice Writer can be used for a variety of tasks including business letters, documentation and desktop publishing. Flexible layout and design options make support multicolumn newsletters and brochures. Indexing can be used for bibliographical and index entries and keywords as well as the generation of indexes and reference tables (such as a table of contents). Groupware features support easy collaboration with others on the same document, while keeping track of changes. Export to HTML means you can create your own web site with hyperlinks, frames, and image maps.
65.2
Dictionaries
The UK dictionary should be installed as the package myspell-en-gb. Previously to install the English (UK) dictionary one had to: 443
444
OpenOffice
Figure 65.1: Sample Writer from StarOffice
$ wget http://dict.progbits.com/en_GB.zip $ cd /usr/lib/openoffice/share/dict/ooo $ sudo unzip ~/en_GB.zip $ chmod u=rw,go=r *en_GB* $ sudo zile dictionary.lst DICT en GB en_GB $
Then in openoffice enable the GB dictionary and disable the US dictionary. Go to Tools→Options. Language Settings→Writing Aids→Edit. Turn off US spelling (keep US hyphenation) and then English UK and turn on spelling (and US hyphenation). Then in Language Settings→Languages choose English UK. The thesaurus with the GB dictionary does not exist. There is a US thesaurus though. To make it available under GB add the following line to the end of /usr/share/myspell/dicts/dictionary.lst:
65.3 OpenOffice Impress
445
THES en GB th_en_US
65.3
OpenOffice Impress
Impress is the PowerPoint equivalent in OpenOffice. Generally, you can load and present PowerPoint presentations with little difficulty in Impress. Fonts are often the main cause of problems though, with some MSWindows fonts not available under other operating systems. This manifests itself most often with bullets which use the wingding font in PowerPoint. To have these automatically converted to dingbats in OpenOffice, go to ToolsOptions-Fonts. Specify Font as Wingdings and Replace With Dingbats and click the tick. Should fix it, although the bullets are replaced with stars! Quotes are still a problem in the translation.
446
OpenOffice
Chapter 66 Oracle: Commercial Database Installing Oracle on Debian involves obtaining the Oracle tar file, setting up an Oracle user and some Oracle groups, and running the Oracle installation software. See http://openacs.org/doc/openacs-4/oracle.html for details.
66.1
Obtaining the Distribution
Oracle can be downloaded from http://otn.oracle.com/software/content. html. Obtain the appropriate tar file e.g. linux817.tar. Extract the archive: # cd /ktnet/oracle # tar xvf linux817.tar
66.2
Oracle User and Groups
Create a user for Oracle to run as: # adduser oracle
Then create various groups which normal users might belong to in order to administer Oracle. 447
448
Oracle: Commercial Database
# addgroup dba # addgroup oinstall
And add user oracle to these groups: # adduser oracle dba # adduser oracle oinstall
For this new oracle user edit /home/oracle/.bash\_profile to add the following lines: export export export export export export export
ORACLE_BASE=/ktnet/oracle ORACLE_HOME=$ORACLE_BASE/product/8.1.7 PATH=$PATH:$ORACLE_HOME/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib ORACLE_SID=ora8 ORACLE_TERM=vt100 ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
umask 022
Now make sure the appropriate installation directory is set up: # cd /ktware # mkdir oracle # chown -R oracle.dba oracle
66.3
Oracle Installation
Log in as the oracle user and run the install utility: # su - oracle $ cd /ktware/oracle $ ./runInstaller
You now proceed through a collection of setup screens. File Locations The source should be a path to stage/products.jar and the destination should be /ktware/oracle/product/8.1.7.
Chapter 67 Partitions
Partitioning of your hard drive(s) can be as trivial as creating just two partitions (one for swap and the rest for the installation and everything else) or as complex as creating many partitions for different parts of the system to use. An argument for creating multiple partitions is that filling up one partition won’t impact on other partitions (which could be a problem if the system is unable to function properly because the disk is full). Also corrupting one partition (although rare) won’t affect another, thus it is good to keep the system partition separate from the user partitions. The decision is yours.
67.1
Sample Usage
It is useful to see where the disk is being used for an installed system. Below we identify the usage on several systems at some specific time. 449
450 Host Disk /bin /boot /dev /etc /home /lib /sbin /tmp /usr /var
Partitions Altrop Festival 66G 69G 3M 3M 21M 37M 32M 21G 153M 4M 2G 5G 21G
37M 2G 124M 4M 0G 4G 16G
Cultus 36G 3M 17M
Mint 8G 3M 10M 60M 27M 38M 2G 3G 89M 80M 3M 3M 2M 6M 3G 3G 2G 284M
Notes: The 16G in /var on Festival (Section 5.9.10) is taken up with database files for mysql. Similarly, on Altrop (Section 5.9.20) 19G of the 21G is in /var/lib/mysql.
67.2
Suggested Partitioning
A very useful guide written by Karsten Self is available from http://kmself. home.netcom.com/Linux/FAQs/partition.html. The simplest of partitioning scheme is to have three partitions, one for / (4GB-10GB perhaps), one for swap (2 times available RAM) and the rest as /home. This may well suffice and avoids users filling up the root partition and the system thus having problems. A significantly (and perhaps unnecessarily) more complex scheme, and one that is often recommended based on the Debian distribution and the Filesystem Hierarchy Standard is:
67.2 Suggested Partitioning Path swap /
/tmp /boot /usr
/var
/etc
/usr/local
/home
Size 2xRAM
451
Rationale An old rule of thumb. Generally there’s plenty of disk space to handle this. 50MB–100MB This is where the base system lives and contains just enough to boot a system, and will allow you to boot into single user mode in case of catastrophe elsewhere on the disk. By being small it is less prone to corruption as a result of a system crash. On a typical server (maximum of PLYMZ and Velox (Section 5.9.26)) it contains bin (2MB), lib (40MB), root (15MB), and sbin (2MB). The directory is usually static and unshareable. 50MB–100MB It is empty after reboot. 16MB It is 6MB on PLYMZ, 2MB on Velox (Section 5.9.26). 500MB-2GB This directory is usually static and shareable. It is 1GB on PLYMZ, 2GB on Velox (Section 5.9.26). This includes /usr/local. 200MB–500MB This directory is variable with some parts shareable and others not. Often used for email and news feeds. It is 1GB on PLYMZ, 2GB on Velox (Section 5.9.26), and both are being used as web servers. This directory is usually static and unshareable. It is 5MB on PLYMZ, 10MB on Velox (Section 5.9.26). 200MB-2GB This directory is usually shareable. Typically for local networks this is mounted from a server. It is 500MB on Velox (Section 5.9.26) acting as a server. 200MB This directory is usually shareable. Typically for local networks this is mounted from a server. It is 4GB on Velox (Section 5.9.26) acting as a server.
452
/ktnet
67.3
Partitions
(remainder)
This is used for a networked environment where disk space on each machine is shared. Create a subdirectory on /ktnet with the name of this host with the intention of NFS mounting this on other hosts in the network. Mount other hosts’ /ktnet areas here.
Repartitioning MS-Windows
Your computer perhaps came with MS-Windows installed and perhaps two partitions on the hard drive, one called the C: drive and the other called the D: drive. These are simply areas on the disk that have been allocated to each of these “drives.” The partition essentially marks where on the disk the boundaries are between the different drives. The raw bits associated with each drive are then organised in some way to create a filesystem. The C: drive and the D: drive probably have the FAT or the FAT32 filesystem. (Under GNU/Linux these drives are usually identified as /dev/hda1 and /dev/hda2.) These two partitions (or however many your computer came with—perhaps just one) will probably have been arranged to fill the whole of the hard drive, leaving no room for any other operating system. So, if you wish to keep a dual boot system you need to move these partitions to make room for other partitions (with different organisations of the bits—that is, different types of file systems). Changing the size of an existing partition can damage the data on that partition although by carefully following certain steps this should not happen. Nonetheless be sure to make a backup of the current partitions if you can. This is important if you have data on the system you do not want to lose. The first step is to decide how much space you need for each of your partitions. For a 6GB hard drive you might give 3GB to Win32 and 3GB to GNU/Linux. But this depends on how much space you are currently using. Next, the aim is to move all of the data on the current partitions to the beginning of the partition, then change the location of the end of the partition. The Win32 tool fips is commonly used to perform this rearrangement of partitions.
67.3 Repartitioning MS-Windows
453
The fips toolkit consists of three files: two executables (RESTORRB.EXE and FIPS.EXE) and a text file (ERRORS.TXT). These should be copied to a bootable floppy (created under Win32 with the DOS command sys a:). Now under Win32 run your disk de-fragmenter (the DOS command defrag). When finished reboot your computer, booting from the fips floppy disk. Then simply type a:\fips and fips will let you know what to do next.
454
Partitions
Chapter 68 Passwords If you forget your password for root, then you will be in a spot of bother. One way to fix this is to reboot the machine using the Debian installation floppy or CD. When you get the first question (about the having a colour monitor) press CTRL-ALT-F1 to get a shell. Mount your root partition (let’s say it is /dev/hda1): # mount /dev/hda1 /mnt
then edit the password file to erase the encrypted password for root: # editor /mnt/etc/passwd
Save the file then reboot (CTRL-ATL-DEL).
68.1
Password File Sharing
NIS, which manages password file sharing among several hosts, provides the simplest mechanism for doing this, but there are alternatives that can work for small networks (2 or 3 machines). You can maintain the passwd, shadow, group, and gshadow files on a server Altrop (Section 5.9.20) and copy them across to the other machines as needed, as described below, using rdist! The downside is that all new users should be added on the server and passwords should be changed on the server only with the appropriate password files then pumped out to the other hosts. 455
456
68.1.1
Passwords
Using rdist
The rdist package can be used to update files on a collection of hosts from a central host. This is what I do from Altrop (Section 5.9.20) where the password and group files are maintained. On Altrop (Section 5.9.20) in /root/distfile I have the following: KTNET = ( inco punto cultus festival atom brick prefect ) FILES
= ( /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/apt/sources.list /etc/printcap /etc/resolv.conf )
${FILES} -> ${KTNET} install -oyounger,chknfs,savetargets;
Thus I have seveb hosts that are updated with seven files from altrop. The options for install include: younger so that if the remote host has update the files they won’t be updated from altrop, and instead I need to have a look at them to see what has changed; chknfs so that NFS mounted files are not updated; and savetargets so that old copies are placed in .OLD files so I can then compare what has changed! The command to do the update is: # rdist -F -P /usr/bin/ssh
This will use ssh to communicate and will do it serially (-F) so that the passwords that are asked for don’t interfere with each other!
68.1.2
Simple tar
When a new user is added (using adduser) the files need to be copied to each of the other hosts. A simple way is to tar up the files, copy them to a NFS mounted are (e.g., a trusted user’s home directory), log in as root on the other host, cp the tar file to /tmp so that root can access it (root access to the NFS mounted home directories is not permitted) and then untar it in /etc. This is okay for a small network! It also relies on /home being mounted by NFS from the master (altrop). Still, I need a better solution.
68.1 Password File Sharing
68.1.3
457
Using NIS
NIS is used to share password files among a collection of machines. This ensures all users have access to all machines and have the same user id and group ids. The group of machines is referred to with a domain name (nothing to do with a network domain name though). One machine in the group must be a master server and the rest are nis clients of that server. You can also have slave servers but we’ll ignore that one for now. Setting Up The Master Server To set up the master NIS server on Caravan (Section 5.9.5): caravan$ wajig install nis
You will be asked to name the nis domain. You can call it anything and later edit it in /etc/defaultdomain. Let’s call it ktnet.togaware.com (it has no formal relationship to the network domain name). In the file /etc/default/nis set NISSERVER=master to identify caravelle as the master server. To restrict who can access you NIS server add your local network number to the file /etc/ypserv.securenets Now restart the NIS server: $ wajig restart nis
Now set up the server: # touch /etc/networks # /usr/lib/yp/ypinit -m
(because it does not exist)
You will be asked to list all of your servers (just caravelle for now). This essentially builds the maps from the current password file on caravelle. Note that you can’t use the nis maps on caravelle itself - don’t remove the users from caravelle’s password file!
458
Passwords
Setting Up The Client To set up the NIS client on Festival (Section 5.9.10): festival$ wajig install netbase portmap nis
You will be asked the name of the nis domain. You must use the name you supplied to the master server (ktnet.togaware.com). It is stored in /etc/defaultdomain. Specify the NIS server address in /etc/yp.conf: ypserver 105.229.8.170
Restart the client: $ wajig restart nis
Now edit the passwd, shadow, group and gshadow files. In passwd remove all the users (anyone with a user id in the 1000’s) and add: +::::::
And in shadow: +::::::::
Then in groups and gshadow files, similarly remove the users and add: +:::
NIS should now be working. Certainly ypcat passwd should show the users in NIS.
Chapter 69 PPP: Networking Over Modems For Debian use pppconfig to configure your network connections. This tool will request the appropriate information and knows about chat scripts and PAP connections. It will ask you to name the connection you want to configure, with a default name of provider. It will then generate the appropriate configuration scripts in [ppp]/etc/chatscripts/provider and [ppp]/etc/ppp/peers/provider (the provider in these paths is replaced with the name you supply pppconfig). The plog command will show you the ppp log which is in [plog]/var/log/ppp.log. To watch the plog file issue the command plog -f as root or else as a user in the group adm. The pppconfig command allows you to configure your modem connections. Essentially it is a front end to the various scripts in /etc/ppp. My PCMCIA modem is loaded at /dev/ttyS1. Newer versions of ppconfig check the serial ports for modems for you. Usually, /dev/ttyS0 corresponds to COM1 under MS-Windows and /dev/ttyS1 corresponds to COM2. To allow users other than root to connect through the modem (using the pon and poff pair of commands) add the users to the Unix group ”dip”: # adduser kayon dip
Then, next time user kayon logs on he will be in group dip in addition to the other groups he was already in. He will then be able to initiate and 459
460
PPP: Networking Over Modems
terminate a dial up session. However, user kayon does not have access to the log file through the plog command—only root does, presumably for security reasons, since unless you inhibit it, passwords can be displayed there. Further information on PPP is available from
69.1
modemlights applet
This is the Gnome applet I use for modem access. After adding a user to the ”dip” Unix group they can use this applet to dial the modem, display transfers, and to hangup. Under properties I had to change the connect and disconnect commands to be pon and poff rather than pppon and pppoff (which don’t exist — perhaps this is a ”problem”). The newer Potato version of the applet had the defaults correct.
Chapter 70 Presentations 70.1
Beamer
This is an excellent package for LATEX to generate PDF based presentations. It is a newer alternative to prosper (see Section 70.2).
70.2
Prosper
Prosper is a LATEX package for generating presentations with colour, animations and flair! A newer alternative that works better with PDF is beamer (see Section 70.1).
70.3
OpenOffice Impress
OpenOffice (and StarOffice) Impress is a MSPowerPoint replacement that facilitates the quick creation of impressive presentations. Special effects and vector graphics tools support animations and sound effects, and include flow chart-style shapes. An AutoPilot tools steps the user through the process of creating Web-based slide shows. Predefined presentation layouts are also provided. 461
462
Presentations
Figure 70.1: Sample Impress from StarOffice
70.4
KPresenter
Chapter 71 Printing 71.1
CUPS - Common Unix Printing System
Debian Pacakges: cupsys, cupsys-client, cupsys-bsd, cupsys-driver-gimpprint cupsomatic-ppd, a2ps, hp-ppd, foomatic-db, gsfonts-other. CUPS is a newer printing system and may become the preferred printing system for Unix and GNU/Linux. It uses PPD (PostScript Printer Description) files to identify the features of a printer. This allows printer configurations to be maintained and provides access to the printer options through the command line. It also has client side filters to convert, for example, PDF to PostScript to avoid the dreaded raw output of PDF.
71.1.1
Add Printing to New Host
If you have CUPS set up already on a server, and you generally have the same environment on your desktop machines, when setting up a new host, simply install the packages listed above. Then copy over the appropriate configuration files:
# # # #
cd /etc/cups scp ktw:/etc/cups/printers.conf . scp ktw:/etc/cups/ppd/* ppd chmod o+r ppd/*.ppd
463
464
Printing
Always keep your configuration up to date on the server, perhaps using the web interface via []http://ktw:631/. (If you use instead the command line interface with the command lpadmin then you also need to copy lpoptions across.) A convenient way to keep the configurations consistent is with rdist (see Section 68.1.1 for an example).
71.1.2
Using the Web Interface
After installing cupsys visit http://localhost:631/ to add a printer to your host Bartok (Section 5.9.19). The example here adds a network printer (that we identify as hplj in /etc/hosts where it is associated with address 192.168.0.6) using a HP JetDirect device to connect a HP LaserJet 1200. Name: lp0 Location: Richard’s Desk Description: HP LaserJet 1200 Device: AppSocket/HP JetDirect URI: socket://hplj:9100/ Make: HP Model: HP LaserJet 1200 Series PS (en)
If you are using the web interface and now go to the printer and get a permission denied error, chances are it is because your browser is going to bartok.act.ktware.com rather than localhost. You can edit /etc/cups/ cupsd.conf to give permission for all local hosts (since in my setup I have printers configured on the server then use rdist to distribute the configuration to all clients): ... Allow From 192.168.0.* ... ... Allow From 192.168.0.*
You could use .act.ktware.com instead to allow access from any host in your domain. Then restart the cupsys daemon:
71.1 CUPS - Common Unix Printing System
465
$ wajig restart cupsys
Print a test page to make sure it works. Also, go into Configure Printer to set Page Size to A4, and any other default settings, like duplex printing.
71.1.3
Installing a HP PSC 2210
# cd /usr/share/cups/model # foomatic-datafile -t cups -d hpijs -p HP-PSC_2210 > HP-PSC_2210-hpijs.ppd # wajig restart cupsys
Then the printer is listed as Make Hewlett-Packard (not HP) in the web interface to CUPS. Simply choose it.
71.1.4
Enabling a Printer
# /usr/bin/enable lp1
71.1.5
CUPS Command Line Interfaces
You can also simply use the command line to administer the printers. You can add a network printer enable the printer with: # lpadmin -p hplj -v socket://192.168.0.6:9100/ -E
Another example for a LPD print server: # lpadmin -p lp1nd -v lpd://printhost/lp1nd -E
To add information about the Location and a Description of the printer: # lpadmin -p lp0 -L "Level 2 South" -D "HP LaserJet 4"
To specify a PPD for the printer:
466
Printing
# lpadmin -p lp7 -P /usr/share/postscript/ppd/HP_LaserJet_4050_Series.ppd # lpadmin -p lp11 -P LEXC750.PPD
The PPD file is copied into /etc/cups/ppd/lp11.ppd, for example. You can look at the printer options (assuming it has a PPD) with:
# lpoptions -p lp7 -l
And you can set options with:
# lpoptions -p lp7 -o PageSize=A4 # lpoptions -p lp1 -o PageSize=A4
And so on. These options are placed in /etc/cups/lpoptions. The same options can be set using the web interface. The web interface is indeed somewhat easier to use, and it modifies the PPD file directly (e.g., /etc/ cups/ppd/lp1.ppd) rather than using the /etc/cups/lpoptions file! You can access printer options directly from the command line when printing, if the printer’s PPD supports the option. For example, the HP LaserJet 4050 driver I’m using (from hp-ppd) supports n-up printing and watermarks:
$ lp -o HPNup=TwoUpL sample.pdf $ lp -o HPwmText=Draft odbcmine.pdf
71.2
Using lprng to Print on Remote Hosts
$ wajig install lprng $ sudo emacs -nw /etc/printcap .common: :sd=/var/spool/lpd/%P :sh:mx=0:mc=0 lp1:tc=.common:lp=lp1@atria $ wajig start lprng
71.3 Using rlpr to Print on Remote Hosts
71.3
467
Using rlpr to Print on Remote Hosts
A collection of Debian machines can be serviced by a remote printer server running a printer daemon lpd. A simple approach to printing is then to install rlpr. This provides the commands rlpr, rlpq, and rlprm. They can be used as replacements for the usual lpr, lpq, and lprm commands. You can make these “aliases” permanent by linking them into /usr/local/bin as in: # # # #
cd ln ln ln
/usr/local/bin -s /usr/bin/rlpr lpr -s /usr/bin/rlpq lpq -s /usr/bin/rlprm lprm
To specify the pinter on which to print you need to include in the printer name the print server host, as in [email protected]. This can be improved on by creating a /etc/rlprrc file with something like: artz.togaware.com: lp1 lp1nd lp5 lp5t lp7 lp9
Make sure the protections on the file allow everyone to read the file. Then when specifying a printer, simply mention its name, as in -Plp1 or set the PRINTER environment variable to "lp1".
468
Printing
Chapter 72 Python Debian Pacakges: python-base python-dev python-doc python-examples pythongdbm python-mpz python-regrtest python-tk python-xmlbase Python is a programming language that is similar to Java in some respects, but has fewer of the overheads of Java, and generally at a higher level than Java. It is an excellent choice as a glue language. Being interpreted, it is also excellent for rapid prototyping, with common experience being that applications can be developed 5 times more quickly in Python than in Java. See http://www.ferg.org/projects/python_java_side-by-side. html for more details of such a comparison. A number of products use Python as a scripting and extension language, including OpenOffice.
72.1
Python Documentation
All python packages are self documenting, and the documentation can be obtained using the pydoc command:
$ pydoc csv
469
470
Python
72.2
Python and R: Python Interfaces to R
R is a powerful and freely available statistical language. In Debian it is installed as r-base. The Debian packages are also available from the comprehensive R archive network (or CRAN) by adding the following line to your /etc/apt/sources. list: deb http://cran.r-project.org/bin/linux/debian woody main # wajig install r-base
We can now install either RSPython or RPy. Both provide a Python interface to R, and RSPython also provides an R interface to Python while RPy is generally easier to use than RSPython! RSPython is not packaged for Debian yet, but RPy is.
72.2.1
Installing RSPython
$ wget http://www.omegahat.org/RSPython/RSPython_0.5-1.tar.gz
Then install RSPython in R: # R CMD INSTALL --clean RSPython_0.5-1.tar.gz
This command, executed as the root user has then installed the required files into /usr/lib/R/library/RSPython. To communicate where the files are installed to Python we need to set up three environment variables (a Debian package would probably set this up so that these extra environment variables are not required), and then run Python and try out some RSPython calls: $ $ $ $ $
export export export export python
R_HOME=/usr/lib/R PYTHONPATH=${R_HOME}/library/RSPython/Python PYTHONPATH=${PYTHONPATH}:${R_HOME}/library/RSPython/libs LD_LIBRARY_PATH=${R_HOME}/bin
72.2 Python and R: Python Interfaces to R
471
Python 2.2.1 (#2, Sep 13 2002, 23:25:07) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import RS Initialized R-Python interface package. >>> RS.call("rnorm", 10) [-0.65567988872831473, 0.67905969371540564, -1.1444361954473865, 0.81452303045337249, 0.72703311800839554, 0.86401079894005484, -2.0267500136837922, 1.3879521193129922, -0.59819064121768595, 1.1045450495203162] >>> RS.call("plot", [1,2,3,4]) >>> RS.call("plot", RS.call("rnorm",10)) >>> ^D
If you get: $ python >>> import RS Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/R/library/RSPython/Python/RS.py", line 1, in ? import RSInternal ImportError: /usr/lib/atlas/libblas.so.2: undefined symbol: e_wsfe >>>
Then be sure that you don’t have atlas2-base installed: $ wajig remove atlas2-base
72.2.2
Installing RPy
For sophisticated plotting using the R package see Chapter 73. Install python-rpy. Older approaches did: $ wajig install rpy_0.3.1-1_i386.deb $ (cd /usr/lib; sudo ln -s R/bin/libR.so)
472
Python
Then test it with:
$ python Python 2.3.1 (#2, Sep 24 2003, 11:39:14) [GCC 3.3.2 20030908 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from rpy import * >>> l = [r.dchisq(x, 4) for x in r.seq(0, 10, by=0.1)] >>> r.par(ask=1, ann=0) {’ask’: 0, ’ann’: 1} >>> r.plot(l, type=’lines’) Hit to see next plot: >>> r.dev_off() {’null device’: 1} >>> ^D
To install it by hand until rpy debian package is released:
$ cd /tmp $ wget http://easynews.dl.sourceforge.net/sourceforge/rpy/rpy-0.2.tar.gz $ tar zxvf rpy-0.2.tar.gz $ cd rpy-0.2 $ sudo python setup.py install $ sudo emacs -nw /etc/ld.so.conf Add the line: /usr/lib/R/bin $ sudo ldconfig $ python Python 2.2.1 (#2, Sep 7 2002, 15:35:22) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from rpy import * >>> l = [r.dchisq(x, 4) for x in r.seq(0, 10, by=0.1)] >>> r.par(ask=1, ann=0) >>> r.plot(l, type=’lines’) >>> ^D $ cd .. $ sudo rm -rf rpy-0.2*
For earlier versions of rpy I used to get:
72.2 Python and R: Python Interfaces to R
473
$ python >>> from rpy imprt * Traceback (most recent call last): File "", line 1, in ? File "rpy.py", line 24, in ? import _rpy ImportError: /usr/lib/atlas/libblas.so.2: undefined symbol: e_wsfe >>>
then you needed to remove atlas2-base. $ wajig remove atlas2-base
However, more recently this packages is actually required to run R and rpy! With version 0.3.1 of rpy I get the following (11 Aug 03): > python2.2 Python 2.2.3+ (#1, Aug 10 2003, 10:11:23) [GCC 3.3.1 (Debian)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import rpy Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/rpy.py", line 24, in ? import _rpy ImportError: /usr/lib/python2.2/site-packages/_rpymodule.so: undefined symbol: jump_now >>>
Also happens for python2.3 (11 Aug 2003).
474
Python
Chapter 73 R: Statistical Software Debian Pacakges: r-base There is an excellent selection of very high quality statistical software available for Debian GNU/Linux. A favourite is R, an open source version of S/SPlus, widely used in the academic statistical community. While R has it’s own interpreter and interactive shell, the examples provided here use the RPy interface (Section 72.2.2) so that we can use R inside of Python programs. This is simply a convenience of staying within the one environment.
73.1
Graphs
R is excellent for generating graphs in many formats, including PostScript, PDF, PNG, and JPG. A highly recommended approach is to generate graphs in xfig format. These can then be loaded into the xfig application, for example, for further editing, if absolutely needed (perhaps you want to make minor changes but have lost the original R code used to generate the graph). And for LATEX processing the rubber package will automatically convert them to the appropriate EPS or PDF format. Of course, xfig can also generate PNG and JPG and many other formats.
475
476
R: Statistical Software
Generate a simple line and point graph: Here’s an interactive example to demonstrate the generation of a simple line graph. $ python >>> from rpy import * >>> l = [1,2,3,4,5,4,5,3,6,2,3,4,8,2,1] >>> r.postscript("rplot01.eps") >>> r.plot(l, type=’b’, xlab="Days", ylab="Services") >>> r.dev_off()
Two lines with a legend: The following Python script generates a PNG graphic with two lines drawn. from rpy import * import os dates = (’Jul-98’, ’Aug-98’, ’Jan-99’, ’Feb-99’, death30 = (2.02, 1.53, 2.73, 3.87, 6.11, 3.23, death6m = (1.52, 2.55, 3.28, 4.42, 5.68, 8.29,
’Sep-98’, ’Oct-98’, ’Nov-98’, ’Dec-98’, ’Mar-99’, ’Apr-99’, ’May-99’, ’Jun-99’) 3.09, 2.37, 2.60, 4.52, 4.27, 1.40) 1.55, 0.95, 3.65, 15.08, 32.70, 75.52)
r.png("rplot02.png") r.par(cex=1.5) r.plot(death6m, type="b", xlab="Month", ylab="Percentage", lty=1, pch=0, axes=False)
73.1 Graphs
477
r.lines(death30, type="b", lty=2, pch=1) r.box() r.axis(1, at=range(1,len(dates)+1), labels=dates) r.axis(2, at=range(0,100,10)) r.legend(1, 60, (’Deaths before 30 days’, ’Deaths before 6 months’), lty = (2, 1), pch=(1, 0)) r.dev_off() os.system("gv rplot02.png")
Generate a bar plot: Here’s a more complete Python program to generate a barplot #!/usr/bin/env python from rpy import * import Numeric import os,sys ext = ’fig’ if len(sys.argv) > 1: ext = sys.argv[1] dev = {’eps’ : (r.postscript, ’gv’), ’pdf’ : (r.pdf, ’xpdf’), ’png’ : (r.png, ’display’), ’fig’ : (r.xfig, ’xfig’)} fn="rplot03." + ext dev[ext][0](fn) ages = (’0-19’, ’19-60’, ’61-100’) labels = (’Asthma’, ’Diabetes’, ’Cancer’, ’Mental’, ’Surgery’) bars = Numeric.array([[25,15,26,25,18],[45,32,28,12,45],[27,35,56,34,28]])
478
R: Statistical Software
r.barplot(bars, beside = True, legend = ages, ylim = (-7, 60), col = ("lightblue", "mistyrose", "lightcyan")) r.text((2,6,10,14,18), (-2,-2,-2,-2,-2), labels = labels, pos = 4) r.title(main = "Sample Bar Plot", font_main = 4) r.dev_off() os.system(dev[ext][1] + " " + fn)
73.1 Graphs Generate a pie chart: from rpy import * import os dates = (’A’, ’B’, ’C’, ’D’, ’E’, ’F’) percs = (25, 12, 35, 8, 10, 10) labs = () for i in xrange(len(dates)): labs += ("%s (%d%%)" % (dates[i], percs[i]),) r.postscript("rplot04.eps") r.pie(percs, labels=labs) r.dev_off() os.system("gv rplot04.eps")
479
480
R: Statistical Software
Chapter 74 Rsync: Remote Files 74.1
Rsync Server
To set up an rsync server simply install the rsync package then copy /usr/ share/doc/rsync/sample-rsyncd.conf.gz to /etc/rsyncd.conf. Edit it to perhaps turn logging on:
log file=/var/log/rsyncd ... transfer logging = yes
Make sure that port 873 is allowed through your firewall. Add the following line to /etc/inetd.conf: rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
Then restart inetd by sending it a HUP. The rsync server works with modules. Modules are defined in the configuration file. A list of modules is returned from an rsync server when the server is queried:
$ rsync datamining.csiro.au:: debianbook Graham’s Debian GNU/Linux Survival Guide
481
482
Rsync: Remote Files
For each module (debianbook in the above) you identify a it’s configuration, including a path to where it lives, for example: [debianbook] comment = Graham’s Debian GNU/Linux Survival Guide path = /var/www/debian/book read only = yes list = yes uid = nobody gid = nogroup transfer logging = yes ...
To get a directory listing from an rsync server: $ rsync datamining.csiro.au::debianbook/
To have your local server start up at boot time add the following to /etc/ inetd.conf: rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
After editing the /etc/rsyncd.conf file be sure to send the process a HUP signal.
Chapter 75 Samba Debian Pacakges: samba swat The swat package is a nice web based administration tool. Highly recommended. If using encrypted passwords (default) then need to add users using the password manager in swat or with the command line smbpasswd. You may also need to set the encrypted password option in /etc/samba/smb.cnf: encrypt passwords = true
Note that the default installation provides access to user homes straight out of the box.
483
484
Samba
Chapter 76 Scanning The usual GNU/Linux scanner interface is called sane (Scanner Access Now Easy).
76.1
Setup HP PSC 2210
Debian Pacakges: hpoj # ptal-init setup Probe parallel (n) Probe USB (y) Setting up as "mlc:usb:PSC_2200_Series" # wajig restart cupsys Reconfigure cupsys printer at http://localhost:631 For the URI choose ptal:/mlc:usb:PSC_2200_Series
Note that the hpoj daemon is the one to start/stop when changing hpoj options. Test it works as a user: > ptal-devid MFG:Hewlett-Packard;MDL:PSC 2200 Series; CMD:MLC,PCL,PML,DW-PCL,DYN;CLS:PRINTER; 1284.4DL:4d,4e,1;SN:MY32AF320G0G; S:0380008084021000002c148005cc250005c;AiO:0;
485
486
Scanning
If permission problems (printing works just fine but can’t access the device for scanning etc.), then try: # chmod o+rx /dev/ptal-printd
76.2
Scanning Setup
Debian Pacakges: xsane sane-utils Plug in the scanner (perhaps to the USB port). Then run xsane which will try to find it. If there are problems finding the scanner, then make sure the scanner kernel module is loaded: # insmod scanner
If you still have problems, try disconnecting the USB scanner and plug it back in.
Chapter 77 Science 77.1
Chemistry
77.1.1
Periodic Tables
The gnome periodic table is a simple periodic table.
Figure 77.1: The Gnome Periodic Table
487
488
Science
Chapter 78 Security 78.1
Booting Linux
You can protect against just anyone booting your system into Linux by disabling booting from floppy disk and CD-ROM in the BIOS, and by password protecting LILO.
78.2
Checking Security with Nessus
The nessus package is an excellent package for checking known security problems. Install on one machine both nessus (the client) and nessusd (the server). For nessusd you need to create a user account using nessusd-adduser. One suggestion is to simply create a user with the same name as your user account (e.g., kayon). Then start the daemon (server) with: # nessusd -D
Note that this daemon is not automatically run within the /etc/init.d framework. As a user start up the nessus client and login with your user name. Go to the Target selection tab and type in a list of hosts you wish to check, comma 489
490
Security
separated. If you want to test all machine on your network, try something like 192.167.0.1/24. After you click Start the scan the checking is initiated. Eventually a report will be presented. You can save the report in various formats, including LATEX. The testing is extensive and the report provides suggestions for eliminating security holes.
78.3
Check Security with Chkrootkit
The chkrootkit package provides the chkrootkit command to check for signs of rootkits on the local system. Run the command as root and scan the output for warnings.
# chkrootkit ROOTDIR is ‘/’ Checking ‘amd’... not found Checking ‘basename’... not infected Checking ‘biff’... not found Checking ‘chfn’... not infected Checking ‘chsh’... not infected Checking ‘cron’... not infected Checking ‘date’... not infected Checking ‘du’... not infected Checking ‘dirname’... not infected Checking ‘echo’... not infected Checking ‘egrep’... not infected Checking ‘env’... not infected Checking ‘find’... not infected Checking ‘fingerd’... not found Checking ‘gpm’... not found Checking ‘grep’... not infected Checking ‘hdparm’... not infected Checking ‘su’... not infected Checking ‘ifconfig’... not infected Checking ‘inetd’... not infected Checking ‘inetdconf’... not infected Checking ‘identd’... not found
78.3 Check Security with Chkrootkit
491
Checking ‘init’... not infected Checking ‘killall’... not infected Checking ‘ldsopreload’... not infected Checking ‘login’... not infected Checking ‘ls’... not infected Checking ‘lsof’... not found Checking ‘mail’... not infected Checking ‘mingetty’... not found Checking ‘netstat’... not infected Checking ‘named’... not found Checking ‘passwd’... not infected Checking ‘pidof’... not infected Checking ‘pop2’... not found Checking ‘pop3’... not found Checking ‘ps’... not infected Checking ‘pstree’... not infected Checking ‘rpcinfo’... not infected Checking ‘rlogind’... not found Checking ‘rshd’... not found Checking ‘slogin’... not infected Checking ‘sendmail’... not infected Checking ‘sshd’... not infected Checking ‘syslogd’... not infected Checking ‘tar’... not infected Checking ‘tcpd’... not infected Checking ‘tcpdump’... not infected Checking ‘top’... not infected Checking ‘telnetd’... not found Checking ‘timed’... not found Checking ‘traceroute’... not found Checking ‘vdir’... not infected Checking ‘w’... not infected Checking ‘write’... not infected Checking ‘aliens’... no suspect files Searching for sniffer’s logs, it may take a while... nothing found Searching for HiDrootkit’s default dir... nothing found Searching for t0rn’s default files and dirs... nothing found Searching for t0rn’s v8 defaults... nothing found Searching for Lion Worm default files and dirs... nothing found Searching for RSHA’s default files and dir... nothing found Searching for RH-Sharpe’s default files... nothing found Searching for Ambient’s rootkit (ark) default files and dirs... nothing found Searching for suspicious files and dirs, it may take a while... nothing found
492
Security
Searching for LPD Worm files and dirs... nothing found Searching for Ramen Worm files and dirs... nothing found Searching for Maniac files and dirs... nothing found Searching for RK17 files and dirs... nothing found Searching for Ducoci rootkit... nothing found Searching for Adore Worm... nothing found Searching for ShitC Worm... nothing found Searching for Omega Worm... nothing found Searching for Sadmind/IIS Worm... nothing found Searching for MonKit... nothing found Searching for Showtee... nothing found Searching for OpticKit... nothing found Searching for T.R.K... nothing found Searching for Mithra... nothing found Searching for OBSD rk v1... nothing found Searching for LOC rootkit ... nothing found Searching for Romanian rootkit ... nothing found Searching for Suckit rootkit ... nothing found Searching for Volc rootkit ... nothing found Searching for Gold2 rootkit ... nothing found Searching for TC2 Worm default files and dirs... nothing found Searching for Anonoying rootkit default files and dirs... nothing found Searching for ZK rootkit default files and dirs... nothing found Searching for ShKit rootkit default files and dirs... nothing found Searching for anomalies in shell history files... nothing found Checking ‘asp’... not infected Checking ‘bindshell’... not infected Checking ‘lkm’... You have 5 process hidden for ps command Warning: Possible LKM Trojan installed Checking ‘rexedcs’... not found Checking ‘sniffer’... eth0 is not promisc Checking ‘w55808’... not infected Checking ‘wted’... nothing deleted Checking ‘scalper’... not infected Checking ‘slapper’... not infected Checking ‘z2’... nothing deleted
Note that with current versions of ps and chkrootkit (as of 3 December 2003), ps reports the PID of some kernel processes as 0 which chkrootkit does not match to the process. Output from ps is: USER
PID %CPU %MEM
VSZ
RSS TTY
STAT START
TIME COMMAND
78.3 Check Security with Chkrootkit root root root root root root root root
1 2 0 0 0 0 0 22
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1484 0 0 0 0 0 0 0
493 488 0 0 0 0 0 0 0
? ? ? ? ? ? ? ?
S SW SWN SWN SW SW SW SW
Dec02 Dec02 Dec02 Dec02 Dec02 Dec02 Dec02 Dec02
0:00 0:00 0:00 0:00 0:00 0:00 0:00 0:00
For LKM warnings you can get the process ID with: # chkrootkit -x lkm ROOTDIR is ‘/’ ### ### Output of: ./chkproc -v -v ### PID 3: not in ps output CWD 3: / EXE 3: / PID 4: not in ps output CWD 4: / EXE 4: / PID 5: not in ps output CWD 5: / EXE 5: / PID 6: not in ps output CWD 6: / EXE 6: / PID 7: not in ps output CWD 7: / EXE 7: / You have 5 process hidden for ps command
The process information can be checked in /proc//status: > cat /proc/3/status Name: ksoftirqd_CPU0 State: S (sleeping) Tgid: 0 Pid: 3 PPid: 1
init keventd ksoftirqd_CPU0 ksoftirqd_CPU1 kswapd bdflush kupdated aacraid
494
Security
TracerPid: 0 Uid: 0 0 0 Gid: 0 0 0 FDSize: 32 Groups: SigPnd: 0000000000000000 SigBlk: ffffffffffffffff SigIgn: 0000000000000000 SigCgt: 0000000000000000 CapInh: 0000000000000000 CapPrm: 00000000ffffffff CapEff: 00000000fffffeff
0 0
You can also look at the processes involved in the pstree: > pstree -p |grep ’([34567])’ |-bdflush(6) |-ksoftirqd_CPU0(3) |-ksoftirqd_CPU1(4) |-kswapd(5) |-kupdated(7)
78.4
Identify Portscanners
There are some tools to check who is portscanning your machine and when. A good tool seems to be ippl, the IP Protocols Logger, but others include snort and portsentry. In kernel 2.4 iptables has a mechanism for portscans where you can set it up so that most portscans will take hours to return nothing.
78.5
Packages to Avoid
For security reasons the following should be avoided: • fingerd • ftp-server
78.5 Packages to Avoid
495
• ftp: Users will try to ftp to remote hosts and log in using clear text passwords. Run dsniff on the local machine as root to see that you can easily capture their passwords! • ftpd • netkit-rpc • nfs-common • nfs-kernel-server • nfs-user-server • portmap • rsh-client: Users will try to rsh to remote hosts and log in using clear text passwords. Run dsniff on the local machine as root to see that you can easily capture their passwords! The ssh package will install a replacement rsh. • rsh-server • rstart • rstartd • rusersd • rwalld • sendmail • talkd • telnet: Users will try to telnet to remote hosts and log in using clear text passwords. Run dsniff on the local machine as root to see that you can easily capture their passwords! • telnetd
496
78.6
Security
OpenPGP and Keys
Install the GNU Privacy Guard package in Debian as gnupg. This is the GNU implementation of the OpenPGP. To automatically check signatures from a keyserver add the name of a keyserver to /home/kayon/.gnupg/options file. For example: keyserver wwwkeys.au.pgp.net
This replaces the command line option --keyserver wwwkeys.au.pgp.net. To create a gpg key: > gpg --gen-key gpg (GnuPG) 1.2.3; Copyright (C) 2003 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. Please select what kind of key you want: (1) DSA and ElGamal (default) (2) DSA (sign only) (5) RSA (sign only) Your selection? 1 DSA keypair will have 1024 bits. About to generate a new ELG-E keypair. minimum keysize is 768 bits default keysize is 1024 bits highest suggested keysize is 2048 bits What keysize do you want? (1024) Requested keysize is 1024 bits Please specify how long the key should be valid. 0 = key does not expire = key expires in n days w = key expires in n weeks m = key expires in n months y = key expires in n years
78.6 OpenPGP and Keys
497
Key is valid for? (0) Key does not expire at all Is this correct (y/n)? y You need a User-ID to identify your key; the software constructs the user id from Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) " Real name: Kayon Toga Email address: [email protected] Comment: You selected this USER-ID: "Kayon Toga " Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o You need a Passphrase to protect your secret key. Enter passphrase: *********** Repeat passphrase: ********** We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. ....++++++++++.+++++++++++++++++++++++++++++++++++.+++++.++++++++++ ..+++++++++++++++++++++++++.+++++++++++++++++++++++++. ++++++++++++++++++++>+++++.+++++..>+++++.....+++++ We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. ..++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.+++++ .++++++++++..+++++++++++++++++++++++++++++++++++++++++++++ public and secret key created and signed. key marked as ultimately trusted. pub
1024D/5A829E4A 2003-04-03 Kayon Toga Key fingerprint = B0C5 F86D 98A4 40A4 B900 B1FA D0C6 2DA0 34F4 9ADB
498 sub
Security 1024g/D7DE757D 2003-04-03
To get the hex ID of your public key: > gpg --list-keys [email protected] pub 1024D/5A829E4A 2003-04-03 Kayon Toga sub 1024g/D7DE757D 2003-04-03
The hex ID here is 5A829E4A. This is required to create key-cert objects. To extract your public key block in ascii format to a file key.asc > gpg --export -a -o key.asc [email protected]
This generates: -----BEGIN PGP PUBLIC KEY BLOCK----Version: GnuPG v1.2.3 (GNU/Linux) mQGiBD6Le6QRBACa0Di6Gcx4Q3Tpghl+hu/geCBRaZUZlMxbx0yxxOgsoOb/SMzP NNNG5IdMVKrV60X8jwzCi/tx3QdKps9hE+kNESW472LDEUdbDLjxDMajyfW16k2r sxkvW3iiyQeO8catYdUm4Qt5SoU/X1/U1PGurSzC9jeMcnB5UThQ6tGs+wCg6Qgq X5NCHtzpKPWU06I7trfSEpsD/1+w3g5+qjy+s3jj+gUf3kELY1NMyrvGnsb5D8ns y9mXA35QnRGh+66gGYS5JSPB4eZLz/p6E4cum8M8UiFFIYuzdN8mec4hoT8MD1Eg +WT1S3L6337k0S+p0ePaTVFQuZw7p0O9UX1xlqCsvFXqlsQSy9ZG+2AB4wg5zR25 vnEvBACBB+js3IbvXyWsDRcEsgYHm0whA+rB0cOgYW0VxdpdgLOwhm71TAbR8KDS icbM8raWwFlA/8m5z/0CMo6izm7pI3lDUmXsrE8qsJvHawMd+Vvt5XAwEB3yonWU o6lHvZKROZuyNM5I2pT2i331Ukwbg42cRG75HD2LZnrV6CuitLQuR3JhaGFtIFdp bGxpYW1zIDxHcmFoYW0uV2lsbGlhbXNAdG9nYXdhcmUuY29tPohZBBMRAgAZBQI+ i3ukBAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCeP1CyW4KdSwVEAJ9XbkhnzcYojuII vsX3JkCK8De3qQCgqY8bbuCJyW5Ky1bPfd3mpEliObS5AQ0EPot7pRAEAIXoJqCf mWpUasWeeNICVVwM30urggwXHnOjAcKkBN8uJGK6WeHlFNJmFfd4D5bHny6sJw7X QiYZKlAwFULct55DwS/GUuko1wtPOXS1jmC3XbkzBXpWE05PgP+7BOXkZdimPm+g xZdeG/GjGGg3HVMHY13xCe0C73Ou0gKSfidrAAMFA/9VrkDyPgYNgWEKfpgqkJHD TX5cmy5Q1gKFEEKRnJGMhm8UauHIBX3SzlYylguHNFEfITPqOxNbYeMgaDwL6/7h HVegv5o93bUkqE88J3q5t0EZDRlE2yoL6vcaqyDdwhAGmwGoT2lUk9DrbIwJGmZD a6BPHIQ23Q2Av/+zl0qLI4hGBBgRAgAGBQI+i3ulAAoJEJ4/ULJbgp1LjhUAniKX qE3SGxCAVFUeIrKHk/pYqyTVAJ9WkJ31FxQWBmmw81dxsdAslDFxkg== =nrTb -----END PGP PUBLIC KEY BLOCK-----
78.7 Securing Your Network
499
To put your public key on to one of the public key servers (so others can access it) you can do: > gpg --send-key --keyserver pgp.earth.li 5A829E4A gpg: success sending to ‘pgp.earth.li’ (status=200)
You can check the key was received with: > gpg --recv-key --keyserver pgp.earth.li 5A829E4A gpg: key 5A829E4A: "Kayon Toga " not changed gpg: Total number processed: 1 gpg: unchanged: 1
The key is also now at other servers without any extra effort: > gpg --recv-key --keyserver wwwkeys.pgp.net 5A829E4A gpg: key 5A829E4A: "Kayon Toga " not changed gpg: Total number processed: 1 gpg: unchanged: 1
78.7
Securing Your Network
There is a lot to understand about networking in order to secure your network. Fortunately Debian GNU/Linux is generally by default quite secure. That is, the default configuration of packages tend to be secure. You have to take action to make them insecure. Nontheless, it is possible! Here are some random jottings: To start with, if someone has physical access to your hub-based network they can plug in a machine and do many things. With a passive ethernet frame sniffer an attacker can listen for ARP requests on a network and guess at IP addresses that may not be in use within the range of available adresses for the network and use this as its own address. Even if your network has hosts using the whole range of addresses that are available there’s always the likelihood that one PC or Laptop is turned off so that its IP address is free.
500
Security
If you use a switch-network and put MAC address filters on the switch an attacker can simply unplug an existing PC or Laptop and take over its MAC address. Normally the MAC address is in the ethernet card. A typical situation is to plug a Laptop into a network and perhaps bring up the interface using DHCP to get an IP but may not be able to do much more. In some situations the MAC address can be set in software. DECnet, for example, depends on being able to do this. Older suns had the MAC in battery-backedup ram and used the same address for all ethernet cards in the system. When you change the 48 bit MAC address you are actually turning it into a customised MAC address which will be 96 bits long consisting of the original 48 bit MAC followed by the new 48 bits you set. To the outside it appears as another MAC address. You can change the MAC address with: # ifconfig eth0 hw ether 00:50:56:01:00:00
Turning off DHCP will help protect against users that plug in a Laptop but not the hackers you’re trying to guard against. FROM http://www.linuxlock.org/features/somjuly00.html LinuxSecurity.Com wins Source of the Month for July, 2000 This month’s LinuxLock.Org Security Source of the Month goes to a group of individuals dedicated to bringing security to the fore-front of the linux community; this is the staff of LinuxSecurity.Com. Since we started following the site in January 2000, it has evolved into one of the internet’s premiere sources of Linux Security Information. LinuxSecurity.Com contains a large newsfeed, of linux security news, articles, and press releases, to keep us on top of the industry. This month pushed them over the top, when they released The Linux Security Quick Reference Guide. This guide is a printable PDF document with numerous security checks and tips, some of the sections include Linux Kernel Security, File Permissions, Intrusions Detection, Linux Security Resources, and more. LinuxSecurity.Com has provided original features every month, covering things such as, how to use certain security tools, and interviews with Security
78.8 Identifying Your System?
501
Guru’s. This month LinuxSecurity Interviews Carr Biggerstaff, Senior Vice President of Marketing, and Thomas Haigh, Vice President and Chief Technologist for Secure Computing, Inc. about their work with Linux and security. LinuxSecurity.Com recieved a Slashdot post this month for an Interview they conducted with Jay Beale, the Lead Developer of the Bastille Project. This post on Slashdot is the kind of press Linux needs to be more aware of the security issues surrounding us, and the solutions that exsist. LinuxSecurity.Com also contains a rather complete and growing Resources Section, a listing of local linux security providers, a newsletter, a mailing list, and a weekly security digest. They also feature a LinuxSecurity.Com Security Tip of the Day, that can be found on other sites such as the highly travelled LinuxToday.Com We all at LinuxLock.Org applaud the efforts of LinuxSecurity.Com and encourage you all to go and visit their site, and use the various features they have to offer... Keep up the good work.
78.8
Identifying Your System?
Note that, for example, a HTTP server on port 80 identifying itself as: > httptype togaware.com Apache/1.3.29 (Debian GNU/Linux) PHP/4.3.3
or a SSH server on port 22 identifying itself as: > telnet togaware.com 22 Trying 150.229.8.170... Connected to togaware.com. Escape character is ’^]’. SSH-1.99-OpenSSH_3.6.1p2 Debian 1:3.6.1p2-10
is not really a security risk. Serious attacks will attempt all know vulnerabilities of the port, irrespective of what is running behind the port. Thus this is not regarded as sensitive information. On the other-hand, hiding the banner loses a lot for inter-operation.
502
Security
Indeed, software should advertise its version number to aid debugging in all kinds of circumstances. If there’s a security flaw then the flaw should be fixed instead of trying to hide it.
Chapter 79 Sketch Sketch is an interactive vector drawing program. It is comparable to the commercial CorelDraw. Sketch supports drawing primitives like rectangles, ellipses, bezier curves, bitmap and Encapsulated PostScript images, and text. Objects can be rotated, scaled, and sheared. Primitives can have fill and line properties. A number of special effects like blend groups, text to bezier and text along a path are provided. Sketch supports an unlimited undo history. Import of xfig, ai, wmf, cmx and svg files. Exports to pdf, eps, ai and svg. Sketch is written in Python with a Tkinter GUI. User scripts can be written in Python.
503
504
Sketch
Figure 79.1: Sketch provides considerable functionality as an alternative to dia. It does not use the GTK+ toolkit and so does not conform to the Gnome look and feel.
Chapter 80 Sound Recording Debian Pacakges: gnome-media sound-recorder gramofile audacity aumix aumixgtk rawrec Recording from the sound card of your computer opens up the possibility of recording from external sources including your old Long Playing turntable— turn that old collection of vinyl into a collection of audio CDs. Recording to WAV format takes up quite a bit of space—approximately 10MB for each 1 minute of recording. That’s about 600MB for a very long LP, which is about what you can fit onto a CD. Often though old LPs contain just 30 to 40 minutes and so can be doubled up on to 74 or 80 minute CD-Rs.
80.1
Required Software
The Gnome sound recorder comes from the gnome-media package. A command line application sound-recorder provides an alternative method of recording sounds. The rawrec package provides a useful command line recorder and might be used to record to a 320kbps mp3 as in:
$ time rawrec -t 3600 | \ sox -t sw -r 44100 -c 2 - -t wav - | \ lame --alt-preset insane - recording.mp3
505
506
Sound Recording
The gramofile application is more useful for recording from vinyl LPs, for example. It also supports track splitting and filtering to remove thr traditional vinyl ‘pop’. For editing the sound signal use the graphical audacity application.
80.2
Hardware Connections
Connect the amplifier’s line out to the line-in of the computer.
80.3
Mixer Settings
Sound recording applications rely on proper settings within the audio mixer. With the mixer you can select the source for the recording (line-in or microphone) and the level of Gain for the recording. The mixer is also used to set output volume levels. There are multiple possible sources for recording, including Line-In and Microphone. If the source is an external multitrack mixer or HiFi then plug it into the Line In and set Line as the Rec source. Note that both the line level and IGain need to be set appropriately, perhaps after some experimentation. Setting the gain too high results in clipping and setting it too low means that noise in the source can overwhelm the signal. There are various tools to set the levels of various channels. Gnome Audio Mixer is available under Programs→Multimedia, providing a graphical interface to mute/unmute channels and to select the channels for recording. A command line alternative is the aumix command from the aumix package. You can query the current setting of the line-in and input-gain with: $ aumix -lq -iq line 100, 100, R igain 30, 30
Here the line-in is selected for recording with 100% level. The gain is set at 30%. These work for my sound card. Alternatively you can get all the current settings with:
80.4 Using Gramofile
507
$ aumix -q vol 62, 62, P pcm 63, 63 speaker 79, 79 line 100, 100, R mic 62, 62, P cd 100, 100, P igain 30, 30 line1 0, 0, P line2 0, 0, P phin 0, 0, P phout 0, 0 video 3, 3, P
To set the line-in and gain to the above values and for recording from line-in:
$ aumix -l100 -i30 -lR
With aumix-gtk installed aumix will start up a graphical display that allows setting the values interactively.
80.4
Using Gramofile
This is, currently, by far the simplest tool to record from gramophones, with a usable but unsophisticated interface. Consider a sample record: Kraftwerk’s Computer World, side 1. Line-in is set to 100 and igain is 30. From gramofile’s recording meters this setting rarely (0.3%) exceeds 50% maximum volume level, which is perhaps too low? Nonetheless the result sounds okay. The automatic track finder only found 3 (instead of 4) tracks (but only when the minimum gap is set to 5). Listening to the Track 3/4 changeover it is clear why—there is no gap. However, the .tracks file that is written can be edited by hand and then the audio processing can be deployed to split the file into tracks. The filtering includes Conditional Median Filtering to filter out ticks. Mostly works just fine and is the default, so use it. Loading the resulting 4 tracks into xmms works just fine (the original WAV file has a
508
Sound Recording
header that says it is 100 minutes long but this can be fixed within gramofile by choosing to process the audio signal and using the Copy Only filter). To record the resulting files to an audio CD see Chapter 15.
80.5
Recommended Recording Process
1. Gramofile to record from the sound card through line in from the source (e.g., LP record) 2. Gramofile to identify track beginnings and endings. These are saved to a .tracks file automatically. 3. Audacity to confirm and fine tune the track splits stored in the .tracks file. 4. Gramofile to perform the split into tracks and to filter out pops using the Conditional Median Filter II. The tracks are saved into separate files numbered 01, 02, etc. 5. Xmms to check the beginning and ending of each track to confirm the splits were fine. 6. Audacity to edit out any remaining spikes in each track, being sure to export back to WAV if any changes are made. 7. The tracks are now ready to burn to CD. Create a disk.toc: CD_DA TRACK AUDIO FILE "side1001.wav" 0 TRACK AUDIO FILE "side1002.wav" 0 ... TRACK AUDIO FILE "side2005.wav" 0
Then $ cdrdao write disk.toc
80.6 Recordings Using the Gnome Sound Recorder
509
A handy table of minutes to seconds: 1/60 6/360 11/660 16/960 21/1260 26/1560
80.6
2/120 7/420 12/720 17/1020 22/1320 27/1620
3/180 8/480 13/780 18/1080 23/1380 28/1680
4/240 9/540 14/840 19/1140 24/1440 29/1740
5/300 10/600 15/900 20/1200 25/1500 30/1800
Recordings Using the Gnome Sound Recorder
When recording using the Gnome Sound Recorder the first 10 seconds of the recording are chopped off? Might be better to use sound-recorder.
80.7
Using Command Line Sound-Recorder
When recording from the command line the command is: $ sound-recorder -c 2 -b 16 -P -S 5:00 recording.wav
The options set stereo recording (-c 2), 16 bit sampling (-b 16), priority threading (-P) to ensure high priority in CPU usage, and limiting the recording to 5 minutes. The output is written to the file recording.wav. Many of these options are the default so you can simply: $ sound-recorder -P recording.wav
Use Ctrl-C to stop the recording.
80.8
Using Command Line Sox
$ sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp recording.wav
510
Sound Recording
Chapter 81 Spell For the older standard ispell, to change the default dictionary use the updateispell-dictionary. You will be offered a choice if the appropriate packages are installed. This is being replaced by aspell. For the newer aspell you can choose your default dictionary by specifying it in /etc/aspell.conf: master british
511
512
Spell
Chapter 82 SPlus: Statistical Software SPlus is commercial software, popular with statisticians and commercial data analysts. Install on Debian: # adduser splus # su - splus $ cd $ umask 022 $ tar zxvf splus.tz $ ./HOSTINFO Email the code and your SPlus serial number and server name to SPlus By return mail you will get a license key $ ./CONFIGURE Select 4: Destinations and Name of Splus Script Select 2: Name of Splus shell script "Splus" Change to "splus" to make life easier for everyone The script to start Splus will be installed in /usr/local $ ./INSTALL Enter the key when prompted Then fails with: cp: cannot create regular file ‘/usr/local/bin/splus’: Permission denied So: $ su # ./INSTALL y to CONFIGURE # chmod go+rx /usr/local/bin/splus Should now be installed!
513
514
SPlus: Statistical Software
Chapter 83 Spruce: Email This is not Gnome, but it is GTK+ and supports multiple POP accounts.
Figure 83.1: The basic interface offered by Spruce
515
516
Spruce: Email
Chapter 84 SSH: Secure Communications The Secure Shell (provided by the ssh package) provides a secure mechanism for communicating with remote hosts on a network. Unlike traditional tools such as rsh, rcp, rlogin, telnet, and ftp, ssh encrypts all communications, including passwords, reducing the opportunity for inappropriate interception. It can also be used to encrypt your pop (email) communications and protect you from DNS and IP spoofing where remote machines pretend to be genuine machines that you are wanting to connect to. Implementations of ssh exist for most of the major operating systems.
84.1
Versions of SSH
A Finnish company developed the original ssh but copyright and patent issues lead to the development of the free OpenSSH. There are two major (and slightly incompatible) versions of ssh: 1.X and 2.X. From a 2.X client you will not be able to connect to a 1.X server. Connecting to an OpenSSH 2.X server from any version of the client is supported though.
84.2
Installation
Debian provides the OpenBSD version of ssh by default. Because of the US export laws which prohibit the export of cryptography software, being classified as munitions, the ssh package cannot be part of the main Debian 517
518
SSH: Secure Communications
distribution. You will need to have a non-US distribution in your /etc/apt/ sources.list file, such as one of the following: deb http://non-us.debian.org/ unstable/non-US main contrib non-free deb http://ftp.au.debian.org/debian-non-US unstable/non-US main contrib non-free
Having made this addition you can update the information about available packages and then retrieve, unpack, and configure the package with: # wajig update # wajig install ssh
(apt-get update) (apt-get install ssh)
During the install you may be asked about installing ssh as setuid root. The suggestion from the configuration script is that you do not install as setuid root and if you have problems, then run dpk-reconfigure ssh to reconfigure the package.
84.3
Remote Host Authentication
When you use ssh to connect to a remote host for the first time you will be confronted with a message like: The authenticity of host ’rosz (192.168.1.2)’ can’t be established. RSA key fingerprint is 99:1f:eb:c2:8f:cb7:33:23:1f:4c:e5:51:20:e9:85:5a. Are you sure you want to continue connecting (yes/no)?
SSH does not know this host. Type yes to add the fingerprint of this host to ~/.ssh/known_hosts. Next time you connect to this remote host you should not get this message.
84.4
Simple Usage
Ssh is a client-server program where your client (on your local host) connects to a remote ssh server (running on the remote host), requiring that ssh be installed on both hosts. (Many systems now run ssh.) You need to know the
84.5 Public and Private Keys
519
password of the account you wish to connect to on the remote host. Once connected all communications between the two hosts is securely encrypted. Connect to a remote host simply by issuing the appropriate ssh command. To connect as user kayon to a remote host altrop.togaware.com or to copy files from your local host to kayon’s account at the remote host you can simply: $ ssh [email protected] $ scp file.name [email protected]:remote.file.name
84.5
Public and Private Keys
Through devious means a Trojan remote host might be pretending to be the remote host you are attempting to connect to (using IP spoofing, DNS spoofing or routing spoofing) and thus might intercept your communications and obtain your password. A more secure approach using ssh employs a public-key mechanism. Here, you create your own key (essentially just a sequence of bits) that consists of a public part and a private part. You copy the public key on to your account on the remote host and the private part never leaves your local host. The remote host can use the public key to encrypt a message such that only with your private key can you decrypt the message. You can generate a private/public key pair with the ssh-keygen command, storing the private key in /home/kayon/.ssh/identity and the public key in /home/kayon/.ssh/identity. A passphrase will be asked for to encrypt your private key within your file system (otherwise the root user, for example, could obtain your private key). Your passphrase will be used to ‘unlock’ your private key whenever you need to use it. The public key needs to be communicated to your remote host. The steps are simple: > > > >
ssh-keygen -t dsa cd .ssh scp id_dsa.pub [email protected]:.ssh/authorized_keys.n ssh altrop
> cd .ssh > cat authorized_keys.n >> authorized_keys > exit
520
SSH: Secure Communications
The remote host may already have an authorised keys file in /home/kayon/ .ssh/authorized_keys. Don’t copy over it, but append the contents of your local /home/kayon/.ssh/identity.pub to it. Multiple keys can appear in the one file. Now, when you connect to the remote host using ssh your public key on that host will be used to send an encrypted message (a random number in fact) back to your local host. The local host decrypts the message using the private key stored only on the local host and decrypted using the passphrase. The decrypted message is returned to the remote host for verification. This method, using public keys, does not send passwords (or passphrases) over the network. A passphrase is used on the local host only to unlock the local private key.
84.6
SSH Agents
Entering the passphrase every time you want to do a remote copy or make a remote connection can be tiring. There is a simple mechanism provided to avoid this. All you need do is to start up a shell or other similar command that already knows what your passphrase is (by you telling it just once). This is done with ssh-agent to start the shell and ssh-add to store the passphrase for this shell:
> ssh-agent bash > ssh-add (or ssh-add .ssh/id_dsa) Need passphrase for .ssh/id_dsa Enter passphrase for .ssh/id_dsa Identity added: .ssh/id_dsa (.ssh/id_dsa) > ssh altrop
The ssh-add will prompt you for your passphrase but from then on all further interaction with the remote host will not require the passphrase again. The -l option of ssh-add lists the key(s) currently kept in memory for this ssh-agent. The -d option removes an identity from memory.
84.7 DSA Key Generation
84.7
521
DSA Key Generation
Version 2 of ssh provides alternative encryption methods with DSA encryption instead of the RSA keys for Version 1. There is debate as to which is more secure. Version 2 encrypts more of the data but always uses the same Diffie-Hellman group (perhaps being more likely then that it has been cracked). inx$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/kayon/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/kayon/.ssh/id_dsa. Your public key has been saved in /home/kayon/.ssh/id_dsa.pub. The key fingerprint is: cc:50:d4:85:86:56:b8:8a:77:57:61:51:63:89:46:09 kayon@inx $ scp .ssh/id_dsa.pub altrop:.ssh/authorized_keys2.inx $ $ $ $
ssh altrop cd .ssh cat authorized_keys2.inx >> authorized_keys2 exit
Be sure the protections on the files do not permit others to access them. In particular, ssh won’t work if the /home/kayon/.ssh/authorized_keys is writable by anyone other than the user.
84.8
Changing Your Passphrase
The passphrase to unlock your private key can be changed at any time with: $ ssh-keygen -t dsa -p
This does not change your private or public key at all so no further action is required in terms of distributing your public key.
522
84.9
SSH: Secure Communications
SSH and Rsync
Rsync is used to efficiently copy files across the network. It can use ssh to perform it’s tasks by setting the appropriate environment variable: export RSYNC_RSH=ssh
84.10
SSH and the X Window System
The default Xsession on Debian is run with ssh-agent so that ssh connections can be initiated more easily (after you have performed an ssh-add). This is controlled by the file /etc/X11/Xsession.options: use-ssh-agent
You can have your ssh passphrase asked for each time you log on. Using gdm and the Debian Session (rather than the Gnome Session) will load the /home/kayon/.xsession file which can contain: #!/bin/sh ssh-add .ssh/id_dsa < /dev/null exec gnome-session
If you have ssh-askpass and ssh-askpass-gnome installed you will be prompted for your passphrase. All connections to hosts which have the public key will now be direct (no password or passphrase required). By default the ForwardX11 option for ssh is turned off. Thus, when you connect to remote hosts you won’t be able to display X Window System applications on your screen. You can turn it on per connection with: $ ssh -X plymz
Or else you can turn it on for all connections to a particular host by adding the following line to /home/kayon/.ssh/config:
84.11 SSH Tunnelling
523
Host plymz ForwardX11 yes
Or even more generally allow X Window System forwarding through all connections: Host * ForwardX11 yes
84.11
SSH Tunnelling
Tunnelling allows connections to be made to remote services through an encrypted connection. This is useful if there is a firewall preventing your access to a server from one machine, but you do have access to the server from another machine to which you can use ssh to connect. Ssh uses port forwarding to establish a connection between a local port and the port which runs the service to be tunnelled on the remote machine (which might be POP or FTP or HTTPS, for example). Once port forwarding is set up you connect to the local port which then forwards the connection through ssh to the remote port. That is, all requests sent to the local port are forwarded to the remote port and thus encrypted, and from the remote port it appears you are actually on that remote host. Tunnelling requires the remote host to be running an ssh server, which can be checked using telnet to connect to port 22: $ telnet lynx.togaware.com 22
You will either receive a message stating the version of the remote ssh server or an error message similar to: telnet: Unable to connect to remote host: Connection refused
The ssh syntax for port forwarding is: $ ssh -f [kayon@altrop] -L [local port]:[altrop]:[remote port] [command]
524
SSH: Secure Communications
A useful example is tunnelling of POP as described in Section 28.2.1. We list a number of actual examples here: Suppose you want to access your secure https server from outside the secure network. The https server uses port 443. suppose you have ssh access to host lynx. Establish the tunnel with: $ ssh -2 -n -N -f -a -C -L 5443:admin.hq.togaware.com:443 lynx sleep 1000d
Then you can access this firewall protected HTTPS server locally through https://localhost:5443/. Here’s an example using POP: $ ssh -2 -n -N -f -a -L 5143:mail-bt:143 lynx sleep 1000d
Then you can access the POP server on your local machine.
84.12
SSH Access Denied
If you are having problems look in /var/log/auth.log for details.
84.13
SSH Terminal in a Browser
MindTerm is invoked with something like https://altrop.togaware.com/ssh.After wajig install mindterm be sure to # cd /var/www # ln -s /usr/share/mindterm/ ssh
which makes it immediately available (assuming you are running a http server such as apache). This supports both the external ssh pop up window and the internal (to the browser) ssh window. No problems with terminal types here. Although the default internal terminal is a bit too narrow for my liking. I extend it
84.14 SSH Version 1
525
to 80 chars by editting /usr/share/doc/mindterm/index.html, and setting width=850 in the applet element. Note that you can also change the font if you wish:
84.14
SSH Version 1
To turn version 1 support on in Debian, edit /etc/ssh/sshd config to change Protocol 2 to Protocol 2,1 and add the line: HostKey /etc/ssh/ssh_host_key
Then generate the host key with: # ssh-keygen -f /etc/ssh/ssh_host_key --N ’’ t rsa1
526
SSH: Secure Communications
Chapter 85 SUDO: Root Access The sudo package allows a normal user to execute commands as root in a controlled manner. Debian’s sudo package has the password timeout set to 15 minutes. This means that when you first enter your password, as long as you don’t wait more than 15 minutes between sudo commands, you won’t have to enter it again. The password timeout can be immediately expired with sudo -k. Debian’s sudo is compiled with --with-exempt=sudo --with-secure-path="/usr/local/sbin:/usr/local/bin:/usr/sbin:...
As a consequence, the PATH of the user is ignored except if the user is in group sudo. Adding users to the group sudo allows those users to execute sudo without a password but this is strongly discouraged. Sudo allows a fairly fine grain of control. Note that inclusions (lists of specific commands/paths allowed, rather than rejected) is preferable. But be careful granting root access to commands with shell escapes.
527
528
SUDO: Root Access
Chapter 86 Swap If running out of swap you can add 257MB more. First have a look at what you have available: # free total Mem: 256216 -/+ buffers/cache: Swap: 224900
used 252208 148268 51268
free 4008 107948 173632
shared 118100
buffers 56996
Next create a file without holes and a multiple of 4K in size: # dd if=/dev/zero of=/extra-swap bs=1024 count=262144 262144+0 records in 262144+0 records out
Now mark it as a swap file by writing a signature to its beginning which contains some administrative information and is used by the kernel: # mkswap /extra-swap Setting up swapspace version 1, size = 268431360 bytes
Now tell the kernel about the new swap file: # swapon /extra-swap
529
cached 46944
530
Swap
Now check it is there! # free total Mem: 256216 -/+ buffers/cache: Swap: 487036
used 252448 148508 51268
free 3768 107708 435768
shared 118100
buffers 56996
To remove the swap file from usage: # swapoff /extra-swap
You can add to /etc/fstab: /extra-swap
none
swap
sw
0
0
Then on boot when swapon -a is run the new swap will be added to swap space.
cached 46944
Chapter 87 Themes These have become quite popular in GNU/Linux resulting in the http:// themes.freshmeat.net web site as a central repository.
87.1
Enlightenment
Head over to e.themes.org, and find the themes you like. Download them, and put them in ~/.enlightenment/themes. Then, restart Enlightenment (use the left-click menu). Now, you can choose your new themes from the middle-click menu. It’s really pretty simple... I wouldn’t worry about aptgetting that sort of thing (if you even can). There is supposed to be a tool that will automatically update your themes, but last time I checked, it was in the alpha stages. Can’t recall what it was called, sorry...
531
532
Themes
Chapter 88 USB Debian Pacakges: hotplug, usbview, usbutils. The USB port is well supported in Debian. USB allows plug-n-play functionality of many devices. Installing hotplug (or the older usbmgr) will install a daemon that monitors the USB ports and install the appropriate modules when devices are plugged in, while also noting when they are removed. The usbview command will display the tree of USB devices connected in a window, while the lsusb command lists in a terminal the usb devices. The usbmodules command will list the drivers that might be able to manage interfaces on currently plugged in USB devices. For USB devices simply connect them to the USB socket and hotplug will notice the new device and load the appropriate modules. (The alternative usbmgr daemon will beep twice as it notices new devices.) The lsusb command will show that the device is recognised. What happens next depends on the type of the device. Further information about USB under GNU/Linux is available from http: //www.linux-usb.org/. In particular, see http://www.linux-usb.org/ USB-guide/book1.html. Generally, newer kernels are required. For example, with kernel-image-2.4.16686 a USB 20GB Hard Disk and USB DVD Burner worked but a USB Printer did not. With kernel-image-2.4.20-686 they all worked. 533
534
88.1
USB
Mass Storage Devices
The standard Mass Storage Device protocol is used for USB devices such as hard disk drives, flash memory drives, memory card readers, and digital cameras. Such devices have a standard VFAT (MSWindows) file system. The USB mass storage device is treated as a SCSI device so simply mount the SCSI device: # mount -t auto /dev/sda1 /mnt
You should now be able to see and use the device as any other disk. If you already have a SCSI device then the USB device might be /dev/sdb1! The kernel module usb-storage drives USB mass storage devices and should be automatically loaded by hotplug. The kernel module vfat is also required, and if it does not autoload then you will need to: # modprobe vfat
You can run dmesg to check that the USB device has been found. A sample setup of four USB devices includes a USB mouse, HP Printer/Scanner/Copier with a card reader, a digital camera, and a flash memory drive (3System USB flash disk). The /etc/fstab includes: /dev/sda1 /dev/sdb1 /dev/sdc1
/hpcard auto /camera auto /flash auto
rw,user,noauto 0 0 rw,user,noauto 0 0 defaults,user,noauto 0 0
Then any user can mount, for example, /hpcard, when a memory card has been inserted into the card reader. A problem is that unless the camera is connected before the flash drive after a reboot, the mappings end up being reversed! The devices look like any other hard drive device so you can run fdisk on it and reorganise partitions: # fdisk /dev/sda
88.2 Mass Storage Devices (DVD Writer)
535
You can also format the partition(s) on the device, usually with a DOS/FAT filesystem: > mkfs -t vfat /dev/sda1
88.1.1
HP Photosmart 320
This camera has a USB connector and can be configured to be recognised as a mass storage device, as an alternative to using the Picture Transfer Protocol standard). Using it as a mass storage device is simple and after setting up the USB packages it all worked flawlessly. Create a mount point for the camera: # mkdir /camera
The camera acts just like a mass storage device! Photos can be copied or cut from the appropriate folder and saved to your hard disk.
88.2
Mass Storage Devices (DVD Writer)
Connect a Sony DRX-500ULX, DVD+/-RW+/-R to Debin GNU/Linux using USB. Plugging it in results in a coule of beeps as usbmgr recognises it. You can also run usbview or lsusb to check that it is properly recognised. The device will be treated as a SCSI CD so you should be able to mount it as: # mount -t iso9660 /dev/scd1 /mnt
Create a specific mount point for it, such as /dvdrw: # mkdir /dvdrw
Add an appropriate line to your /etc/fstab: /dev/scd1
/dvdrw
auto
defaults,user,noauto 0 0
536
USB
With cdrdao and cdrecord the CD write functionality works just fine: # cdrdao disk-info --device 4,0,0 --driver generic-mmc
For a DVD first create an image to burn on to the DVD. # mkisofs -R -o cdimage.raw dvd/
Now install dvdrecord to write to a DVD-RW with: # dvdrecord -v speed=2 dev=4,0,0 cdimage.raw
Note that dvdrecord does not appear to be actively maintained. Also, this dvdrecord command will fail for a DVD+RW (it only works for DVDRW presently), so use the dvd+rw-tools instead. This package is actively maintained and also supports DVD-R(W). Format the DVD+RW with: # dvd+rw-format /dev/scd1
Now growisofs is meant to work but failed with this particular drive with a message indicating that the drive does not support TAO (Track At Once) mode. # growisofs /dev/scd1 -R -J dvd/
So instead use the pre-mastered CD image to burn the DVD+RW: # growisofs -Z /dev/scd1=cdimage.raw
So, to recap, to burn a DVD+RW: # mkisofs -R -o cdimage.raw dvd/ # dvd+rw-format /dev/scd1 # growisofs -Z /dev/scd1=cdimage.raw
88.3 USB Printer: HP LaserJet 1200
88.3
537
USB Printer: HP LaserJet 1200
The Hewlett-Packard LaserJet 1200 is a PostScript laser printer installed on Bartok (Section 5.9.19). Plug into USB. Create appropriate devices (if they don’t already exist - also be sure to be using perhaps kernel 2.4.20 or later) and try printing: # cd /dev # MAKEDEV usb # enscript -o - ~/.profile > /dev/usb/lp0
Worked just fine. Now set up printing as in another chapter.
88.4
USB Printer: HP PSC2210
The HP PSC2210 is a printer, scanner, copier, and fax installed on Mint (Section 5.9.27). Connect with USB. Create the appropriate USB devices if they do not already exist: # cd /dev # MAKEDEV usb
Install the packages for the printer: hpoj hpijs hp-ppd sane xsane mtools hpoj-xojpanel. Install packages for printer queueing: cupsys cupsys-bsd cupsys-client. Perhaps also foomatic-bin. Make sure the module printer is loaded: # lsmod | grep printer # modprobe printer
If the printer module does not get loaded at boot time then add it to /etc/modules.
538
USB
Chapter 89 Video This chapter reviews software for viewing and modifying Video, and the set up of software for particular video chip sets.
89.1
Viewing Video
Debian Pacakges: lumiere w32codecs. All forms of video viewing is supported by Linux. You can view AVI, DVD, SVCD, and many more codecs (video encodings). Install lumiere and you can view the videos within nautilus. The w32codecs allow viewing of many MS Windows video codecs. Some packages expect the DVD device to be called /dev/dvd. If it does not exist, and your DVD device is /dev/hdc, for example, then simply: # ln -s /dev/hdc /dev/dvd
89.2
DVD Videos
There at least five video players available for Debian: totem, xine-ui, mplayer, ogle, and vlc. There are considerable uncertainties in the legal situation with respect to the position of the US movie studios. Certainly illegal copying of DVDs is to be 539
540
Video
avoided, but unfortunately the CSS copy protection scheme (used on DVDs) has become a view restriction scheme, thereby, according to many, restricting freedom of speech. Thus the required library to read many commercial DVDs needs to be obtained separately. # sh /usr/share/doc/libdvdread2/examples/install-css.sh
Also, to allow users access be sure they are in group cdrom.
89.2.1
Xine
Debian Packages: xine-ui, xine-dvdnav, libdvdread2. A highly recommended multi-media viewer is xine-ui, an MPEG2/MPEG1 audio/video player with a skinned graphical user interface. Keyboard shortcuts for various functions include: gui aspect chapt volume
89.2.2
g a PgUp PgDn v V
pause p subtitles . , chapt % 0-9 enlarge <> M-1,2,3
full screen audio channel audio sync 1:1 aspect
f + <- -> Home s
Ogle
Debian Packages: ogle. The ogle DVD player supports DVD menus and navigation. Install ogle-gui for a useful graphical user interface.
89.2.3
DVD Sound Track
You can extract sound from a DVD, one track at a time or a chapter at a time. Some simple command line examples should suffice to demonstrate how this is done. First off place the DVD into the DVD drive! This should probably be identified as /dev/dvd. Have a look at its table of contents with the lsdvd command:
89.2 DVD Videos > lsdvd libdvdread: Using libdvdcss Title: 01, Length: 02:32:44 Title: 02, Length: 00:17:36 Title: 03, Length: 00:00:11 Longest track: 1
541
version 1.2.5 Chapters: 26, Chapters: 02, Chapters: 02,
for DVD access Cells: 27, Audio streams: 02, Subpictures: 01 Cells: 02, Audio streams: 01, Subpictures: 00 Cells: 02, Audio streams: 01, Subpictures: 00
This DVD has three titles, the first one (Title 01) probably contains the main material, as it is identified as being the longest track. It also has two audio streams. To capture the audio from the tenth chapter of the first title, saving it as OGG format, the command line is simply: transcode -i /dev/dvd -x dvd -T 1,10,1 -a 0 -y ogg -m track10.ogg
The arguments identify the input as /dev/dvd (-i), the type of input as DVD (-x), the title, chapter, and angle to encode, in this case being title 1, chapter 10, and camera angle 1 (-T), the audio track is track 0 (-a), the output format is OGG (-y, and the output filename is track10.ogg (-m). To extract multiple chapters from a title you can do the following composite command: for i in ’1 2 3 4 5 6 7 8 9’; do echo transcode -i /dev/dvd -x dvd -T 1,$i,1 -a 0 -y ogg -m track0$i.ogg; done
Another example generates MP3 output of chapter 20 from title 1: transcode -i /dev/dvd -x dvd -T 1,20,1 -a 0 -y raw -m track20.mp3
To extract the whole audio track of a title (all chapters) as OGG audio: transcode -i /dev/dvd -x dvd -T 1,-1 -a 0 -y ogg -m audiotrack.ogg
If you prefer WAV files, the following will do it: > transcode -i /dev/dvd -x dvd -T 1,20 -a 0 -y wav -m track20.wav
542
89.3
Video
Video Backups
Debian Packages: video-dvdrip transcode cvdimager mplayer-686 subtitleripper mencoder-686 You will need the following Debian archive available: deb http://marillat.free.fr/ unstable main
The video-dvdrip packages provides tools for working with DVD videos. With this tool you can make backup copies (in numerous compressed video formats) for personal use of videos that you own. Or you could copy the video onto your hard disk for archiving and watching directly. You’ll need lots of disk space (a movie DVD contains up to 9GB and converting needs further disk space). In fact dvdrip is only a GUI to numerous command line tools including transcode which does the bulk of the work. The dvdrip command provides an intuitive interface and reminder of all the vast array of options available. Generally, load your DVD, go to the RIP Title table and obtain the table of contents. The largest one is usually the movie! If you are space restricted (less than 10GB say) you may like to do one or more chapters at a time. You can then begin the rip to produce a .vob file. You have many choices for the format you would like to convert to. Here is an example of taking a single chapter (happens to be chapter 19 of title 1 of one of my DVDs) and encoding in several formats (where there is a choice, they are 2620 kbit/s, but VCD is only 1152): Type Ext Time VOB .vob 2m SVCD .mpg 23m VCD .mpg 16m divx4 divx5 .avi 10m xvid .avi 10m xvidcvs .avi 10m ffmpeg fame af6
Size Comments 239MB Audio somewhat poor. 99MB Very blocky. 51MB No choice of kbit/s. 94MB 103MB 103MB
89.4 Command Line Video Tools
543
Now to understand what the best procedure and format and parameters are for grabbing a DVD into a compressed form suitable for hard disk storage. Deinterlacing is (almost) only needed for material which was shot using a video camera, or transmitted for TV.
89.4
Command Line Video Tools
Debian Pacakges: mpegtools cpdvd cpvts. Obtain some information about the contents of title 1 of a DVD: > tcprobe -i /dev/dvd -T 1
Here’s a recipe for generating an SVCD backup copy of your own DVD DVDs are expensive and a backup can save the heartache of a bad scratch: > > > > > > > > > >
mkdir xyz cd xyz cpdvd . ripmake ../xyz svcd make -f xyz-svcd.mak xine xyz-svcd-SAMPLE.mpg make -f xyz-svcd.mak rip cdrdao write --speed 16 xyz-svcd-CD1.cue cdrdao write --speed 16 xyz-svcd-CD2.cue ...
(-s 650 to set CD-R size) (generates a sample) (view the sample) (generates disks) (burn a CD-R)
Set the target for ripmake to be avi (generally thought to be a better format and okay if you only view on computer, but there aren’t many, if any, DVD players that can play an AVI file, although for backup you could regenerate the DVD and thus if you lose or damage your original at least there is some hope): > > > > > >
mkdir xyz cd xyz cpdvd . ripmake [-s 650] ../xyz avi make -f xyz-avi.mak make -f xyz-avi.mak rip
(-s to set CD-R size) (generates a sample) (generates avi collection)
544
Video
To convert an AVI to an SVCD:
> > > >
ripmake xyz.avi svcd make -f xyz-svcd.mak xine xyz-svcd-SAMPLE.mpg make -f xyz-svcd.mak rip
To merge multiple AVI files into one big AVI file:
> avimerge -i a1.avi a2.avi a3.avi -o a.avi
To split an AVI file up into smaller chunks (a-0000, a-0001, etc):
> avisplit -i a.avi -s 700
To extract a particular section of the AVI file:
> avisplit -i a.avi -t 0:7:20.0-0:8:20.0
To adjust the synchronisation of the adio, where the video appears to lag behind the audio:
> avisync -i a.avi -o a-sync.avi -n -5
Note that the size of a CD is usually quoted as the size of a CD in data mode (whitch uses 2048 bytes/sector). When mastering a VCD/SVCD we are usually talking in terms of raw mode (2324 bytes/sector). Note that ripmake uses the common data mode size and internally converts to raw mode so that 700MB is usually the correct size for a 800MB VCD/SVCD (in raw mode).
89.5 DVD-AUDIO
89.5
DVD-AUDIO
89.6
Video from Photos
545
Use mencoder-686. Convert all images to the same size first. (What’s the best size? Should I crop or rescale?) > for i in *.jpg; do convert -resize 800x600! $i $i; done > mencoder \*.jpg -mf on:fps=0.25 -o output.avi -ovc lavc > mplayer output.avi
Then transcode to SVCD and burn to CD. So far I do the following. But this gives 1 frame per second. Can’t seem to slow it down? > > > > > >
transcode -a 0 -i output.avi -f 1 -y mpeg2enc,mp2enc -o output mplayer output.m1v mplex -f 4 -V -o output.mpg output.m1v mplayer output.mpg vcdimager --type=svcd output.mpg cdrdao write videocd.cue
89.7
nVidia Video Driver
nVidia provides source modules that can be compiled to work with particular kernels with XFree86. These are not Open Source but only available in binary form. The process of installing the video drivers for GEForce 256 (Velox (Section 5.9.26)), TNT2 (Mint (Section 5.9.27)) and Riva Ultra 64 (Bartok (Section 5.9.19)) is straightforward. Install the appropriate Debian packages (with the kernel-headers package that matches your installed kernel): $ wajig install nvidia-kernel-src nvidia-glx-src $ wajig install kernel-headers-2.4.20-686
Then. assuming you’ve installed a standard Debian kernel (e.g., kernelimage-2.4.20-686) go to the kernel source directory and unpack the downloaded archives:
546
Video
# cd /usr/src # tar zxvf nvidia-kernel-src.tar.gz
Debian packages are now generated from these sources with the following steps. First build the nvidia kernel package. As part of this step the file NVIDIA kernel-1.0-4349.tar.gz (about 700K) will be downloaded from the nVidia archive: # # # # # #
export KSRC=/usr/src/kernel-headers-2.4.20-686 export KVERS=2.4.20-686 cd modules/nvidia-kernel-1.0.4349 CC=gcc-2.95 debian/rules binary_modules cd ../.. wajig install nvidia-kernel-2.4.20-686_1.0.4349-1+_i386.deb
Next build and install the nVidia GLX package. Again, during this step the file NVIDIA GLX-1.0-4349.tar.gz (about 4.2M) will be retrieved from the nNidia archive: # # # #
cd nvidia-glx-1.0.4349 dpkg-buildpackage -us -uc cd .. wajig install nvidia-glx_1.0.4349-1_i386.deb
If not already modified, edit /etc/X11/XF86Config-4 to replace Driver
"nv"
with Driver
"nvidia"
Remove from the Modules section the: Load Load
"GLcore" "dri"
Make sure to load the new nVidia module:
89.7 nVidia Video Driver
547
modprobe NVdriver
To have this loaded at boot time add the following line to /etc/modules: NVdriver
You can check that it all works by loading some of the GL graphics from xscreensaver. Or run them directly, e.g., ”gears” or ”evas-demo”. On Mint (Section 5.9.27) with version 0.9.769 of the nVidia driver there were problems with system freezes. It generally happened in the xscreensaver preferences when trying some of the GL savers (in full screen mode). In window mode outside of xscreensaver they work just fine. Also freezes were occurring when switching between multiple X Window Sessions (C-A-F7 and C-A-F8, for example). The screen would go black. The problem appears to have gone away with version 1.0.2314 of the nVidia driver. On Velox (Section 5.9.26) with version 0.9.769 of the nVidia driver running the evas test demo command crashed the xserver on exit from evas-demo!
548
Video
Chapter 90 Web: Serving, Accessing, and Mirroring 90.1
Browsing the Web
The Gnome web browser is epiphany. Galeon is an alternative with more features. Both are based on mozilla to render the web pages.
90.1.1
Epiphany
90.1.2
Galeon
Galeon is the Gnome web browser using Mozilla as the rendering engine. For information on adding plugins for Galeon see Section 90.1.4.
90.1.3
Mozilla
Mozilla is the new version of Netscape! It is essentially a rewrite of Netscape as an open source project. The latest version is not available directly from Debian (only an older M18 release is currently available under unstable—15 May 2001) but is supplied by a Debian developer. Add the following to your /etc/apt/sources.list: 549
550
Web: Serving, Accessing, and Mirroring
Figure 90.1: Galeon.
deb http://pandora.debian.org/~kitame/mozilla ./
Mozilla is becoming pretty stable and works as the rendering engine for galeon and epiphany.
90.1.4
Plugins
For Java plugins see Section 48.2.1. For a viewer of various video formats install mplayerplug-in and mplayer-686. The mozplugger package provides a variety of other plugins.
90.2
Web Server
Installing a web server under Debian is as simple as installing apache:
90.2 Web Server
551
Figure 90.2: Galeon.
# wajig install apache
You will now have a default web page at http://localhost/. The actual page being displayed there comes from /var/www/index.html. You can begin creating your own web site from there. For a secure web server, using SSL to encrypt all communications from a browser to the server (recognised with the https: prefix), there are at least two options in Debian. One is to use apache with the libapache-mod-ssl module and the other is to install the apache-ssl which installs a separate apache server to listen to port 443 (instead of 80). There are advantages either way but using apache-ssl is straightforward and cleanly keeps the two servers separate (configuration files are in /etc/apache and /etc/apache-ssl and log files in /var/log/apache and /var/log/apache-ssl respectively).
552
90.2.1
Web: Serving, Accessing, and Mirroring
User Web Pages
The directory /home/kayon/public_html is usually made accessible by default by apache. It can be accessed as: http://www.togaware.com/~kayon/
Files in this directory need to be world readable in order to be accessible through the server. If it is not working then read on. Make sure you have (uncommented) the following line in /etc/apache/ httpd.conf: LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
That will allow Apache to look at a directory under the user’s home directory named public_html.
90.2.2
Bad Behaviour on Missing /
If a ServerName is not defined then when someone visits a page like http://www.togaware.com/debian/book
they will get an error since this is actually a directory being referenced. With a ServerName defined to be www.togaware.com in httpd.conf a / will be automatically appended.
90.2.3
Password Protect Web Files
You can do this either on a per directory basis in /etc/apache/httpd.conf or through the use of a .htaccess file in the directory containing the files to protect. The following is either added to a directive in /etc/apache/httpd.conf or into .htaccess in the relevant directory.
90.2 Web Server
553
AuthUserFile /home/kayon/public_html/.htpasswd AuthGroupFile /dev/null AuthName ByPassword AuthType Basic Require user kayon
Then create the password file: $ cd public_html $ htpasswd -c .htpasswd kayon
You will be prompted for a password. This stores the encrypted password in the file .htpasswd (the -c option says to create the file). You can manually edit this file, keeping the same format, and perhaps even cutting the user passwords from /etc/shadow to maintain the same passwords. Note that you should take precautions to protect the actual encrypted passwords if you copy them from the shadow file (otherwise they may be subject to attempts to crack them). For example: # chown www-data.www-data .htpasswd # chmod o= .htpasswd
I would like to figure out a way to use the system passwords file without making /etc/shadow accessible to everyone (which is precisely the point of the shadow file) and without having to copy the encrypted passwords into .htpasswd. Then I would define the particular user group (AuthGroupFile) as the users who can actually access the relevent web pages. Protecting a cgi-bin directory through the use of the .htaccess file make sure you have in /etc/apache-ssl/httpd.conf: AllowOverride AuthConfig
Normally this is set to None. That is, in /etc/apache-ssl/httpd.conf you should have something like: Options None
554
Web: Serving, Accessing, and Mirroring
AllowOverride AuthConfig Order deny,allow Deny from all Allow from togaware.com
90.2.4
Renew SSL Certificate
I am using a self-signed certificate. To renew the certificate for 30 days once it expires: # ssl-certificate --force -days 365
and supply the requested information. Then restart the server: # /etc/init.d/apache-ssl restart
90.2.5
Compressed HTML
Gzip you html documents and apache will still serve them up as if they were not compressed! All automatically.
90.2.6
Web Log Summaries
A very nice web log analyser and summary generator is awstats. Install the package: # wajig install awstats
This will give you a statistics summary page at http://localhost/cgi-bin/awstats.pl. You will need to enable icons by adding the following line to your apache configuration file /etc/apache/httpd.conf: Alias /awstats-icon/ /usr/share/awstats/icon/
90.2 Web Server
555
Also you may like to include browser and host OS information in the summary by using the apache combined log format:
LogFormat=1
Be sure the apache generates this information (the default is not to). Your /etc/apache/httpd.conf should contain:
CustomLog /var/log/apache/access.log combined
To allow the analyser to run through the apache log files (/var/log/apache/ access) it needs permission to be able to read them. The simplest approach is to:
# chmod o+r /var/log/apache/access*
The summary log file can now be generated with:
# /usr/lib/cgi-bin/awstats.pl -config=awstats -update
(This is what cron also runs every 10 minutes, by default.)
90.2.7
Server Side Includes
Add the following to allow server side includes in .html files:
AddHandler server-parsed .html
And make sure the includes module is included by running:
> wajig reconfigure apache
556
90.2.8
Web: Serving, Accessing, and Mirroring
Identifying the Web Server
To identify the web server running on a particular site you can use the httptype command available from http://httptype.sourceforge.net/. Example usage: > httptype togaware.com Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.1.2
90.3
Mirror Websites
Wget is a command line tool to download multiple files from http and ftp addresses on the Internet. Suppose you wish to download all of the available xmms skins from http://www.spacefem.com/skins/. The skins are in files with the .tar.gz extension: > wget -r -l 1 -A tar.gz -nd http://www.spacefem.com/skins/
Here the -r flag indicates that we want to recurse through the link, while -l 1 indicates that we recurse only a single level. The -A .tar.gz resticts the download to just those files the have a .tar.gz extension. The extenstions can be a comma separated list. The -nd request wget to not create any directories—the files are downloaded to the current directory.
Chapter 91 Word: Processing and Printing The premier Gnome word processor is AbiWord (Chapter 9) and KWord does the same for KDE, although OpenOffice (Chapter 65) provides a word processor that is very competitive with MSWord. Professional editors may be more interested in the LATEX (Chapter 54) publishing systems.
557
558
Word: Processing and Printing
Chapter 92 X: The Window System The X Window System is the GNU/Linux windowing environment, serving a similar function to MS-Windows in providing a graphical windowing interactive mouse point-and-click (WIMP) interface. The first task in setting up the X Window System is to determine the type of your video controller chip. There are very many video controller chips available and when you purchase a PC with MS-Windows preinstalled someone has already done the hard work of making MS-Windows work with the particular video chip. Under Linux you will need to tune the configuration to get the X Window System functionally fully. The X Window System, unlike MS-Windows, is a client-server architecture. You run an X Window System server somewhere (usually on your local host) to display onto your local host. You then run clients (such as word processors, Netscape, etc.) somewhere (usually your local host, but no necessarily) and have them display on through the server onto the display on your local host! The freely available XFree86 is the default X Window System for most GNU/Linux systems. Version 4.1.0 is becoming an easily tuned system. You will then need to run either xf86config (for a console-based interface) or XF86Setup (for a X Window System based interface) to create an appropriate /etc/X11/XF86Config file. If you are in luck, this will be straightforward. Below are sample configurations: 559
560
92.1
X: The Window System
Hand Crafting your XF86Config
Sometimes it is easiest to hand craft a basic /etc/X11/XF86Config file. Here is one for the NeoMagic chipset NM2160 found in many laptop computers. This one works for 16 bpp at 1024x768: Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" FontPath "/usr/X11R6/lib/X11/fonts/misc/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/Type1/" FontPath "/usr/X11R6/lib/X11/fonts/Speedo/" FontPath "/usr/X11R6/lib/X11/fonts/misc/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/" FontPath "/usr/X11R6/lib/X11/fonts/100dpi/" FontPath "/usr/X11R6/lib/X11/fonts/freefont/" FontPath "/usr/X11R6/lib/X11/fonts/sharefont/" EndSection Section "ServerFlags" EndSection Section "Keyboard" Protocol AutoRepeat LeftAlt RightAlt RightCtl ScrollLock XkbKeymap EndSection Section "Pointer" Protocol Device Emulate3Buttons Emulate3Timeout EndSection
"Standard" 500 5 Meta ModeShift Compose ModeLock "xfree86(us)"
"PS/2" "/dev/psaux" 50
Section "Monitor" Identifier "Dell SyncMaster 17GLi"
92.1 Hand Crafting your XF86Config VendorName ModelName HorizSync VertRefresh Modeline EndSection
561
"Dell" "SyncMaster 17GLi" 31.5 - 48.5 55-65 "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
Section "Device" Identifier "NeoMagic" # Option "intern_disp" Option "extern_disp" EndSection Section "Screen" Driver "svga" Device "NeoMagic" Monitor "Dell SyncMaster 17GLi" DefaultColorDepth 16 Subsection "Display" Depth 16 Modes "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection EndSection
This setup is used when the notebook is docked with display being to an external monitor. Both internal and external displays don’t work together and so you need to manually edit the XF86Config file each time you change between the external and internal display (could be done with a script, but essentially you swap the ”#” around, which is used to identify a comment line). It is reported that having both enabled can destroy the internal display. It certainly makes it go pretty ugly momentarily. According to the Linux on the Dell Latitude CPi A366XT page http://www.radcyberzine.com/ linux/linux-dell.html page, you can’t just switch between internal and external displays without updating your XF86Config and restarting X, or YOU CAN DAMAGE YOUR DISPLAYS! The value for the Vertical Refresh rate of 55-65 was suggested by Charlie Hedlin ([email protected] since “LCD’s don’t need 80Hz and the like.” XF86Config for the clgd7543¡/b¿¡/font¿
562
X: The Window System
I hand crafted a simple XF86Config for the clgd7543 that worked to get 8 bpp at 800x600:
92.2
The Basic X Window System Architecture
The most basic mode of operation of Debian is through the console with a command line interface. This is, after all, how Unix users have interfaced with Unix for more than thirty years. In a modern environment though we expect to be able to use the point-and-click interface with the desktop metaphor invented by Xerox in 197XXXX and popularised by the release of the Apple Macintosh in 1984, the X11 Window System in 1986, and finally with MS-Windows in 1995. It is the X Window System that provides the platform for today’s graphical user interfaces in Debian and many other platforms. The X Window System is really nothing more than another application sitting on top of the Linux kernel. However, it is special in that it uses a client-server architecture so important to a multi-user, multi-hardware, networked environment. The significance of this is that you can run your X Window System application on one machine (whether it is a Debian, Redhat, Solaris, Macintosh, or Microsft machine) and have remote hosts of any type display directly to it. As presented in Chapter 92 to run the X Window System we issue the command startx. With no further embelishments we have a basic graphical user interface running and can usually start up oher applications like Netscape. But this is just the start! When you start up an application under the X Window System that application will display a window on your screen. The raw window is under the control of the application while the X Window System simply handles the rendering of the window onto your screen. For a very simply installation this might look like the screen in Figure 92.1. You can get this with the command: $ startx xterm
Or to have this happen automatically each time you start the X Window System simply create an ~/.xsession file and with the single line:
92.2 The Basic X Window System Architecture
563
xterm
Then issue the command: $ startx
Either way this will start up the X Window System and then a terminal emulator (xterm) but absolutely nothing else. If you get an error like the following then you probably already have an X Window System session running on the default virtual terminal (vt07). Fatal server error: Server is already active for display 0 If this server is no longer running, remove /tmp/.X0-lock and start again.
When reporting a problem related to a server crash, please send the full server output, not just the last messages Xlib: connection to ":0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key giving up. xinit:
unable to connect to X server
xinit:
No such process (errno 3):
Server error.
The solution is simply to run the new X Window System server on a different virtual terminal (let’s use vt09, but it could be vt08 or vt10) and we will call the display by the name :1 rather than the default :0 which seems to already be in use: $ startx xterm -- :1 vt09
or else
564
X: The Window System
$ startx -- :1 vt09
When an application is specified as an argument to startx that application is run and the ~/.xsession file is not used.
Figure 92.1: A basic X Window System graphical interface with a single xterm and no glitz. Note the rather bland background pattern, the default X Window System background, often referred to as the herring bone screen. This display will show moire patterns if your monitor is slightly out of tune, which can be corrected! Note that there is no decoration on this single window. That is the job of a window manager but we aren’t running any at the moment. There’s plenty to choose from but let’s stay with sawfish. Sawfish is a window manager that focusses on just managing windows—it leaves out a lot of the other features not specifically related to managing Windows that are supported by many other window mangers like Enlightenment. A window manager is no more than another X Window System application. So in the xterm window we can simply type the command sawfish to run this window manager (and
92.2 The Basic X Window System Architecture
565
we run it as a separate job in the background so that we won’t tie up this xterm—this is the meaning of the ampersand): $ sawfish &
The result is the decorated window we see in Figure 92.2.
Figure 92.2: A basic X Window System graphical interface with a single xterm and running a window manger (sawfish). If instead you run the command gnome-session you will see the desktop in Figure 92.3. To have this as the default behaviour it is suggested you replace the xterm in the ~/.xsession file with: exec gnome-session
Then next time your startx Gnome will automatically begin. Details of working with Gnome are in Chapter 38.
566
X: The Window System
Figure 92.3: The Gnome desktop is now in control. These are the windows that come up by default on a new installation.
92.3 Multiple X Window System Users, One Console
92.3
567
Multiple X Window System Users, One Console
You want two or more users to be able to run on seperate X Window System sessions on the same system. Obviously not interacting with the system at the same time if both sessions are running on console, but not havin to bail out of a session to allow the other user access. Do a console login as the desired userid. Launch an X Window System session to an unused local display. Assuming your first session runs to :0, try: startx -- :1 1>.startx.log 2>&1 &
For gdm, add the following lines to the file ....
92.4
Getting Started with Gnome
We will assume that you have installed Gnome and the related packages. This includes the Gnome Display Manager (gdm) which, once installed, will automatically start up when you boot into Debian. The essence to running Gnome is to include the following in the file ~/ .xsession: exec gnome-session
Alternatively if you are using the Gnome Display Manager (gdm) then select Gnome or Debian from the Session menu.
92.5
GDM Startup
The Gnome Display Manager gdm, when installed, will start up automatically on boot. This presents an X Window System interface to log on. If you are used to starting the X Window System from the command line you will be used to using either .xsession or .xinitrc to tune some of your X Window System settings. The System menu in the gdm dialogue lets you start
568
X: The Window System
up Debian, Gnome, or XSession. To tune your X Window System settings in this environment with your .xsession file be sure to run with the Debian session. If you use the default Gnome session in gdm place your tuning in the file .gnomerc in your home directory, but be sure not to include any window managers, etc., as these are started by the gnome-session command that the Gnome session starts. Some startup tunning I perform incudes: # # Left ALT should be META so that it is the way I like it in Emacs. # xmodmap -e ’keysym Alt_L = Meta_L’ xmodmap -e ’add mod1 = Meta_L’ # # Start up by asking for the SSH Pass Phrase # ssh-add [id=wgi001]
sablotron: Works well but my sample genealogy style sheet with a parameter cause sablotron to find an error! (Perhaps it’s stricter with XSL or else it does not implement some feature—not yet explored.) $ sabcmd [\$id=wgi001]
transformiix: Produces slightly different output to all the rest. Does not seem to allow assignment to parameters. $ transfrmx -s -i
xalan: Works well but could not get it to take the parameter? $ xalan -xsl -in [-param id wgi001]
xsltproc: $ xsltproc [--param id wgi001]
571
572
XML
Thanks Many people have contributed directly and indirectly to this book, with snippets from email messages and discussion group postings and directly to me. I list here some of the people who have contributed, knowingly and unknowingly. Rohinton Kazak fixed many typos. Vincent McIntyre provided information on the installation of the machine I’ve called Vince (Section 5.9.9). Damien McAullay, Christian Kaske, Yoshiro Mihira, Jason Burrell, Bob Bownes, Peter Lamb, Dirk Eddelbuettel, Dean Jackson, Karsten Self, Shaul Karl, Ethan Benson, John Flinchbaugh, Nathan Norman, Noah L. Meyerhans, Manoj Srivastava, and many others.
573