No Starch Press - Unix BSD FreeBSD Linux - Absolute BSD. The Ultimate Guide to FreeBSD (2002).pdf

(7959 KB) Pobierz
Absolute BSD
Absolute BSD—The Ultimate Guide to FreeBSD
29871018.001.png
Table of Contents
Absolute BSD—The Ultimate Guide to FreeBSD............................................................................1
Dedication..........................................................................................................................................3
Foreword............................................................................................................................................4
Introduction........................................................................................................................................5
What Is FreeBSD?...................................................................................................................5
How Did FreeBSD Get Here?..................................................................................................5
The BSD License: BSD Goes Public.......................................................................................6
The Birth of Modern FreeBSD.................................................................................................6
FreeBSD Development............................................................................................................7
Committers.........................................................................................................................7
Contributors........................................................................................................................8
Users..................................................................................................................................8
Other BSDs..............................................................................................................................8
NetBSD..............................................................................................................................8
OpenBSD...........................................................................................................................9
BSD/OS..............................................................................................................................9
Mac OS X...........................................................................................................................9
Other UNIXes...........................................................................................................................9
Solaris................................................................................................................................9
AIX...................................................................................................................................10
Linux................................................................................................................................10
IRIX, HPUX, etc...............................................................................................................10
FreeBSD's Strengths.............................................................................................................10
Portability.........................................................................................................................10
Power...............................................................................................................................10
Simplified Software Management....................................................................................11
Optimized Upgrade Process............................................................................................11
Filesystem........................................................................................................................11
Who Should Use FreeBSD....................................................................................................11
FreeBSD as Your Desktop.....................................................................................................11
Who Should Run Another BSD..............................................................................................12
Who Should Run a Proprietary Operating System................................................................12
How to Read This Book.........................................................................................................13
What Must You Know?..........................................................................................................13
How to Think About UNIX......................................................................................................14
Channels of Communication............................................................................................14
Working with Channels....................................................................................................14
The Command Line..........................................................................................................14
Chapter 1: Installation.....................................................................................................................16
FreeBSD Hardware................................................................................................................16
Processor.........................................................................................................................16
Memory (RAM).................................................................................................................16
Hard Drives......................................................................................................................16
Downloading FreeBSD..........................................................................................................17
Installing by FTP..............................................................................................................18
Other FTP Install Information...........................................................................................19
i
Table of Contents
Chapter 1: Installation
Hardware Setup.....................................................................................................................19
Actually Installing FreeBSD...................................................................................................20
Configuring the Kernel for ISA Cards...............................................................................21
Sysinstall: The Ugly FreeBSD Installer............................................................................21
Disk Usage.......................................................................................................................22
Partitioning.............................................................................................................................24
Root.......................................................................................................................................25
Swap Space...........................................................................................................................25
Swap Splitting..................................................................................................................26
/var, /usr, and /home..............................................................................................................26
A Second Hard Drive.............................................................................................................27
Soft Updates....................................................................................................................28
Block Size........................................................................................................................28
What to Install..................................................................................................................28
Installation Media.............................................................................................................29
Committing.......................................................................................................................30
Post−Install Setup..................................................................................................................30
Root Password.................................................................................................................30
Adding Users....................................................................................................................31
Time Zone........................................................................................................................32
Mouse..............................................................................................................................32
Configuring Network Cards..............................................................................................33
Xfree86............................................................................................................................35
Software...........................................................................................................................35
Restart...................................................................................................................................36
A Note on Editors...................................................................................................................37
Chapter 2: Getting More Help.........................................................................................................38
Why Not Mail First?................................................................................................................38
The FreeBSD Attitude............................................................................................................38
Man Pages.............................................................................................................................39
The FreeBSD Manual......................................................................................................40
Man Page Headings.........................................................................................................41
The FreeBSD Documentation................................................................................................42
The Mailing List Archives.......................................................................................................42
Other Web Sites.....................................................................................................................43
Using FreeBSD Problem−Solving Resources........................................................................43
Checking the Handbook/FAQ..........................................................................................43
Checking the Man Pages.................................................................................................43
Checking the Mailing List Archives..................................................................................45
Using Your Answer..........................................................................................................45
Mailing for Help................................................................................................................45
Chapter 3: Read This Before You Break Something Else! (Backup and Recovery).................48
Overview................................................................................................................................48
System Backups....................................................................................................................48
Tape Devices.........................................................................................................................49
How to Read Dmesg.boot................................................................................................49
Controlling Your Tape Drive...................................................................................................50
ii
Table of Contents
Chapter 3: Read This Before You Break Something Else! (Backup and Recovery)
Device Nodes...................................................................................................................50
Using the TAPE Variable.................................................................................................50
The mt Command............................................................................................................51
Backup Programs..................................................................................................................52
Ta....................................................................................................................................52
Dump/Restore..................................................................................................................55
Restoring from an Archive.....................................................................................................58
Checking the Contents of an Archive...............................................................................58
Extracting Data from an Archive......................................................................................58
Restoring Interactively......................................................................................................59
Recording What Happened....................................................................................................60
Revision Contro.....................................................................................................................61
Getting Older Versions.....................................................................................................63
Breaking Locks.................................................................................................................64
Viewing Log Messages....................................................................................................64
Reviewing a File's Revision History.................................................................................65
Ident and ident Strings.....................................................................................................65
Going Further...................................................................................................................66
Single−User Mode.................................................................................................................66
The Fixit Disk.........................................................................................................................68
Chapter 4: Kernel Games................................................................................................................70
Overview................................................................................................................................70
What Is the Kernel?...............................................................................................................70
Configuring Your Kerne.........................................................................................................71
Sysct................................................................................................................................71
Changing Sysctls.............................................................................................................74
Setting Sysctls at Boot.....................................................................................................74
Kernel Configuration with Loader.conf.............................................................................75
Manually Configuring the Loader.....................................................................................77
Loading and Unloading Modules in Multi−User Mode...........................................................78
Viewing Loaded Modules.................................................................................................78
Loading and Unloading Modules......................................................................................79
Customizing the Kerne..........................................................................................................79
Preparation.......................................................................................................................79
Your Backup Kernel.........................................................................................................80
Editing Kernel Files..........................................................................................................80
Basic Options...................................................................................................................83
Multiple Processors..........................................................................................................86
Device Entries..................................................................................................................86
Building Your Kernel..............................................................................................................89
Troubleshooting Kernel Builds.........................................................................................90
Booting an Alternate Kernel...................................................................................................91
Adding to the Kernel..............................................................................................................92
LINT.................................................................................................................................92
Fixing Errors with Options................................................................................................93
Tweaking Kernel Performance...............................................................................................94
Sharing Kernels.....................................................................................................................96
iii
Table of Contents
Chapter 5: Networking....................................................................................................................97
Overview................................................................................................................................97
Network Layers......................................................................................................................97
The Physical Laye...........................................................................................................98
The Physical Protocol Layer............................................................................................98
The Logical Protocol Layer..............................................................................................99
The Application Layer....................................................................................................100
The Network in Practice.......................................................................................................100
Mbufs.............................................................................................................................101
What Is a Bit?.................................................................................................................101
Ethernet...............................................................................................................................102
Broadcasting..................................................................................................................103
Address Resolution........................................................................................................103
Hubs and Switches........................................................................................................103
Netmasks.......................................................................................................................104
Netmask Tricks..............................................................................................................105
Hexadecimal Netmasks.................................................................................................105
Unusable IP Addresses..................................................................................................106
Routing...........................................................................................................................106
UDP and TCP................................................................................................................107
Network Ports.................................................................................................................107
Connecting to an Ethernet Network.....................................................................................108
Multiple IP Addresses on One Interface.........................................................................110
Using Netsta..................................................................................................................111
Chapter 6: Upgrading FreeBSD....................................................................................................116
Overview..............................................................................................................................116
FreeBSD Versions...............................................................................................................116
Release..........................................................................................................................116
FreeBSD−current...........................................................................................................117
FreeBSD−stable.............................................................................................................117
Snapshots......................................................................................................................118
Security Updates............................................................................................................118
Which Release Should You Use?..................................................................................119
Upgrade Methods................................................................................................................119
Upgrading via Sysinstal.................................................................................................119
Upgrading via CVSup.....................................................................................................120
Simplifying the CVSup Upgrade Process.......................................................................130
Building a Local CVSup Serve............................................................................................132
Controlling Access.........................................................................................................134
Authentication................................................................................................................135
Combining Authentication and Access...........................................................................137
Chapter 7: Securing Your System................................................................................................138
Overview..............................................................................................................................138
Who Is the Enemy?..............................................................................................................138
Script Kiddies.................................................................................................................139
Disaffected Users...........................................................................................................139
Skilled Attackers.............................................................................................................139
FreeBSD Security Announcements.....................................................................................139
iv
Zgłoś jeśli naruszono regulamin