FreeBSD Handbook.pdf

(4155 KB) Pobierz
book.dvi
FreeBSD Handbook
The FreeBSD Documentation Project
FreeBSD Handbook
by The FreeBSD Documentation Project
Published February 1999
Copyright © 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 by The FreeBSD Documentation Project
Welcome to FreeBSD! This handbook covers the installation and day to day use of FreeBSD 4.6.2-RELEASE . This
manual is a work in progress and is the work of many individuals. Many sections do not yet exist and some of those
that do exist need to be updated. If you are interested in helping with this project, send email to the FreeBSD
documentation project mailing list < freebsd-doc@FreeBSD.org >. The latest version of this document is always
available from the FreeBSD web site (../../../../index.html). It may also be downloaded in a variety of formats and
compression options from the FreeBSD FTP server (ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/) or one of the
numerous mirror sites. If you would prefer to have a hard copy of the handbook, you can purchase one at the
FreeBSD Mall (http://www.freebsdmall.com/). You may also want to search the handbook
(../../../../search/index.html).
Redistribution and use in source (SGML DocBook) and ’compiled’ forms (SGML, HTML, PDF, PostScript, RTF and so forth) with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code (SGML DocBook) must retain the above copyright notice, this list of conditions
and the following disclaimer as the first lines of this file unmodified.
2. Redistributions in compiled form (transformed to other DTDs, converted to PDF, PostScript, RTF and other
formats) must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Important: THIS DOCUMENTATION IS PROVIDED BY THE FREEBSD DOCUMENTATION PROJECT "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL THE FREEBSD DOCUMENTATION PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
Table of Contents
Preface.............................................................................................................................................................................i
I. Getting Started ...........................................................................................................................................................i
1 Introduction ........................................................................................................................................................1
1.1 Synopsis .................................................................................................................................................1
1.2 Welcome to FreeBSD! ...........................................................................................................................1
1.3 About the FreeBSD Project ...................................................................................................................4
2 Installing FreeBSD .............................................................................................................................................9
2.1 Synopsis .................................................................................................................................................9
2.2 Pre-installation Tasks .............................................................................................................................9
2.3 Starting the Installation........................................................................................................................15
2.4 Introducing Sysinstall ..........................................................................................................................24
2.5 Allocating Disk Space .........................................................................................................................28
2.6 Choosing What To Install ....................................................................................................................46
2.7 Choosing Your Installation Media .......................................................................................................48
2.8 Committing to the Installation .............................................................................................................49
2.9 Post-installation ...................................................................................................................................50
2.10 Supported Hardware ..........................................................................................................................87
2.11 Troubleshooting .................................................................................................................................87
2.12 Advanced Installation Guide .............................................................................................................89
2.13 Preparing Your Own Installation Media ............................................................................................91
3 Unix Basics ......................................................................................................................................................97
3.1 Synopsis ...............................................................................................................................................97
3.2 Permissions ..........................................................................................................................................97
3.3 Directory Structure ..............................................................................................................................98
3.4 Mounting and Unmounting Filesystems............................................................................................100
3.5 Processes............................................................................................................................................102
3.6 Daemons, Signals, and Killing Processes..........................................................................................104
3.7 Shells..................................................................................................................................................106
3.8 Text Editors........................................................................................................................................107
3.9 Devices and Device Nodes ................................................................................................................108
3.10 For More Information ......................................................................................................................109
4 Installing Applications: Packages and Ports ..................................................................................................111
4.1 Synopsis .............................................................................................................................................111
4.2 Overview of Software Installation .....................................................................................................111
4.3 Finding Your Application ..................................................................................................................113
4.4 Using the Packages System ...............................................................................................................113
4.5 Using the Ports Collection .................................................................................................................115
4.6 Post-installation activities ..................................................................................................................120
4.7 Troubleshooting .................................................................................................................................121
5 The X Window System ..................................................................................................................................128
5.1 Synopsis .............................................................................................................................................128
5.2 Understanding X ................................................................................................................................128
5.3 Installing XFree86 .............................................................................................................................130
5.4 XFree86 Configuration ......................................................................................................................131
5.5 Using Fonts in XFree86.....................................................................................................................134
iii
5.6 The X Display Manager.....................................................................................................................136
5.7 Desktop Environments.......................................................................................................................139
II. System Administration ........................................................................................................................................145
6 Configuration and Tuning...............................................................................................................................146
6.1 Synopsis .............................................................................................................................................146
6.2 Initial Configuration...........................................................................................................................146
6.3 Core Configuration ............................................................................................................................148
6.4 Application Configuration .................................................................................................................148
6.5 Starting Services ................................................................................................................................149
6.6 Virtual Hosts ......................................................................................................................................150
6.7 Configuration Files ............................................................................................................................151
6.8 Tuning with sysctl..............................................................................................................................155
6.9 Tuning Disks......................................................................................................................................155
6.10 Tuning Kernel Limits.......................................................................................................................158
6.11 Adding Swap Space .........................................................................................................................159
7 The FreeBSD Booting Process.......................................................................................................................161
7.1 Synopsis .............................................................................................................................................161
7.2 The Booting Problem.........................................................................................................................161
7.3 The MBR, and Boot Stages One, Two, and Three ............................................................................162
7.4 Kernel Interaction During Boot .........................................................................................................166
7.5 Init: Process Control Initialization.....................................................................................................166
7.6 Shutdown Sequence ...........................................................................................................................167
8 Users and Basic Account Management..........................................................................................................168
8.1 Synopsis .............................................................................................................................................168
8.2 Introduction........................................................................................................................................168
8.3 The Superuser Account......................................................................................................................169
8.4 System Accounts ...............................................................................................................................170
8.5 User Accounts....................................................................................................................................170
8.6 Modifying Accounts ..........................................................................................................................170
8.7 Limiting Users ...................................................................................................................................175
8.8 Personalizing Users ...........................................................................................................................177
8.9 Groups................................................................................................................................................177
9 Configuring the FreeBSD Kernel ...................................................................................................................180
9.1 Synopsis .............................................................................................................................................180
9.2 Why Build a Custom Kernel? ............................................................................................................180
9.3 Building and Installing a Custom Kernel ..........................................................................................181
9.4 The Configuration File.......................................................................................................................183
9.5 Making Device Nodes .......................................................................................................................194
9.6 If Something Goes Wrong .................................................................................................................195
10 Security.........................................................................................................................................................197
10.1 Synopsis ...........................................................................................................................................197
10.2 Introduction......................................................................................................................................197
10.3 Securing FreeBSD ...........................................................................................................................199
10.4 DES, MD5, and Crypt .....................................................................................................................205
10.5 S/Key ...............................................................................................................................................206
10.6 Kerberos...........................................................................................................................................211
10.7 Firewalls...........................................................................................................................................218
iv
10.8 OpenSSL..........................................................................................................................................227
10.9 IPsec.................................................................................................................................................227
10.10 OpenSSH .......................................................................................................................................232
11 Printing .........................................................................................................................................................237
11.1 Synopsis ...........................................................................................................................................237
11.2 Introduction......................................................................................................................................237
11.3 Basic Setup ......................................................................................................................................238
11.4 Advanced Printer Setup ...................................................................................................................250
11.5 Using Printers ..................................................................................................................................278
11.6 Alternatives to the Standard Spooler ...............................................................................................285
11.7 Troubleshooting ...............................................................................................................................285
12 Storage..........................................................................................................................................................289
12.1 Synopsis ...........................................................................................................................................289
12.2 Device Names ..................................................................................................................................289
12.3 Adding Disks ...................................................................................................................................289
12.4 Network, Memory, and File-Based Filesystems ..............................................................................292
12.5 Filesystem Snapshots.......................................................................................................................293
12.6 Filesystem Quotas............................................................................................................................294
12.7 Creating and Using Optical Media (CDs & DVDs) ........................................................................297
12.8 RAID................................................................................................................................................301
12.9 Tape Backup Media .........................................................................................................................304
12.10 Backup Programs...........................................................................................................................307
12.11 Floppy disks...................................................................................................................................314
12.12 Backups to Floppies.......................................................................................................................315
13 The Vinum Volume Manager .......................................................................................................................317
13.1 Synopsis ...........................................................................................................................................317
13.2 Disks are too small...........................................................................................................................317
13.3 Access bottlenecks...........................................................................................................................317
13.4 Data integrity ...................................................................................................................................319
13.5 Vinum objects ..................................................................................................................................320
13.6 Some examples ................................................................................................................................322
13.7 Object naming..................................................................................................................................328
13.8 Configuring Vinum ..........................................................................................................................331
14 Localization - I18N/L10N Usage and Setup ................................................................................................333
14.1 Synopsis ...........................................................................................................................................333
14.2 The Basics........................................................................................................................................333
14.3 Using Localization...........................................................................................................................334
14.4 Compiling I18N Programs...............................................................................................................340
14.5 Localizing FreeBSD to Specific Languages ....................................................................................340
15 Multimedia ...................................................................................................................................................344
15.1 Synopsis ...........................................................................................................................................344
15.2 Setting Up The Sound Card .............................................................................................................344
15.3 MP3 Audio.......................................................................................................................................348
15.4 Video Playback ................................................................................................................................351
16 Serial Communications ................................................................................................................................360
16.1 Synopsis ...........................................................................................................................................360
16.2 Introduction......................................................................................................................................360
16.3 Terminals .........................................................................................................................................364
v
Zgłoś jeśli naruszono regulamin