FreeBSD Handbook The FreeBSD Documentation Project Copyright © 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The FreeBSD Documentation Project Welcome to FreeBSD! This handbook covers the installation and day to day use of /FreeBSD 6.3-RELEASE/ and /FreeBSD 7.0-RELEASE/. This manual is a /work in progress/ and is the work of many individuals. As such, some sections may become dated and require updating. If you are interested in helping out with this project, send email to the FreeBSD documentation project mailing list . The latest version of this document is always available from the FreeBSD web site (previous versions of this handbook can be obtained from http://docs.FreeBSD.org/doc/). It may also be downloaded in a variety of formats and compression options from the FreeBSD FTP server or one of the numerous mirror sites <#MIRRORS-FTP>. If you would prefer to have a hard copy of the handbook, you can purchase one at the FreeBSD Mall . 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. FreeBSD is a registered trademark of the FreeBSD Foundation. 3Com and HomeConnect are registered trademarks of 3Com Corporation. 3ware and Escalade are registered trademarks of 3ware Inc. ARM is a registered trademark of ARM Limited. Adaptec is a registered trademark of Adaptec, Inc. Adobe, Acrobat, Acrobat Reader, and PostScript are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. Apple, AirPort, FireWire, Mac, Macintosh, Mac OS, Quicktime, and TrueType are trademarks of Apple Computer, Inc., registered in the United States and other countries. Corel and WordPerfect are trademarks or registered trademarks of Corel Corporation and/or its subsidiaries in Canada, the United States and/or other countries. Sound Blaster is a trademark of Creative Technology Ltd. in the United States and/or other countries. CVSup is a registered trademark of John D. Polstra. Heidelberg, Helvetica, Palatino, and Times Roman are either registered trademarks or trademarks of Heidelberger Druckmaschinen AG in the U.S. and other countries. IBM, AIX, EtherJet, Netfinity, OS/2, PowerPC, PS/2, S/390, and ThinkPad are trademarks of International Business Machines Corporation in the United States, other countries, or both. IEEE, POSIX, and 802 are registered trademarks of Institute of Electrical and Electronics Engineers, Inc. in the United States. Intel, Celeron, EtherExpress, i386, i486, Itanium, Pentium, and Xeon are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Intuit and Quicken are registered trademarks and/or registered service marks of Intuit Inc., or one of its subsidiaries, in the United States and other countries. Linux is a registered trademark of Linus Torvalds. LSI Logic, AcceleRAID, eXtremeRAID, MegaRAID and Mylex are trademarks or registered trademarks of LSI Logic Corp. M-Systems and DiskOnChip are trademarks or registered trademarks of M-Systems Flash Disk Pioneers, Ltd. Macromedia, Flash, and Shockwave are trademarks or registered trademarks of Macromedia, Inc. in the United States and/or other countries. Microsoft, IntelliMouse, MS-DOS, Outlook, Windows, Windows Media and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Netscape and the Netscape Navigator are registered trademarks of Netscape Communications Corporation in the U.S. and other countries. GateD and NextHop are registered and unregistered trademarks of NextHop in the U.S. and other countries. Motif, OSF/1, and UNIX are registered trademarks and IT DialTone and The Open Group are trademarks of The Open Group in the United States and other countries. Oracle is a registered trademark of Oracle Corporation. PowerQuest and PartitionMagic are registered trademarks of PowerQuest Corporation in the United States and/or other countries. RealNetworks, RealPlayer, and RealAudio are the registered trademarks of RealNetworks, Inc. Red Hat, RPM, are trademarks or registered trademarks of Red Hat, Inc. in the United States and other countries. SAP, R/3, and mySAP are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. Sun, Sun Microsystems, Java, Java Virtual Machine, JavaServer Pages, JDK, JRE, JSP, JVM, Netra, Solaris, StarOffice, Sun Blade, Sun Enterprise, Sun Fire, SunOS, and Ultra are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Symantec and Ghost are registered trademarks of Symantec Corporation in the United States and other countries. MATLAB is a registered trademark of The MathWorks, Inc. SpeedTouch is a trademark of Thomson. U.S. Robotics and Sportster are registered trademarks of U.S. Robotics Corporation. VMware is a trademark of VMware, Inc. Waterloo Maple and Maple are trademarks or registered trademarks of Waterloo Maple Inc. Mathematica is a registered trademark of Wolfram Research, Inc. XFree86 is a trademark of The XFree86 Project, Inc. Ogg Vorbis and Xiph.Org are trademarks of Xiph.Org. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and the FreeBSD Project was aware of the trademark claim, the designations have been followed by the ??? or the ?®? symbol. [ Split HTML <./index.html> / Single HTML <./book.html> ] ------------------------------------------------------------------------ *Table of Contents* Preface <#BOOK-PREFACE> I. Getting Started <#GETTING-STARTED> 1 Introduction <#INTRODUCTION> 1.1 Synopsis <#INTRODUCTION-SYNOPSIS> 1.2 Welcome to FreeBSD! <#NUTSHELL> 1.3 About the FreeBSD Project <#HISTORY> 2 Installing FreeBSD <#INSTALL> 2.1 Synopsis <#INSTALL-SYNOPSIS> 2.2 Hardware Requirements <#INSTALL-HARDWARE> 2.3 Pre-installation Tasks <#INSTALL-PRE> 2.4 Starting the Installation <#INSTALL-START> 2.5 Introducing Sysinstall <#USING-SYSINSTALL> 2.6 Allocating Disk Space <#INSTALL-STEPS> 2.7 Choosing What to Install <#INSTALL-CHOOSING> 2.8 Choosing Your Installation Media <#INSTALL-MEDIA> 2.9 Committing to the Installation <#INSTALL-FINAL-WARNING> 2.10 Post-installation <#INSTALL-POST> 2.11 Troubleshooting <#INSTALL-TROUBLE> 2.12 Advanced Installation Guide <#INSTALL-ADVANCED> 2.13 Preparing Your Own Installation Media <#INSTALL-DIFF-MEDIA> 3 UNIX Basics <#BASICS> 3.1 Synopsis <#BASICS-SYNOPSIS> 3.2 Virtual Consoles and Terminals <#CONSOLES> 3.3 Permissions <#PERMISSIONS> 3.4 Directory Structure <#DIRSTRUCTURE> 3.5 Disk Organization <#DISK-ORGANIZATION> 3.6 Mounting and Unmounting File Systems <#MOUNT-UNMOUNT> 3.7 Processes <#BASICS-PROCESSES> 3.8 Daemons, Signals, and Killing Processes <#BASICS-DAEMONS> 3.9 Shells <#SHELLS> 3.10 Text Editors <#EDITORS> 3.11 Devices and Device Nodes <#BASICS-DEVICES> 3.12 Binary Formats <#BINARY-FORMATS> 3.13 For More Information <#BASICS-MORE-INFORMATION> 4 Installing Applications: Packages and Ports <#PORTS> 4.1 Synopsis <#PORTS-SYNOPSIS> 4.2 Overview of Software Installation <#PORTS-OVERVIEW> 4.3 Finding Your Application <#PORTS-FINDING-APPLICATIONS> 4.4 Using the Packages System <#PACKAGES-USING> 4.5 Using the Ports Collection <#PORTS-USING> 4.6 Post-installation Activities <#PORTS-NEXTSTEPS> 4.7 Dealing with Broken Ports <#PORTS-BROKEN> 5 The X Window System <#X11> 5.1 Synopsis <#X11-SYNOPSIS> 5.2 Understanding X <#X-UNDERSTANDING> 5.3 Installing X11 <#X-INSTALL> 5.4 X11 Configuration <#X-CONFIG> 5.5 Using Fonts in X11 <#X-FONTS> 5.6 The X Display Manager <#X-XDM> 5.7 Desktop Environments <#X11-WM> II. Common Tasks <#COMMON-TASKS> 6 Desktop Applications <#DESKTOP> 6.1 Synopsis <#DESKTOP-SYNOPSIS> 6.2 Browsers <#DESKTOP-BROWSERS> 6.3 Productivity <#DESKTOP-PRODUCTIVITY> 6.4 Document Viewers <#DESKTOP-VIEWERS> 6.5 Finance <#DESKTOP-FINANCE> 6.6 Summary <#DESKTOP-SUMMARY> 7 Multimedia <#MULTIMEDIA> 7.1 Synopsis <#MULTIMEDIA-SYNOPSIS> 7.2 Setting Up the Sound Card <#SOUND-SETUP> 7.3 MP3 Audio <#SOUND-MP3> 7.4 Video Playback <#VIDEO-PLAYBACK> 7.5 Setting Up TV Cards <#TVCARD> 7.6 Image Scanners <#SCANNERS> 8 Configuring the FreeBSD Kernel <#KERNELCONFIG> 8.1 Synopsis <#KERNELCONFIG-SYNOPSIS> 8.2 Why Build a Custom Kernel? <#KERNELCONFIG-CUSTOM-KERNEL> 8.3 Finding the System Hardware <#KERNELCONFIG-DEVICES> 8.4 Building and Installing a Custom Kernel <#KERNELCONFIG-BUILDING> 8.5 The Configuration File <#KERNELCONFIG-CONFIG> 8.6 If Something Goes Wrong <#KERNELCONFIG-TROUBLE> 9 Printing <#PRINTING> 9.1 Synopsis <#PRINTING-SYNOPSIS> 9.2 Introduction <#PRINTING-INTRO-SPOOLER> 9.3 Basic Setup <#PRINTING-INTRO-SETUP> 9.4 Advanced Printer Setup <#PRINTING-ADVANCED> 9.5 Using Printers <#PRINTING-USING> 9.6 Alternatives to the Standard Spooler <#PRINTING-LPD-ALTERNATIVES> 9.7 Troubleshooting <#PRINTING-TROUBLESHOOTING> 10 Linux Binary Compatibility <#LINUXEMU> 10.1 Synopsis <#LINUXEMU-SYNOPSIS> 10.2 Installation <#LINUXEMU-LBC-INSTALL> 10.3 Installing Mathematica® <#LINUXEMU-MATHEMATICA> 10.4 Installing Maple? <#LINUXEMU-MAPLE> 10.5 Installing MATLAB® <#LINUXEMU-MATLAB> 10.6 Installing Oracle® <#LINUXEMU-ORACLE> 10.7 Installing SAP® R/3® <#SAPR3> 10.8 Advanced Topics <#LINUXEMU-ADVANCED> III. System Administration <#SYSTEM-ADMINISTRATION> 11 Configuration and Tuning <#CONFIG-TUNING> 11.1 Synopsis <#CONFIG-SYNOPSIS> 11.2 Initial Configuration <#CONFIGTUNING-INITIAL> 11.3 Core Configuration <#CONFIGTUNING-CORE-CONFIGURATION> 11.4 Application Configuration <#CONFIGTUNING-APPCONFIG> 11.5 Starting Services <#CONFIGTUNING-STARTING-SERVICES> 11.6 Configuring the cron Utility <#CONFIGTUNING-CRON> 11.7 Using rc under FreeBSD <#CONFIGTUNING-RCD> 11.8 Setting Up Network Interface Cards <#CONFIG-NETWORK-SETUP> 11.9 Virtual Hosts <#CONFIGTUNING-VIRTUAL-HOSTS> 11.10 Configuration Files <#CONFIGTUNING-CONFIGFILES> 11.11 Tuning with sysctl <#CONFIGTUNING-SYSCTL> 11.12 Tuning Disks <#CONFIGTUNING-DISK> 11.13 Tuning Kernel Limits <#CONFIGTUNING-KERNEL-LIMITS> 11.14 Adding Swap Space <#ADDING-SWAP-SPACE> 11.15 Power and Resource Management <#ACPI-OVERVIEW> 11.16 Using and Debugging FreeBSD ACPI <#ACPI-DEBUG> 12 The FreeBSD Booting Process <#BOOT> 12.1 Synopsis <#BOOT-SYNOPSIS> 12.2 The Booting Problem <#BOOT-INTRODUCTION> 12.3 The Boot Manager and Boot Stages <#BOOT-BLOCKS> 12.4 Kernel Interaction During Boot <#BOOT-KERNEL> 12.5 Device Hints <#DEVICE-HINTS> 12.6 Init: Process Control Initialization <#BOOT-INIT> 12.7 Shutdown Sequence <#BOOT-SHUTDOWN> 13 Users and Basic Account Management <#USERS> 13.1 Synopsis <#USERS-SYNOPSIS> 13.2 Introduction <#USERS-INTRODUCTION> 13.3 The Superuser Account <#USERS-SUPERUSER> 13.4 System Accounts <#USERS-SYSTEM> 13.5 User Accounts <#USERS-USER> 13.6 Modifying Accounts <#USERS-MODIFYING> 13.7 Limiting Users <#USERS-LIMITING> 13.8 Groups <#USERS-GROUPS> 14 Security <#SECURITY> 14.1 Synopsis <#SECURITY-SYNOPSIS> 14.2 Introduction <#SECURITY-INTRO> 14.3 Securing FreeBSD <#SECURING-FREEBSD> 14.4 DES, Blowfish, MD5, and Crypt <#CRYPT> 14.5 One-time Passwords <#ONE-TIME-PASSWORDS> 14.6 TCP Wrappers <#TCPWRAPPERS> 14.7 *KerberosIV* <#KERBEROSIV> 14.8 *Kerberos5* <#KERBEROS5> 14.9 OpenSSL <#OPENSSL> 14.10 VPN over IPsec <#IPSEC> 14.11 OpenSSH <#OPENSSH> 14.12 File System Access Control Lists <#FS-ACL> 14.13 Monitoring Third Party Security Issues <#SECURITY-PORTAUDIT> 14.14 FreeBSD Security Advisories <#SECURITY-ADVISORIES> 14.15 Process Accounting <#SECURITY-ACCOUNTING> 15 Jails <#JAILS> 15.1 Synopsis <#JAILS-SYNOPSIS> 15.2 Terms Related to Jails <#JAILS-TERMS> 15.3 Introduction <#JAILS-INTRO> 15.4 Creating and Controlling Jails <#JAILS-BUILD> 15.5 Fine Tuning and Administration <#JAILS-TUNING> 15.6 Application of Jails <#JAILS-APPLICATION> 16 Mandatory Access Control <#MAC> 16.1 Synopsis <#MAC-SYNOPSIS> 16.2 Key Terms in this Chapter <#MAC-INLINE-GLOSSARY> 16.3 Explanation of MAC <#MAC-INITIAL> 16.4 Understanding MAC Labels <#MAC-UNDERSTANDLABEL> 16.5 Planning the Security Configuration <#MAC-PLANNING> 16.6 Module Configuration <#MAC-MODULES> 16.7 The MAC bsdextended Module <#MAC-BSDEXTENDED> 16.8 The MAC ifoff Module <#MAC-IFOFF> 16.9 The MAC portacl Module <#MAC-PORTACL> 16.10 The MAC partition Module <#MAC-PARTITION> 16.11 The MAC Multi-Level Security Module <#MAC-MLS> 16.12 The MAC Biba Module <#MAC-BIBA> 16.13 The MAC LOMAC Module <#MAC-LOMAC> 16.14 Nagios in a MAC Jail <#MAC-IMPLEMENTING> 16.15 User Lock Down <#MAC-USERLOCKED> 16.16 Troubleshooting the MAC Framework <#MAC-TROUBLESHOOT> 17 Security Event Auditing <#AUDIT> 17.1 Synopsis <#AUDIT-SYNOPSIS> 17.2 Key Terms in this Chapter <#AUDIT-INLINE-GLOSSARY> 17.3 Installing Audit Support <#AUDIT-INSTALL> 17.4 Audit Configuration <#AUDIT-CONFIG> 17.5 Administering the Audit Subsystem <#AUDIT-ADMINISTRATION> 18 Storage <#DISKS> 18.1 Synopsis <#DISKS-SYNOPSIS> 18.2 Device Names <#DISKS-NAMING> 18.3 Adding Disks <#DISKS-ADDING> 18.4 RAID <#RAID> 18.5 USB Storage Devices <#USB-DISKS> 18.6 Creating and Using Optical Media (CDs) <#CREATING-CDS> 18.7 Creating and Using Optical Media (DVDs) <#CREATING-DVDS> 18.8 Creating and Using Floppy Disks <#FLOPPIES> 18.9 Creating and Using Data Tapes <#BACKUPS-TAPEBACKUPS> 18.10 Backups to Floppies <#BACKUPS-FLOPPYBACKUPS> 18.11 Backup Strategies <#BACKUP-STRATEGIES> 18.12 Backup Basics <#BACKUP-BASICS> 18.13 Network, Memory, and File-Backed File Systems <#DISKS-VIRTUAL> 18.14 File System Snapshots <#SNAPSHOTS> 18.15 File System Quotas <#QUOTAS> 18.16 Encrypting Disk Partitions <#DISKS-ENCRYPTING> 18.17 Encrypting Swap Space <#SWAP-ENCRYPTING> 19 GEOM: Modular Disk Transformation Framework <#GEOM> 19.1 Synopsis <#GEOM-SYNOPSIS> 19.2 GEOM Introduction <#GEOM-INTRO> 19.3 RAID0 - Striping <#GEOM-STRIPING> 19.4 RAID1 - Mirroring <#GEOM-MIRROR> 19.5 GEOM Gate Network Devices <#GEOM-GGATE> 19.6 Labeling Disk Devices <#GEOM-GLABEL> 19.7 UFS Journaling Through GEOM <#GEOM-GJOURNAL> 20 The Vinum Volume Manager <#VINUM-VINUM> 20.1 Synopsis <#VINUM-SYNOPSIS> 20.2 Disks Are Too Small <#VINUM-INTRO> 20.3 Access Bottlenecks <#VINUM-ACCESS-BOTTLENECKS> 20.4 Data Integrity <#VINUM-DATA-INTEGRITY> 20.5 Vinum Objects <#VINUM-OBJECTS> 20.6 Some Examples <#VINUM-EXAMPLES> 20.7 Object Naming <#VINUM-OBJECT-NAMING> 20.8 Configuring Vinum <#VINUM-CONFIG> 20.9 Using Vinum for the Root Filesystem <#VINUM-ROOT> 21 Virtualization <#VIRTUALIZATION> 21.1 Synopsis <#VIRTUALIZATION-SYNOPSIS> 21.2 FreeBSD as a Guest OS <#VIRTUALIZATION-GUEST> 21.3 FreeBSD as a Host OS <#VIRTUALIZATION-HOST> 22 Localization - I18N/L10N Usage and Setup <#L10N> 22.1 Synopsis <#L10N-SYNOPSIS> 22.2 The Basics <#L10N-BASICS> 22.3 Using Localization <#USING-LOCALIZATION> 22.4 Compiling I18N Programs <#L10N-COMPILING> 22.5 Localizing FreeBSD to Specific Languages <#LANG-SETUP> 23 The Cutting Edge <#CUTTING-EDGE> 23.1 Synopsis <#CUTTING-EDGE-SYNOPSIS> 23.2 FreeBSD-CURRENT vs. FreeBSD-STABLE <#CURRENT-STABLE> 23.3 Synchronizing Your Source <#SYNCHING> 23.4 Rebuilding ?world? <#MAKEWORLD> 23.5 Tracking for Multiple Machines <#SMALL-LAN> IV. Network Communication <#NETWORK-COMMUNICATION> 24 Serial Communications <#SERIALCOMMS> 24.1 Synopsis <#SERIAL-SYNOPSIS> 24.2 Introduction <#SERIAL> 24.3 Terminals <#TERM> 24.4 Dial-in Service <#DIALUP> 24.5 Dial-out Service <#DIALOUT> 24.6 Setting Up the Serial Console <#SERIALCONSOLE-SETUP> 25 PPP and SLIP <#PPP-AND-SLIP> 25.1 Synopsis <#PPP-AND-SLIP-SYNOPSIS> 25.2 Using User PPP <#USERPPP> 25.3 Using Kernel PPP <#PPP> 25.4 Troubleshooting PPP Connections <#PPP-TROUBLESHOOT> 25.5 Using PPP over Ethernet (PPPoE) <#PPPOE> 25.6 Using *PPP* over ATM (PPPoA) <#PPPOA> 25.7 Using SLIP <#SLIP> 26 Electronic Mail <#MAIL> 26.1 Synopsis <#MAIL-SYNOPSIS> 26.2 Using Electronic Mail <#MAIL-USING> 26.3 *sendmail* Configuration <#SENDMAIL> 26.4 Changing Your Mail Transfer Agent <#MAIL-CHANGINGMTA> 26.5 Troubleshooting <#MAIL-TROUBLE> 26.6 Advanced Topics <#MAIL-ADVANCED> 26.7 SMTP with UUCP <#SMTP-UUCP> 26.8 Setting Up to Send Only <#OUTGOING-ONLY> 26.9 Using Mail with a Dialup Connection <#SMTP-DIALUP> 26.10 SMTP Authentication <#SMTP-AUTH> 26.11 Mail User Agents <#MAIL-AGENTS> 26.12 Using fetchmail <#MAIL-FETCHMAIL> 26.13 Using procmail <#MAIL-PROCMAIL> 27 Network Servers <#NETWORK-SERVERS> 27.1 Synopsis <#NETWORK-SERVERS-SYNOPSIS> 27.2 The *inetd* ?Super-Server? <#NETWORK-INETD> 27.3 Network File System (NFS) <#NETWORK-NFS> 27.4 Network Information System (NIS/YP) <#NETWORK-NIS> 27.5 Automatic Network Configuration (DHCP) <#NETWORK-DHCP> 27.6 Domain Name System (DNS) <#NETWORK-DNS> 27.7 Apache HTTP Server <#NETWORK-APACHE> 27.8 File Transfer Protocol (FTP) <#NETWORK-FTP> 27.9 File and Print Services for Microsoft Windows clients (Samba) <#NETWORK-SAMBA> 27.10 Clock Synchronization with NTP <#NETWORK-NTP> 28 Firewalls <#FIREWALLS> 28.1 Introduction <#FIREWALLS-INTRO> 28.2 Firewall Concepts <#FIREWALLS-CONCEPTS> 28.3 Firewall Packages <#FIREWALLS-APPS> 28.4 The OpenBSD Packet Filter (PF) and ALTQ <#FIREWALLS-PF> 28.5 The IPFILTER (IPF) Firewall <#FIREWALLS-IPF> 28.6 IPFW <#FIREWALLS-IPFW> 29 Advanced Networking <#ADVANCED-NETWORKING> 29.1 Synopsis <#ADVANCED-NETWORKING-SYNOPSIS> 29.2 Gateways and Routes <#NETWORK-ROUTING> 29.3 Wireless Networking <#NETWORK-WIRELESS> 29.4 Bluetooth <#NETWORK-BLUETOOTH> 29.5 Bridging <#NETWORK-BRIDGING> 29.6 Link Aggregation and Failover <#NETWORK-AGGREGATION> 29.7 Diskless Operation <#NETWORK-DISKLESS> 29.8 ISDN <#NETWORK-ISDN> 29.9 Network Address Translation <#NETWORK-NATD> 29.10 Parallel Line IP (PLIP) <#NETWORK-PLIP> 29.11 IPv6 <#NETWORK-IPV6> 29.12 Asynchronous Transfer Mode (ATM) <#NETWORK-ATM> 29.13 Common Access Redundancy Protocol (CARP) <#CARP> V. Appendices <#APPENDICES> A. Obtaining FreeBSD <#MIRRORS> A.1 CDROM and DVD Publishers <#MIRRORS-CDROM> A.2 FTP Sites <#MIRRORS-FTP> A.3 Anonymous CVS <#ANONCVS> A.4 Using CTM <#CTM> A.5 Using CVSup <#CVSUP> A.6 Using Portsnap <#PORTSNAP> A.7 CVS Tags <#CVS-TAGS> A.8 AFS Sites <#MIRRORS-AFS> A.9 rsync Sites <#MIRRORS-RSYNC> B. Bibliography <#BIBLIOGRAPHY> B.1 Books & Magazines Specific to FreeBSD <#BIBLIOGRAPHY-FREEBSD> B.2 Users' Guides <#BIBLIOGRAPHY-USERGUIDES> B.3 Administrators' Guides <#BIBLIOGRAPHY-ADMINGUIDES> B.4 Programmers' Guides <#BIBLIOGRAPHY-PROGRAMMERS> B.5 Operating System Internals <#BIBLIOGRAPHY-OSINTERNALS> B.6 Security Reference <#BIBLIOGRAPHY-SECURITY> B.7 Hardware Reference <#BIBLIOGRAPHY-HARDWARE> B.8 UNIX History <#BIBLIOGRAPHY-HISTORY> B.9 Magazines and Journals <#BIBLIOGRAPHY-JOURNALS> C. Resources on the Internet <#ERESOURCES> C.1 Mailing Lists <#ERESOURCES-MAIL> C.2 Usenet Newsgroups <#ERESOURCES-NEWS> C.3 World Wide Web Servers <#ERESOURCES-WEB> C.4 Email Addresses <#ERESOURCES-EMAIL> C.5 Shell Accounts <#ERESOURCES-SHELL> D. PGP Keys <#PGPKEYS> D.1 Officers <#PGPKEYS-OFFICERS> D.2 Core Team Members <#PGPKEYS-CORE> D.3 Developers <#PGPKEYS-DEVELOPERS> FreeBSD Glossary <#FREEBSD-GLOSSARY> Index <#DOC-INDEX> Colophon <#COLOPHON> *List of Tables* 2-1. Sample Device Inventory <#AEN1140> 2-2. Partition Layout for First Disk <#AEN1878> 2-3. Partition Layout for Subsequent Disks <#AEN1929> 2-4. FreeBSD 6./X/ and 7./X/ ISO Image Names and Meanings <#AEN3246> 3-1. Disk Device Codes <#BASICS-DEV-CODES> 18-1. Physical Disk Naming Conventions <#DISK-NAMING-PHYSICAL-TABLE> 20-1. Vinum Plex Organizations <#VINUM-COMPARISON> 24-1. DB-25 to DB-25 Null-Modem Cable <#AEN30000> 24-2. DB-9 to DB-9 Null-Modem Cable <#AEN30066> 24-3. DB-9 to DB-25 Null-Modem Cable <#AEN30131> 24-4. Signal Names <#SERIALCOMMS-SIGNAL-NAMES> 29-1. Wiring a Parallel Cable for Networking <#AEN41306> 29-2. Reserved IPv6 addresses <#AEN41502> *List of Figures* 2-1. FreeBSD Boot Loader Menu <#BOOT-LOADER-MENU> 2-2. Typical Device Probe Results <#INSTALL-DEV-PROBE> 2-3. Selecting Country Menu <#CONFIG-COUNTRY> 2-4. Select Sysinstall Exit <#SYSINSTALL-EXIT> 2-5. Selecting Usage from Sysinstall Main Menu <#SYSINSTALL-MAIN3> 2-6. Selecting Documentation Menu <#MAIN-DOC> 2-7. Sysinstall Documentation Menu <#DOCMENU1> 2-8. Sysinstall Main Menu <#SYSINSTALL-KEYMAP> 2-9. Sysinstall Keymap Menu <#SYSINSTALL-KEYMAP-MENU> 2-10. Sysinstall Main Menu <#SYSINSTALL-OPTIONS> 2-11. Sysinstall Options <#OPTIONS> 2-12. Begin Standard Installation <#SYSINSTALL-STANDARD> 2-13. Select Drive for FDisk <#SYSINSTALL-FDISK-DRIVE1> 2-14. Typical Fdisk Partitions before Editing <#SYSINSTALL-FDISK1> 2-15. Fdisk Partition Using Entire Disk <#SYSINSTALL-FDISK2> 2-16. Sysinstall Boot Manager Menu <#SYSINSTALL-BOOTMGR> 2-17. Exit Select Drive <#SYSINSTALL-FDISK-DRIVE2> 2-18. Sysinstall Disklabel Editor <#SYSINSTALL-LABEL> 2-19. Sysinstall Disklabel Editor with Auto Defaults <#SYSINSTALL-LABEL2> 2-20. Free Space for Root Partition <#SYSINSTALL-LABEL-ADD> 2-21. Edit Root Partition Size <#SYSINSTALL-LABEL-ADD2> 2-22. Choose the Root Partition Type <#SYSINSTALL-LABEL-TYPE> 2-23. Choose the Root Mount Point <#SYSINSTALL-LABEL-MOUNT> 2-24. Sysinstall Disklabel Editor <#SYSINSTALL-LABEL4> 2-25. Choose Distributions <#DISTRIBUTION-SET1> 2-26. Confirm Distributions <#DISTRIBUTION-SET2> 2-27. Choose Installation Media <#CHOOSE-MEDIA> 2-28. Selecting an Ethernet Device <#ED-CONFIG1> 2-29. Set Network Configuration for ed0 <#ED-CONFIG2> 2-30. Editing inetd.conf <#INETD-EDIT> 2-31. Default Anonymous FTP Configuration <#ANON-FTP2> 2-32. Edit the FTP Welcome Message <#ANON-FTP4> 2-33. Editing exports <#NFS-SERVER-EDIT> 2-34. System Console Configuration Options <#SAVER-OPTIONS> 2-35. Screen Saver Options <#SAVER-SELECT> 2-36. Screen Saver Timeout <#SAVER-TIMEOUT> 2-37. System Console Configuration Exit <#SAVER-EXIT> 2-38. Select Your Region <#SET-TIMEZONE-REGION> 2-39. Select Your Country <#SET-TIMEZONE-COUNTRY> 2-40. Select Your Time Zone <#SET-TIMEZONE-LOCALITY> 2-41. Select Mouse Protocol Type <#MOUSE-PROTOCOL> 2-42. Set Mouse Protocol <#SET-MOUSE-PROTOCOL> 2-43. Configure Mouse Port <#CONFIG-MOUSE-PORT> 2-44. Setting the Mouse Port <#SET-MOUSE-PORT> 2-45. Enable the Mouse Daemon <#TEST-DAEMON> 2-46. Test the Mouse Daemon <#TEST-MOUSE-DAEMON> 2-47. Select Package Category <#PACKAGE-CATEGORY> 2-48. Select Packages <#PACKAGE-SELECT> 2-49. Install Packages <#PACKAGE-INSTALL> 2-50. Confirm Package Installation <#PACKAGE-INSTALL-CONFIRM> 2-51. Select User <#ADD-USER2> 2-52. Add User Information <#ADD-USER3> 2-53. Exit User and Group Management <#ADD-USER4> 2-54. Exit Install <#FINAL-MAIN> 2-55. Network Configuration Upper-level <#NETWORK-CONFIGURATION> 2-56. Select a default MTA <#MTA-SELECTION> 2-57. Ntpdate Configuration <#NTPDATE-CONFIG> 2-58. Network Configuration Lower-level <#NETWORK-CONFIGURATION-CONT> 20-1. Concatenated Organization <#VINUM-CONCAT> 20-2. Striped Organization <#VINUM-STRIPED> 20-3. RAID-5 Organization <#VINUM-RAID5-ORG> 20-4. A Simple Vinum Volume <#VINUM-SIMPLE-VOL> 20-5. A Mirrored Vinum Volume <#VINUM-MIRRORED-VOL> 20-6. A Striped Vinum Volume <#VINUM-STRIPED-VOL> 20-7. A Mirrored, Striped Vinum Volume <#VINUM-RAID10-VOL> *List of Examples* 2-1. Using an Existing Partition Unchanged <#AEN1243> 2-2. Shrinking an Existing Partition <#AEN1254> 3-1. Sample Disk, Slice, and Partition Names <#BASICS-DISK-SLICE-PART> 3-2. Conceptual Model of a Disk <#BASICS-CONCEPT-DISK-MODEL> 4-1. Downloading a Package Manually and Installing It Locally <#AEN5422> 11-1. Creating a Swapfile on FreeBSD <#AEN16697> 12-1. boot0 Screenshot <#BOOT-BOOT0-EXAMPLE> 12-2. boot2 Screenshot <#BOOT-BOOT2-EXAMPLE> 12-3. An Insecure Console in /etc/ttys <#BOOT-INSECURE-CONSOLE> 13-1. Adding a user on FreeBSD <#AEN18019> 13-2. rmuser Interactive Account Removal <#AEN18085> 13-3. Interactive chpass by Superuser <#AEN18114> 13-4. Interactive chpass by Normal User <#AEN18119> 13-5. Changing Your Password <#AEN18160> 13-6. Changing Another User's Password as the Superuser <#AEN18165> 13-7. Adding a Group Using pw(8) <#AEN18417> 13-8. Setting the List of Members of a Group Using pw(8) <#AEN18433> 13-9. Adding a New Member to a Group Using pw(8) <#AEN18457> 13-10. Using id(1) to Determine Group Membership <#AEN18469> 14-1. Using SSH to Create a Secure Tunnel for SMTP <#AEN21041> 18-1. Using dump over *ssh* <#AEN25419> 18-2. Using dump over *ssh* with RSH set <#AEN25429> 18-3. A Script for Creating a Bootable Floppy <#AEN25626> 18-4. Using mdconfig to Mount an Existing File System Image <#AEN25723> 18-5. Creating a New File-Backed Disk with mdconfig <#AEN25739> 18-6. Configure and Mount a File-Backed Disk with mdmfs <#AEN25795> 18-7. Creating a New Memory-Based Disk with mdconfig <#AEN25833> 18-8. Creating a New Memory-Based Disk with mdmfs <#AEN25851> 24-1. Adding Terminal Entries to /etc/ttys <#EX-ETC-TTYS> 26-1. Configuring the *sendmail* Access Database <#AEN33708> 26-2. Mail Aliases <#AEN33726> 26-3. Example Virtual Domain Mail Map <#AEN33782> 27-1. Reloading the *inetd* configuration file <#NETWORK-INETD-REREAD> 27-2. Mounting an Export with *amd* <#AEN35310> 27-3. Installing Django with Apache2, mod_python3, and PostgreSQL <#NETWORK-WWW-DJANGO-INSTALL> 27-4. Apache Configuration for Django/mod_python <#NETWORK-WWW-DJANGO-APACHE-CONFIG> 29-1. LACP aggregation with a Cisco switch <#NETWORKING-LACP-AGGREGATION-CISCO> 29-2. Failover mode <#NETWORKING-LAGG-FAILOVER> 29-3. Branch Office or Home Network <#AEN41063> 29-4. Head Office or Other LAN <#AEN41077> A-1. Checking Out Something from -CURRENT (ls(1)): <#AEN43179> A-2. Using SSH to check out the src/ tree: <#AEN43193> A-3. Checking Out the Version of ls(1) in the 6-STABLE Branch: <#AEN43200> A-4. Creating a List of Changes (as Unified Diffs) to ls(1) <#AEN43214> A-5. Finding Out What Other Module Names Can Be Used: <#AEN43228> ------------------------------------------------------------------------ Preface Intended Audience The FreeBSD newcomer will find that the first section of this book guides the user through the FreeBSD installation process and gently introduces the concepts and conventions that underpin UNIX®. Working through this section requires little more than the desire to explore, and the ability to take on board new concepts as they are introduced. Once you have traveled this far, the second, far larger, section of the Handbook is a comprehensive reference to all manner of topics of interest to FreeBSD system administrators. Some of these chapters may recommend that you do some prior reading, and this is noted in the synopsis at the beginning of each chapter. For a list of additional sources of information, please see Appendix B <#BIBLIOGRAPHY>. Changes from the Second Edition This third edition is the culmination of over two years of work by the dedicated members of the FreeBSD Documentation Project. The following are the major changes in this new edition: * Chapter 11 <#CONFIG-TUNING>, Configuration and Tuning, has been expanded with new information about the ACPI power and resource management, the cron system utility, and more kernel tuning options. * Chapter 14 <#SECURITY>, Security, has been expanded with new information about virtual private networks (VPNs), file system access control lists (ACLs), and security advisories. * Chapter 16 <#MAC>, Mandatory Access Control (MAC), is a new chapter with this edition. It explains what MAC is and how this mechanism can be used to secure a FreeBSD system. * Chapter 18 <#DISKS>, Storage, has been expanded with new information about USB storage devices, file system snapshots, file system quotas, file and network backed filesystems, and encrypted disk partitions. * Chapter 20 <#VINUM-VINUM>, Vinum, is a new chapter with this edition. It describes how to use Vinum, a logical volume manager which provides device-independent logical disks, and software RAID-0, RAID-1 and RAID-5. * A troubleshooting section has been added to Chapter 25 <#PPP-AND-SLIP>, PPP and SLIP. * Chapter 26 <#MAIL>, Electronic Mail, has been expanded with new information about using alternative transport agents, SMTP authentication, UUCP, *fetchmail*, *procmail*, and other advanced topics. * Chapter 27 <#NETWORK-SERVERS>, Network Servers, is all new with this edition. This chapter includes information about setting up the *Apache HTTP Server*, *ftpd*, and setting up a server for Microsoft® Windows® clients with *Samba*. Some sections from Chapter 29 <#ADVANCED-NETWORKING>, Advanced Networking, were moved here to improve the presentation. * Chapter 29 <#ADVANCED-NETWORKING>, Advanced Networking, has been expanded with new information about using Bluetooth® devices with FreeBSD, setting up wireless networks, and Asynchronous Transfer Mode (ATM) networking. * A glossary has been added to provide a central location for the definitions of technical terms used throughout the book. * A number of aesthetic improvements have been made to the tables and figures throughout the book. Changes from the First Edition The second edition was the culmination of over two years of work by the dedicated members of the FreeBSD Documentation Project. The following were the major changes in this edition: * A complete Index has been added. * All ASCII figures have been replaced by graphical diagrams. * A standard synopsis has been added to each chapter to give a quick summary of what information the chapter contains, and what the reader is expected to know. * The content has been logically reorganized into three parts: ?Getting Started?, ?System Administration?, and ?Appendices?. * Chapter 2 <#INSTALL> (?Installing FreeBSD?) was completely rewritten with many screenshots to make it much easier for new users to grasp the text. * Chapter 3 <#BASICS> (?UNIX Basics?) has been expanded to contain additional information about processes, daemons, and signals. * Chapter 4 <#PORTS> (?Installing Applications?) has been expanded to contain additional information about binary package management. * Chapter 5 <#X11> (?The X Window System?) has been completely rewritten with an emphasis on using modern desktop technologies such as *KDE* and *GNOME* on XFree86? 4.X. * Chapter 12 <#BOOT> (?The FreeBSD Booting Process?) has been expanded. * Chapter 18 <#DISKS> (?Storage?) has been written from what used to be two separate chapters on ?Disks? and ?Backups?. We feel that the topics are easier to comprehend when presented as a single chapter. A section on RAID (both hardware and software) has also been added. * Chapter 24 <#SERIALCOMMS> (?Serial Communications?) has been completely reorganized and updated for FreeBSD 4.X/5.X. * Chapter 25 <#PPP-AND-SLIP> (?PPP and SLIP?) has been substantially updated. * Many new sections have been added to Chapter 29 <#ADVANCED-NETWORKING> (?Advanced Networking?). * Chapter 26 <#MAIL> (?Electronic Mail?) has been expanded to include more information about configuring *sendmail*. * Chapter 10 <#LINUXEMU> (?Linux® Compatibility?) has been expanded to include information about installing *Oracle®* and *SAP® R/3®*. * The following new topics are covered in this second edition: o Configuration and Tuning (Chapter 11 <#CONFIG-TUNING>). o Multimedia (Chapter 7 <#MULTIMEDIA>) Organization of This Book This book is split into five logically distinct sections. The first section, /Getting Started/, covers the installation and basic usage of FreeBSD. It is expected that the reader will follow these chapters in sequence, possibly skipping chapters covering familiar topics. The second section, /Common Tasks/, covers some frequently used features of FreeBSD. This section, and all subsequent sections, can be read out of order. Each chapter begins with a succinct synopsis that describes what the chapter covers and what the reader is expected to already know. This is meant to allow the casual reader to skip around to find chapters of interest. The third section, /System Administration/, covers administration topics. The fourth section, /Network Communication/, covers networking and server topics. The fifth section contains appendices of reference information. /Chapter 1 <#INTRODUCTION>, Introduction/ Introduces FreeBSD to a new user. It describes the history of the FreeBSD Project, its goals and development model. /Chapter 2 <#INSTALL>, Installation/ Walks a user through the entire installation process. Some advanced installation topics, such as installing through a serial console, are also covered. /Chapter 3 <#BASICS>, UNIX Basics/ Covers the basic commands and functionality of the FreeBSD operating system. If you are familiar with Linux or another flavor of UNIX then you can probably skip this chapter. /Chapter 4 <#PORTS>, Installing Applications/ Covers the installation of third-party software with both FreeBSD's innovative ?Ports Collection? and standard binary packages. /Chapter 5 <#X11>, The X Window System/ Describes the X Window System in general and using X11 on FreeBSD in particular. Also describes common desktop environments such as *KDE* and *GNOME*. /Chapter 6 <#DESKTOP>, Desktop Applications/ Lists some common desktop applications, such as web browsers and productivity suites, and describes how to install them on FreeBSD. /Chapter 7 <#MULTIMEDIA>, Multimedia/ Shows how to set up sound and video playback support for your system. Also describes some sample audio and video applications. /Chapter 8 <#KERNELCONFIG>, Configuring the FreeBSD Kernel/ Explains why you might need to configure a new kernel and provides detailed instructions for configuring, building, and installing a custom kernel. /Chapter 9 <#PRINTING>, Printing/ Describes managing printers on FreeBSD, including information about banner pages, printer accounting, and initial setup. /Chapter 10 <#LINUXEMU>, Linux Binary Compatibility/ Describes the Linux compatibility features of FreeBSD. Also provides detailed installation instructions for many popular Linux applications such as *Oracle*, *SAP R/3*, and *Mathematica®*. /Chapter 11 <#CONFIG-TUNING>, Configuration and Tuning/ Describes the parameters available for system administrators to tune a FreeBSD system for optimum performance. Also describes the various configuration files used in FreeBSD and where to find them. /Chapter 12 <#BOOT>, Booting Process/ Describes the FreeBSD boot process and explains how to control this process with configuration options. /Chapter 13 <#USERS>, Users and Basic Account Management/ Describes the creation and manipulation of user accounts. Also discusses resource limitations that can be set on users and other account management tasks. /Chapter 14 <#SECURITY>, Security/ Describes many different tools available to help keep your FreeBSD system secure, including Kerberos, IPsec and OpenSSH. /Chapter 15 <#JAILS>, Jails/ Describes the jails framework, and the improvements of jails over the traditional chroot support of FreeBSD. /Chapter 16 <#MAC>, Mandatory Access Control/ Explains what Mandatory Access Control (MAC) is and how this mechanism can be used to secure a FreeBSD system. /Chapter 17 <#AUDIT>, Security Event Auditing/ Describes what FreeBSD Event Auditing is, how it can be installed, configured, and how audit trails can be inspected or monitored. /Chapter 18 <#DISKS>, Storage/ Describes how to manage storage media and filesystems with FreeBSD. This includes physical disks, RAID arrays, optical and tape media, memory-backed disks, and network filesystems. /Chapter 19 <#GEOM>, GEOM/ Describes what the GEOM framework in FreeBSD is and how to configure various supported RAID levels. /Chapter 20 <#VINUM-VINUM>, Vinum/ Describes how to use Vinum, a logical volume manager which provides device-independent logical disks, and software RAID-0, RAID-1 and RAID-5. /Chapter 21 <#VIRTUALIZATION>, Virtualization/ Describes what virtualization systems offer, and how they can be used with FreeBSD. /Chapter 22 <#L10N>, Localization/ Describes how to use FreeBSD in languages other than English. Covers both system and application level localization. /Chapter 23 <#CUTTING-EDGE>, The Cutting Edge/ Explains the differences between FreeBSD-STABLE, FreeBSD-CURRENT, and FreeBSD releases. Describes which users would benefit from tracking a development system and outlines that process. /Chapter 24 <#SERIALCOMMS>, Serial Communications/ Explains how to connect terminals and modems to your FreeBSD system for both dial in and dial out connections. /Chapter 25 <#PPP-AND-SLIP>, PPP and SLIP/ Describes how to use PPP, SLIP, or PPP over Ethernet to connect to remote systems with FreeBSD. /Chapter 26 <#MAIL>, Electronic Mail/ Explains the different components of an email server and dives into simple configuration topics for the most popular mail server software: *sendmail*. /Chapter 27 <#NETWORK-SERVERS>, Network Servers/ Provides detailed instructions and example configuration files to set up your FreeBSD machine as a network filesystem server, domain name server, network information system server, or time synchronization server. /Chapter 28 <#FIREWALLS>, Firewalls/ Explains the philosophy behind software-based firewalls and provides detailed information about the configuration of the different firewalls available for FreeBSD. /Chapter 29 <#ADVANCED-NETWORKING>, Advanced Networking/ Describes many networking topics, including sharing an Internet connection with other computers on your LAN, advanced routing topics, wireless networking, Bluetooth, ATM, IPv6, and much more. /Appendix A <#MIRRORS>, Obtaining FreeBSD/ Lists different sources for obtaining FreeBSD media on CDROM or DVD as well as different sites on the Internet that allow you to download and install FreeBSD. /Appendix B <#BIBLIOGRAPHY>, Bibliography/ This book touches on many different subjects that may leave you hungry for a more detailed explanation. The bibliography lists many excellent books that are referenced in the text. /Appendix C <#ERESOURCES>, Resources on the Internet/ Describes the many forums available for FreeBSD users to post questions and engage in technical conversations about FreeBSD. /Appendix D <#PGPKEYS>, PGP Keys/ Lists the PGP fingerprints of several FreeBSD Developers. Conventions used in this book To provide a consistent and easy to read text, several conventions are followed throughout the book. Typographic Conventions /Italic/ An /italic/ font is used for filenames, URLs, emphasized text, and the first usage of technical terms. Monospace A monospaced font is used for error messages, commands, environment variables, names of ports, hostnames, user names, group names, device names, variables, and code fragments. *Bold* A *bold* font is used for applications, commands, and keys. User Input Keys are shown in *bold* to stand out from other text. Key combinations that are meant to be typed simultaneously are shown with `+' between the keys, such as: *Ctrl*+*Alt*+*Del* Meaning the user should type the *Ctrl*, *Alt*, and *Del* keys at the same time. Keys that are meant to be typed in sequence will be separated with commas, for example: *Ctrl*+*X*, *Ctrl*+*S* Would mean that the user is expected to type the *Ctrl* and *X* keys simultaneously and then to type the *Ctrl* and *S* keys simultaneously. Examples Examples starting with E:\> indicate a MS-DOS® command. Unless otherwise noted, these commands may be executed from a ?Command Prompt? window in a modern Microsoft Windows environment. E:\> tools\fdimage floppies\kern.flp A: Examples starting with # indicate a command that must be invoked as the superuser in FreeBSD. You can login as root to type the command, or login as your normal account and use su(1) to gain superuser privileges. # dd if=kern.flp of=/dev/fd0 Examples starting with % indicate a command that should be invoked from a normal user account. Unless otherwise noted, C-shell syntax is used for setting environment variables and other shell commands. % top Acknowledgments The book you are holding represents the efforts of many hundreds of people around the world. Whether they sent in fixes for typos, or submitted complete chapters, all the contributions have been useful. Several companies have supported the development of this document by paying authors to work on it full-time, paying for publication, etc. In particular, BSDi (subsequently acquired by Wind River Systems ) paid members of the FreeBSD Documentation Project to work on improving this book full time leading up to the publication of the first printed edition in March 2000 (ISBN 1-57176-241-8). Wind River Systems then paid several additional authors to make a number of improvements to the print-output infrastructure and to add additional chapters to the text. This work culminated in the publication of the second printed edition in November 2001 (ISBN 1-57176-303-1). In 2003-2004, FreeBSD Mall, Inc , paid several contributors to improve the Handbook in preparation for the third printed edition. I. Getting Started This part of the FreeBSD Handbook is for users and administrators who are new to FreeBSD. These chapters: * Introduce you to FreeBSD. * Guide you through the installation process. * Teach you UNIX basics and fundamentals. * Show you how to install the wealth of third party applications available for FreeBSD. * Introduce you to X, the UNIX windowing system, and detail how to configure a desktop environment that makes you more productive. We have tried to keep the number of forward references in the text to a minimum so that you can read this section of the Handbook from front to back with the minimum page flipping required. *Table of Contents* 1 Introduction <#INTRODUCTION> 2 Installing FreeBSD <#INSTALL> 3 UNIX Basics <#BASICS> 4 Installing Applications: Packages and Ports <#PORTS> 5 The X Window System <#X11> ------------------------------------------------------------------------ Chapter 1 Introduction /Restructured, reorganized, and parts rewritten by Jim Mock./ 1.1 Synopsis Thank you for your interest in FreeBSD! The following chapter covers various aspects of the FreeBSD Project, such as its history, goals, development model, and so on. After reading this chapter, you will know: * How FreeBSD relates to other computer operating systems. * The history of the FreeBSD Project. * The goals of the FreeBSD Project. * The basics of the FreeBSD open-source development model. * And of course: where the name ?FreeBSD? comes from. ------------------------------------------------------------------------ 1.2 Welcome to FreeBSD! FreeBSD is a 4.4BSD-Lite based operating system for Intel (x86 and Itanium®), AMD64, Alpha?, Sun UltraSPARC® computers. Ports to other architectures are also underway. You can also read about the history of FreeBSD <#HISTORY>, or the current release <#RELNOTES>. If you are interested in contributing something to the Project (code, hardware, funding), see the Contributing to FreeBSD <../../../../doc/en_US.ISO8859-1/articles/contributing/index.html> article. ------------------------------------------------------------------------ 1.2.1 What Can FreeBSD Do? FreeBSD has many noteworthy features. Some of these are: * /Preemptive multitasking/ with dynamic priority adjustment to ensure smooth and fair sharing of the computer between applications and users, even under the heaviest of loads. * /Multi-user facilities/ which allow many people to use a FreeBSD system simultaneously for a variety of things. This means, for example, that system peripherals such as printers and tape drives are properly shared between all users on the system or the network and that individual resource limits can be placed on users or groups of users, protecting critical system resources from over-use. * Strong /TCP/IP networking/ with support for industry standards such as SCTP, DHCP, NFS, NIS, PPP, SLIP, IPsec, and IPv6. This means that your FreeBSD machine can interoperate easily with other systems as well as act as an enterprise server, providing vital functions such as NFS (remote file access) and email services or putting your organization on the Internet with WWW, FTP, routing and firewall (security) services. * /Memory protection/ ensures that applications (or users) cannot interfere with each other. One application crashing will not affect others in any way. * FreeBSD is a /32-bit/ operating system (/64-bit/ on the Alpha, Itanium, AMD64, and UltraSPARC) and was designed as such from the ground up. * The industry standard /X Window System/ (X11R7) provides a graphical user interface (GUI) for the cost of a common VGA card and monitor and comes with full sources. * /Binary compatibility/ with many programs built for Linux, SCO, SVR4, BSDI and NetBSD. * Thousands of /ready-to-run/ applications are available from the FreeBSD /ports/ and /packages/ collection. Why search the net when you can find it all right here? * Thousands of additional and /easy-to-port/ applications are available on the Internet. FreeBSD is source code compatible with most popular commercial UNIX systems and thus most applications require few, if any, changes to compile. * Demand paged /virtual memory/ and ?merged VM/buffer cache? design efficiently satisfies applications with large appetites for memory while still maintaining interactive response to other users. * /SMP/ support for machines with multiple CPUs. * A full complement of /C/, /C++/, and /Fortran/ development tools. Many additional languages for advanced research and development are also available in the ports and packages collection. * /Source code/ for the entire system means you have the greatest degree of control over your environment. Why be locked into a proprietary solution at the mercy of your vendor when you can have a truly open system? * Extensive /online documentation/. * /And many more!/ FreeBSD is based on the 4.4BSD-Lite release from Computer Systems Research Group (CSRG) at the University of California at Berkeley, and carries on the distinguished tradition of BSD systems development. In addition to the fine work provided by CSRG, the FreeBSD Project has put in many thousands of hours in fine tuning the system for maximum performance and reliability in real-life load situations. As many of the commercial giants struggle to field PC operating systems with such features, performance and reliability, FreeBSD can offer them /now/! The applications to which FreeBSD can be put are truly limited only by your own imagination. From software development to factory automation, inventory control to azimuth correction of remote satellite antennae; if it can be done with a commercial UNIX product then it is more than likely that you can do it with FreeBSD too! FreeBSD also benefits significantly from literally thousands of high quality applications developed by research centers and universities around the world, often available at little to no cost. Commercial applications are also available and appearing in greater numbers every day. Because the source code for FreeBSD itself is generally available, the system can also be customized to an almost unheard of degree for special applications or projects, and in ways not generally possible with operating systems from most major commercial vendors. Here is just a sampling of some of the applications in which people are currently using FreeBSD: * /Internet Services:/ The robust TCP/IP networking built into FreeBSD makes it an ideal platform for a variety of Internet services such as: o FTP servers o World Wide Web servers (standard or secure [SSL]) o IPv4 and IPv6 routing o Firewalls and NAT (?IP masquerading?) gateways o Electronic Mail servers o USENET News or Bulletin Board Systems o And more... With FreeBSD, you can easily start out small with an inexpensive 386 class PC and upgrade all the way up to a quad-processor Xeon with RAID storage as your enterprise grows. * /Education:/ Are you a student of computer science or a related engineering field? There is no better way of learning about operating systems, computer architecture and networking than the hands on, under the hood experience that FreeBSD can provide. A number of freely available CAD, mathematical and graphic design packages also make it highly useful to those whose primary interest in a computer is to get /other/ work done! * /Research:/ With source code for the entire system available, FreeBSD is an excellent platform for research in operating systems as well as other branches of computer science. FreeBSD's freely available nature also makes it possible for remote groups to collaborate on ideas or shared development without having to worry about special licensing agreements or limitations on what may be discussed in open forums. * /Networking:/ Need a new router? A name server (DNS)? A firewall to keep people out of your internal network? FreeBSD can easily turn that unused 386 or 486 PC sitting in the corner into an advanced router with sophisticated packet-filtering capabilities. * /X Window workstation:/ FreeBSD is a fine choice for an inexpensive X terminal solution, using the freely available X11 server. Unlike an X terminal, FreeBSD allows many applications to be run locally if desired, thus relieving the burden on a central server. FreeBSD can even boot ?diskless?, making individual workstations even cheaper and easier to administer. * /Software Development:/ The basic FreeBSD system comes with a full complement of development tools including the renowned GNU C/C++ compiler and debugger. FreeBSD is available in both source and binary form on CDROM, DVD, and via anonymous FTP. Please see Appendix A <#MIRRORS> for more information about obtaining FreeBSD. ------------------------------------------------------------------------ 1.2.2 Who Uses FreeBSD? FreeBSD is used to power some of the biggest sites on the Internet, including: * Yahoo! * Apache * Blue Mountain Arts * Pair Networks * Sony Japan * Netcraft * Weathernews * Supervalu * TELEHOUSE America * Sophos Anti-Virus * JMA Wired and many more. ------------------------------------------------------------------------ 1.3 About the FreeBSD Project The following section provides some background information on the project, including a brief history, project goals, and the development model of the project. ------------------------------------------------------------------------ 1.3.1 A Brief History of FreeBSD /Contributed by Jordan Hubbard./ The FreeBSD project had its genesis in the early part of 1993, partially as an outgrowth of the ?Unofficial 386BSD Patchkit? by the patchkit's last 3 coordinators: Nate Williams, Rod Grimes and myself. Our original goal was to produce an intermediate snapshot of 386BSD in order to fix a number of problems with it that the patchkit mechanism just was not capable of solving. Some of you may remember the early working title for the project being ?386BSD 0.5? or ?386BSD Interim? in reference to that fact. 386BSD was Bill Jolitz's operating system, which had been up to that point suffering rather severely from almost a year's worth of neglect. As the patchkit swelled ever more uncomfortably with each passing day, we were in unanimous agreement that something had to be done and decided to assist Bill by providing this interim ?cleanup? snapshot. Those plans came to a rude halt when Bill Jolitz suddenly decided to withdraw his sanction from the project without any clear indication of what would be done instead. It did not take us long to decide that the goal remained worthwhile, even without Bill's support, and so we adopted the name ?FreeBSD?, coined by David Greenman. Our initial objectives were set after consulting with the system's current users and, once it became clear that the project was on the road to perhaps even becoming a reality, I contacted Walnut Creek CDROM with an eye toward improving FreeBSD's distribution channels for those many unfortunates without easy access to the Internet. Walnut Creek CDROM not only supported the idea of distributing FreeBSD on CD but also went so far as to provide the project with a machine to work on and a fast Internet connection. Without Walnut Creek CDROM's almost unprecedented degree of faith in what was, at the time, a completely unknown project, it is quite unlikely that FreeBSD would have gotten as far, as fast, as it has today. The first CDROM (and general net-wide) distribution was FreeBSD 1.0, released in December of 1993. This was based on the 4.3BSD-Lite (?Net/2?) tape from U.C. Berkeley, with many components also provided by 386BSD and the Free Software Foundation. It was a fairly reasonable success for a first offering, and we followed it with the highly successful FreeBSD 1.1 release in May of 1994. Around this time, some rather unexpected storm clouds formed on the horizon as Novell and U.C. Berkeley settled their long-running lawsuit over the legal status of the Berkeley Net/2 tape. A condition of that settlement was U.C. Berkeley's concession that large parts of Net/2 were ?encumbered? code and the property of Novell, who had in turn acquired it from AT&T some time previously. What Berkeley got in return was Novell's ?blessing? that the 4.4BSD-Lite release, when it was finally released, would be declared unencumbered and all existing Net/2 users would be strongly encouraged to switch. This included FreeBSD, and the project was given until the end of July 1994 to stop shipping its own Net/2 based product. Under the terms of that agreement, the project was allowed one last release before the deadline, that release being FreeBSD 1.1.5.1. FreeBSD then set about the arduous task of literally re-inventing itself from a completely new and rather incomplete set of 4.4BSD-Lite bits. The ?Lite? releases were light in part because Berkeley's CSRG had removed large chunks of code required for actually constructing a bootable running system (due to various legal requirements) and the fact that the Intel port of 4.4 was highly incomplete. It took the project until November of 1994 to make this transition, at which point it released FreeBSD 2.0 to the net and on CDROM (in late December). Despite being still more than a little rough around the edges, the release was a significant success and was followed by the more robust and easier to install FreeBSD 2.0.5 release in June of 1995. We released FreeBSD 2.1.5 in August of 1996, and it appeared to be popular enough among the ISP and commercial communities that another release along the 2.1-STABLE branch was merited. This was FreeBSD 2.1.7.1, released in February 1997 and capping the end of mainstream development on 2.1-STABLE. Now in maintenance mode, only security enhancements and other critical bug fixes will be done on this branch (RELENG_2_1_0). FreeBSD 2.2 was branched from the development mainline (?-CURRENT?) in November 1996 as the RELENG_2_2 branch, and the first full release (2.2.1) was released in April 1997. Further releases along the 2.2 branch were done in the summer and fall of '97, the last of which (2.2.8) appeared in November 1998. The first official 3.0 release appeared in October 1998 and spelled the beginning of the end for the 2.2 branch. The tree branched again on Jan 20, 1999, leading to the 4.0-CURRENT and 3.X-STABLE branches. From 3.X-STABLE, 3.1 was released on February 15, 1999, 3.2 on May 15, 1999, 3.3 on September 16, 1999, 3.4 on December 20, 1999, and 3.5 on June 24, 2000, which was followed a few days later by a minor point release update to 3.5.1, to incorporate some last-minute security fixes to Kerberos. This will be the final release in the 3.X branch. There was another branch on March 13, 2000, which saw the emergence of the 4.X-STABLE branch. There have been several releases from it so far: 4.0-RELEASE was introduced in March 2000, and the last 4.11-RELEASE came out in January 2005. The long-awaited 5.0-RELEASE was announced on January 19, 2003. The culmination of nearly three years of work, this release started FreeBSD on the path of advanced multiprocessor and application thread support and introduced support for the UltraSPARC and ia64 platforms. This release was followed by 5.1 in June of 2003. The last 5.X release from the -CURRENT branch was 5.2.1-RELEASE, introduced in February 2004. The RELENG_5 branch, created in August 2004, was followed by 5.3-RELEASE, which marked the beginning of the 5-STABLE branch releases. The most recent 6.3-RELEASE came out in Jan 2008. There will be no additional releases from the RELENG_5 branch. The tree was branched again in July 2005, this time for RELENG_6. 6.0-RELEASE, the first release of the 6.X branch, was released in November 2005. The most recent 7.0-RELEASE came out in Feb 2008. There will be additional releases from the RELENG_6 branch. For now, long-term development projects continue to take place in the 7.X-CURRENT (trunk) branch, and SNAPshot releases of 7.X on CDROM (and, of course, on the net) are continually made available from the snapshot server as work progresses. ------------------------------------------------------------------------ 1.3.2 FreeBSD Project Goals /Contributed by Jordan Hubbard./ The goals of the FreeBSD Project are to provide software that may be used for any purpose and without strings attached. Many of us have a significant investment in the code (and project) and would certainly not mind a little financial compensation now and then, but we are definitely not prepared to insist on it. We believe that our first and foremost ?mission? is to provide code to any and all comers, and for whatever purpose, so that the code gets the widest possible use and provides the widest possible benefit. This is, I believe, one of the most fundamental goals of Free Software and one that we enthusiastically support. That code in our source tree which falls under the GNU General Public License (GPL) or Library General Public License (LGPL) comes with slightly more strings attached, though at least on the side of enforced access rather than the usual opposite. Due to the additional complexities that can evolve in the commercial use of GPL software we do, however, prefer software submitted under the more relaxed BSD copyright when it is a reasonable option to do so. ------------------------------------------------------------------------ 1.3.3 The FreeBSD Development Model /Contributed by Satoshi Asami./ The development of FreeBSD is a very open and flexible process, being literally built from the contributions of hundreds of people around the world, as can be seen from our list of contributors <../../../../doc/en_US.ISO8859-1/articles/contributors/article.html>. FreeBSD's development infrastructure allow these hundreds of developers to collaborate over the Internet. We are constantly on the lookout for new developers and ideas, and those interested in becoming more closely involved with the project need simply contact us at the FreeBSD technical discussions mailing list . The FreeBSD announcements mailing list is also available to those wishing to make other FreeBSD users aware of major areas of work. Useful things to know about the FreeBSD project and its development process, whether working independently or in close cooperation: The CVS repository The central source tree for FreeBSD is maintained by CVS (Concurrent Versions System), a freely available source code control tool that comes bundled with FreeBSD. The primary CVS repository resides on a machine in Santa Clara CA, USA from where it is replicated to numerous mirror machines throughout the world. The CVS tree, which contains the -CURRENT <#CURRENT> and -STABLE <#STABLE> trees, can all be easily replicated to your own machine as well. Please refer to the Synchronizing your source tree <#SYNCHING> section for more information on doing this. The committers list The /committers/ are the people who have /write/ access to the CVS tree, and are authorized to make modifications to the FreeBSD source (the term ?committer? comes from the cvs(1) commit command, which is used to bring new changes into the CVS repository). The best way of making submissions for review by the committers list is to use the send-pr(1) command. If something appears to be jammed in the system, then you may also reach them by sending mail to the FreeBSD committer's mailing list. The FreeBSD core team The /FreeBSD core team/ would be equivalent to the board of directors if the FreeBSD Project were a company. The primary task of the core team is to make sure the project, as a whole, is in good shape and is heading in the right directions. Inviting dedicated and responsible developers to join our group of committers is one of the functions of the core team, as is the recruitment of new core team members as others move on. The current core team was elected from a pool of committer candidates in July 2006. Elections are held every 2 years. Some core team members also have specific areas of responsibility, meaning that they are committed to ensuring that some large portion of the system works as advertised. For a complete list of FreeBSD developers and their areas of responsibility, please see the Contributors List <../../../../doc/en_US.ISO8859-1/articles/contributors/article.html> *Note:* Most members of the core team are volunteers when it comes to FreeBSD development and do not benefit from the project financially, so ?commitment? should also not be misconstrued as meaning ?guaranteed support.? The ?board of directors? analogy above is not very accurate, and it may be more suitable to say that these are the people who gave up their lives in favor of FreeBSD against their better judgement! Outside contributors Last, but definitely not least, the largest group of developers are the users themselves who provide feedback and bug fixes to us on an almost constant basis. The primary way of keeping in touch with FreeBSD's more non-centralized development is to subscribe to the FreeBSD technical discussions mailing list where such things are discussed. See Appendix C <#ERESOURCES> for more information about the various FreeBSD mailing lists. /The FreeBSD Contributors List <../../../../doc/en_US.ISO8859-1/articles/contributors/article.html>/ is a long and growing one, so why not join it by contributing something back to FreeBSD today? Providing code is not the only way of contributing to the project; for a more complete list of things that need doing, please refer to the FreeBSD Project web site <../../../../index.html>. In summary, our development model is organized as a loose set of concentric circles. The centralized model is designed for the convenience of the /users/ of FreeBSD, who are provided with an easy way of tracking one central code base, not to keep potential contributors out! Our desire is to present a stable operating system with a large set of coherent application programs <#PORTS> that the users can easily install and use -- this model works very well in accomplishing that. All we ask of those who would join us as FreeBSD developers is some of the same dedication its current people have to its continued success! ------------------------------------------------------------------------ 1.3.4 The Current FreeBSD Release FreeBSD is a freely available, full source 4.4BSD-Lite based release for Intel i386?, i486?, Pentium®, Pentium Pro, Celeron®, Pentium II, Pentium III, Pentium 4 (or compatible), Xeon?, DEC Alpha and Sun UltraSPARC based computer systems. It is based primarily on software from U.C. Berkeley's CSRG group, with some enhancements from NetBSD, OpenBSD, 386BSD, and the Free Software Foundation. Since our release of FreeBSD 2.0 in late 1994, the performance, feature set, and stability of FreeBSD has improved dramatically. The largest change is a revamped virtual memory system with a merged VM/file buffer cache that not only increases performance, but also reduces FreeBSD's memory footprint, making a 5 MB configuration a more acceptable minimum. Other enhancements include full NIS client and server support, transaction TCP support, dial-on-demand PPP, integrated DHCP support, an improved SCSI subsystem, ISDN support, support for ATM, FDDI, Fast and Gigabit Ethernet (1000 Mbit) adapters, improved support for the latest Adaptec controllers, and many thousands of bug fixes. In addition to the base distributions, FreeBSD offers a ported software collection with thousands of commonly sought-after programs. At the time of this printing, there were over 18,000 ports! The list of ports ranges from http (WWW) servers, to games, languages, editors, and almost everything in between. The entire Ports Collection requires approximately 440 MB of storage, all ports being expressed as ?deltas? to their original sources. This makes it much easier for us to update ports, and greatly reduces the disk space demands made by the older 1.0 Ports Collection. To compile a port, you simply change to the directory of the program you wish to install, type make install, and let the system do the rest. The full original distribution for each port you build is retrieved dynamically off the CDROM or a local FTP site, so you need only enough disk space to build the ports you want. Almost every port is also provided as a pre-compiled ?package?, which can be installed with a simple command (pkg_add) by those who do not wish to compile their own ports from source. More information on packages and ports can be found in Chapter 4 <#PORTS>. A number of additional documents which you may find very helpful in the process of installing and using FreeBSD may now also be found in the /usr/share/doc directory on any recent FreeBSD machine. You may view the locally installed manuals with any HTML capable browser using the following URLs: The FreeBSD Handbook /usr/share/doc/handbook/index.html The FreeBSD FAQ /usr/share/doc/faq/index.html You can also view the master (and most frequently updated) copies at http://www.FreeBSD.org/. ------------------------------------------------------------------------ Chapter 2 Installing FreeBSD /Restructured, reorganized, and parts rewritten by Jim Mock./ /The sysinstall walkthrough, screenshots, and general copy by Randy Pratt./ 2.1 Synopsis FreeBSD is provided with a text-based, easy to use installation program called *sysinstall*. This is the default installation program for FreeBSD, although vendors are free to provide their own installation suite if they wish. This chapter describes how to use *sysinstall* to install FreeBSD. After reading this chapter, you will know: * How to create the FreeBSD installation disks. * How FreeBSD refers to, and subdivides, your hard disks. * How to start *sysinstall*. * The questions *sysinstall* will ask you, what they mean, and how to answer them. Before reading this chapter, you should: * Read the supported hardware list that shipped with the version of FreeBSD you are installing, and verify that your hardware is supported. *Note:* In general, these installation instructions are written for i386 (?PC compatible?) architecture computers. Where applicable, instructions specific to other platforms (for example, Alpha) will be listed. Although this guide is kept as up to date as possible, you may find minor differences between the installer and what is shown here. It is suggested that you use this chapter as a general guide rather than a literal installation manual. ------------------------------------------------------------------------ 2.2 Hardware Requirements 2.2.1 Minimal Configuration The minimal configuration to install FreeBSD varies with the FreeBSD version and the hardware architecture. Information about the minimal configuration is available in the Installation Notes on the Release Information page of the FreeBSD web site. A summary of this information is given in the following sections. Depending on the method you choose to install FreeBSD, you may also need a floppy drive, a supported CDROM drive, and in some case a network adapter. This will be covered by the Section 2.3.7 <#INSTALL-FLOPPIES>. ------------------------------------------------------------------------ 2.2.1.1 FreeBSD/i386 and FreeBSD/pc98 Both FreeBSD/i386 and FreeBSD/pc98 require a 486 or better processor and at least 24 MB of RAM. You will need at least 150 MB of free hard drive space for the most minimal installation. *Note:* In case of old configurations, most of time, getting more RAM and more hard drive space is more important than getting a faster processor. ------------------------------------------------------------------------ 2.2.1.2 FreeBSD/alpha To install FreeBSD/alpha, you will need a supported platform (see Section 2.2.2 <#INSTALL-HARDWARE-SUPPORTED>) and a dedicated disk for FreeBSD. It is not possible to share a disk with another operating system at this time. This disk will need to be attached to a SCSI controller which is supported by the SRM firmware or an IDE disk assuming the SRM in your machine supports booting from IDE disks. You will need the SRM console firmware for your platform. In some cases, it is possible to switch between AlphaBIOS (or ARC) firmware and SRM. In others it will be necessary to download new firmware from the vendor's Web site. *Note:* Support for the Alpha was removed beginning with FreeBSD 7.0. The FreeBSD 6./X/ series of releases is the last containing support for this architecture. ------------------------------------------------------------------------ 2.2.1.3 FreeBSD/amd64 There are two classes of processors capable of running FreeBSD/amd64. The first are AMD64 processors, including the AMD Athlon?64, AMD Athlon64-FX, AMD Opteron? or better processors. The second class of processors that can use FreeBSD/amd64 includes those using the Intel® EM64T architecture. Examples of these processors include the Intel Core? 2 Duo, Quad, and Extreme processor families and the Intel Xeon 3000, 5000, and 7000 sequences of processors. If you have a machine based on an nVidia nForce3 Pro-150, you /must/ use the BIOS setup to disable the IO APIC. If you do not have an option to do this, you will likely have to disable ACPI instead. There are bugs in the Pro-150 chipset that we have not found a workaround for yet. ------------------------------------------------------------------------ 2.2.1.4 FreeBSD/sparc64 To install FreeBSD/sparc64, you will need a supported platform (see Section 2.2.2 <#INSTALL-HARDWARE-SUPPORTED>). You will need a dedicated disk for FreeBSD/sparc64. It is not possible to share a disk with another operating system at this time. ------------------------------------------------------------------------ 2.2.2 Supported Hardware A list of supported hardware is provided with each FreeBSD release in the FreeBSD Hardware Notes. This document can usually be found in a file named HARDWARE.TXT, in the top-level directory of a CDROM or FTP distribution or in *sysinstall*'s documentation menu. It lists, for a given architecture, what hardware devices are known to be supported by each release of FreeBSD. Copies of the supported hardware list for various releases and architectures can also be found on the Release Information page of the FreeBSD Web site. ------------------------------------------------------------------------ 2.3 Pre-installation Tasks 2.3.1 Inventory Your Computer Before installing FreeBSD you should attempt to inventory the components in your computer. The FreeBSD installation routines will show you the components (hard disks, network cards, CDROM drives, and so forth) with their model number and manufacturer. FreeBSD will also attempt to determine the correct configuration for these devices, which includes information about IRQ and IO port usage. Due to the vagaries of PC hardware this process is not always completely successful, and you may need to correct FreeBSD's determination of your configuration. If you already have another operating system installed, such as Windows or Linux, it is a good idea to use the facilities provided by those operating systems to see how your hardware is already configured. If you are not sure what settings an expansion card is using, you may find it printed on the card itself. Popular IRQ numbers are 3, 5, and 7, and IO port addresses are normally written as hexadecimal numbers, such as 0x330. We recommend you print or write down this information before installing FreeBSD. It may help to use a table, like this: *Table 2-1. Sample Device Inventory* Device Name IRQ IO port(s) Notes First hard disk N/A N/A 40 GB, made by Seagate, first IDE master CDROM N/A N/A First IDE slave Second hard disk N/A N/A 20 GB, made by IBM, second IDE master First IDE controller 14 0x1f0 Network card N/A N/A Intel 10/100 Modem N/A N/A 3Com® 56K faxmodem, on COM1 ... Once the inventory of the components in your computer is done, you have to check if they match the hardware requirements of the FreeBSD release you want to install. ------------------------------------------------------------------------ 2.3.2 Backup Your Data If the computer you will be installing FreeBSD on contains valuable data, then ensure you have it backed up, and that you have tested the backups before installing FreeBSD. The FreeBSD installation routine will prompt you before writing any data to your disk, but once that process has started it cannot be undone. ------------------------------------------------------------------------ 2.3.3 Decide Where to Install FreeBSD If you want FreeBSD to use your entire hard disk, then there is nothing more to concern yourself with at this point -- you can skip this section. However, if you need FreeBSD to co-exist with other operating systems then you need to have a rough understanding of how data is laid out on the disk, and how this affects you. ------------------------------------------------------------------------ 2.3.3.1 Disk Layouts for FreeBSD/i386 A PC disk can be divided into discrete chunks. These chunks are called /partitions/. Since FreeBSD internally also has partitions, the naming can become confusing very quickly, therefore these disk chunks are referred to as disk slices or simply slices in FreeBSD itself. For example, the FreeBSD utility fdisk which operates on the PC disk partitions, refers to slices instead of partitions. By design, the PC only supports four partitions per disk. These partitions are called /primary partitions/. To work around this limitation and allow more than four partitions, a new partition type was created, the /extended partition/. A disk may contain only one extended partition. Special partitions, called /logical partitions/, can be created inside this extended partition. Each partition has a /partition ID/, which is a number used to identify the type of data on the partition. FreeBSD partitions have the partition ID of 165. In general, each operating system that you use will identify partitions in a particular way. For example, DOS, and its descendants, like Windows, assign each primary and logical partition a /drive letter/, starting with C:. FreeBSD must be installed into a primary partition. FreeBSD can keep all its data, including any files that you create, on this one partition. However, if you have multiple disks, then you can create a FreeBSD partition on all, or some, of them. When you install FreeBSD, you must have one partition available. This might be a blank partition that you have prepared, or it might be an existing partition that contains data that you no longer care about. If you are already using all the partitions on all your disks, then you will have to free one of them for FreeBSD using the tools provided by the other operating systems you use (e.g., fdisk on DOS or Windows). If you have a spare partition then you can use that. However, you may need to shrink one or more of your existing partitions first. A minimal installation of FreeBSD takes as little as 100 MB of disk space. However, that is a /very/ minimal install, leaving almost no space for your own files. A more realistic minimum is 250 MB without a graphical environment, and 350 MB or more if you want a graphical user interface. If you intend to install a lot of third-party software as well, then you will need more space. You can use a commercial tool such as *PartitionMagic®*, or a free tool such as *GParted*, to resize your partitions and make space for FreeBSD. The tools directory on the CDROM contains two free software tools which can carry out this task, namely *FIPS* and *PResizer*. Documentation for both of these is available in the same directory. *FIPS*, *PResizer*, and *PartitionMagic* can resize FAT16 and FAT32 partitions -- used in MS-DOS through Windows ME. Both *PartitionMagic* and *GParted* are known to work on NTFS. *GParted* is available on a number of Live CD Linux distributions, such as SystemRescueCD . Problems have been reported resizing Microsoft Vista partitions. Having a Vista installation CDROM handy when attempting such an operation is recommended. As with all such disk maintenance tasks, a current set of backups is also strongly advised. *Warning:* Incorrect use of these tools can delete the data on your disk. Be sure that you have recent, working backups before using them. *Example 2-1. Using an Existing Partition Unchanged* Suppose that you have a computer with a single 4 GB disk that already has a version of Windows installed, and you have split the disk into two drive letters, C: and D:, each of which is 2 GB in size. You have 1 GB of data on C:, and 0.5 GB of data on D:. This means that your disk has two partitions on it, one per drive letter. You can copy all your existing data from D: to C:, which will free up the second partition, ready for FreeBSD. *Example 2-2. Shrinking an Existing Partition* Suppose that you have a computer with a single 4 GB disk that already has a version of Windows installed. When you installed Windows you created one large partition, giving you a C: drive that is 4 GB in size. You are currently using 1.5 GB of space, and want FreeBSD to have 2 GB of space. In order to install FreeBSD you will need to either: 1. Backup your Windows data, and then reinstall Windows, asking for a 2 GB partition at install time. 2. Use one of the tools such as *PartitionMagic*, described above, to shrink your Windows partition. ------------------------------------------------------------------------ 2.3.3.2 Disk Layouts for the Alpha You will need a dedicated disk for FreeBSD on the Alpha. It is not possible to share a disk with another operating system at this time. Depending on the specific Alpha machine you have, this disk can either be a SCSI disk or an IDE disk, as long as your machine is capable of booting from it. Following the conventions of the Digital / Compaq manuals all SRM input is shown in uppercase. SRM is case insensitive. To find the names and types of disks in your machine, use the SHOW DEVICE command from the SRM console prompt: >>>SHOW DEVICE dka0.0.0.4.0 DKA0 TOSHIBA CD-ROM XM-57 3476 dkc0.0.0.1009.0 DKC0 RZ1BB-BS 0658 dkc100.1.0.1009.0 DKC100 SEAGATE ST34501W 0015 dva0.0.0.0.1 DVA0 ewa0.0.0.3.0 EWA0 00-00-F8-75-6D-01 pkc0.7.0.1009.0 PKC0 SCSI Bus ID 7 5.27 pqa0.0.0.4.0 PQA0 PCI EIDE pqb0.0.1.4.0 PQB0 PCI EIDE This example is from a Digital Personal Workstation 433au and shows three disks attached to the machine. The first is a CDROM drive called DKA0 and the other two are disks and are called DKC0 and DKC100 respectively. Disks with names of the form DKx are SCSI disks. For example DKA100 refers to a SCSI disk with SCSI target ID 1 on the first SCSI bus (A), whereas DKC300 refers to a SCSI disk with SCSI ID 3 on the third SCSI bus (C). Devicename PKx refers to the SCSI host bus adapter. As seen in the SHOW DEVICE output SCSI CDROM drives are treated as any other SCSI hard disk drive. IDE disks have names similar to DQx, while PQx is the associated IDE controller. ------------------------------------------------------------------------ 2.3.4 Collect Your Network Configuration Details If you intend to connect to a network as part of your FreeBSD installation (for example, if you will be installing from an FTP site or an NFS server), then you need to know your network configuration. You will be prompted for this information during the installation so that FreeBSD can connect to the network to complete the install. ------------------------------------------------------------------------ 2.3.4.1 Connecting to an Ethernet Network or Cable/DSL Modem If you connect to an Ethernet network, or you have an Internet connection using an Ethernet adapter via cable or DSL, then you will need the following information: 1. IP address 2. IP address of the default gateway 3. Hostname 4. DNS server IP addresses 5. Subnet Mask If you do not know this information, then ask your system administrator or service provider. They may say that this information is assigned automatically, using /DHCP/. If so, make a note of this. ------------------------------------------------------------------------ 2.3.4.2 Connecting Using a Modem If you dial up to an ISP using a regular modem then you can still install FreeBSD over the Internet, it will just take a very long time. You will need to know: 1. The phone number to dial for your ISP 2. The COM: port your modem is connected to 3. The username and password for your ISP account ------------------------------------------------------------------------ 2.3.5 Check for FreeBSD Errata Although the FreeBSD project strives to ensure that each release of FreeBSD is as stable as possible, bugs do occasionally creep into the process. On very rare occasions those bugs affect the installation process. As these problems are discovered and fixed, they are noted in the FreeBSD Errata , which is found on the FreeBSD web site. You should check the errata before installing to make sure that there are no late-breaking problems which you should be aware of. Information about all the releases, including the errata for each release, can be found on the release information <../../../../releases/index.html> section of the FreeBSD web site <../../../../index.html>. ------------------------------------------------------------------------ 2.3.6 Obtain the FreeBSD Installation Files The FreeBSD installation process can install FreeBSD from files located in any of the following places: *Local Media* * A CDROM or DVD * A DOS partition on the same computer * A SCSI or QIC tape * Floppy disks *Network* * An FTP site, going through a firewall, or using an HTTP proxy, as necessary * An NFS server * A dedicated parallel or serial connection If you have purchased FreeBSD on CD or DVD then you already have everything you need, and should proceed to the next section (Section 2.3.7 <#INSTALL-FLOPPIES>). If you have not obtained the FreeBSD installation files you should skip ahead to Section 2.13 <#INSTALL-DIFF-MEDIA> which explains how to prepare to install FreeBSD from any of the above. After reading that section, you should come back here, and read on to Section 2.3.7 <#INSTALL-FLOPPIES>. ------------------------------------------------------------------------ 2.3.7 Prepare the Boot Media The FreeBSD installation process is started by booting your computer into the FreeBSD installer--it is not a program you run within another operating system. Your computer normally boots using the operating system installed on your hard disk, but it can also be configured to use a ?bootable? floppy disk. Most modern computers can also boot from a CDROM in the CDROM drive. *Tip:* If you have FreeBSD on CDROM or DVD (either one you purchased or you prepared yourself), and your computer allows you to boot from the CDROM or DVD (typically a BIOS option called ?Boot Order? or similar), then you can skip this section. The FreeBSD CDROM and DVD images are bootable and can be used to install FreeBSD without any other special preparation. To create boot floppy images, follow these steps: 1. *Acquire the Boot Floppy Images* The boot disks are available on your installation media in the floppies/ directory, and can also be downloaded from the floppies directory, ftp://ftp.FreeBSD.org/pub/FreeBSD/releases//////-RELEASE/floppies/. Replace // and // with the architecture and the version number which you want to install, respectively. For example, the boot floppy images for FreeBSD/i386 7.0-RELEASE are available from ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/i386/7.0-RELEASE/floppies/. The floppy images have a .flp extension. The floppies/ directory contains a number of different images, and the ones you will need to use depends on the version of FreeBSD you are installing, and in some cases, the hardware you are installing to. In most cases you will need four floppies, boot.flp, kern1.flp, kern2.flp, and kern3.flp. Check README.TXT in the same directory for the most up to date information about these floppy images. *Important:* Your FTP program must use /binary mode/ to download these disk images. Some web browsers have been known to use /text/ (or /ASCII/) mode, which will be apparent if you cannot boot from the disks. 2. *Prepare the Floppy Disks* You must prepare one floppy disk per image file you had to download. It is imperative that these disks are free from defects. The easiest way to test this is to format the disks for yourself. Do not trust pre-formatted floppies. The format utility in Windows will not tell about the presence of bad blocks, it simply marks them as ?bad? and ignores them. It is advised that you use brand new floppies if choosing this installation route. *Important:* If you try to install FreeBSD and the installation program crashes, freezes, or otherwise misbehaves, one of the first things to suspect is the floppies. Try writing the floppy image files to new disks and try again. 3. *Write the Image Files to the Floppy Disks* The .flp files are /not/ regular files you copy to the disk. They are images of the complete contents of the disk. This means that you /cannot/ simply copy files from one disk to another. Instead, you must use specific tools to write the images directly to the disk. If you are creating the floppies on a computer running MS-DOS/Windows, then we provide a tool to do this called fdimage. If you are using the floppies from the CDROM, and your CDROM is the E: drive, then you would run this: E:\> tools\fdimage floppies\boot.flp A: Repeat this command for each .flp file, replacing the floppy disk each time, being sure to label the disks with the name of the file that you copied to them. Adjust the command line as necessary, depending on where you have placed the .flp files. If you do not have the CDROM, then fdimage can be downloaded from the tools directory on the FreeBSD FTP site. If you are writing the floppies on a UNIX system (such as another FreeBSD system) you can use the dd(1) command to write the image files directly to disk. On FreeBSD, you would run: # dd if=boot.flp of=/dev/fd0 On FreeBSD, /dev/fd0 refers to the first floppy disk (the A: drive). /dev/fd1 would be the B: drive, and so on. Other UNIX variants might have different names for the floppy disk devices, and you will need to check the documentation for the system as necessary. You are now ready to start installing FreeBSD. ------------------------------------------------------------------------ 2.4 Starting the Installation *Important:* By default, the installation will not make any changes to your disk(s) until you see the following message: Last Chance: Are you SURE you want continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents! The install can be exited at any time prior to the final warning without changing the contents of the hard drive. If you are concerned that you have configured something incorrectly you can just turn the computer off before this point, and no damage will be done. ------------------------------------------------------------------------ 2.4.1 Booting 2.4.1.1 Booting for the i386? 1. Start with your computer turned off. 2. Turn on the computer. As it starts it should display an option to enter the system set up menu, or BIOS, commonly reached by keys like *F2*, *F10*, *Del*, or *Alt*+*S*. Use whichever keystroke is indicated on screen. In some cases your computer may display a graphic while it starts. Typically, pressing *Esc* will dismiss the graphic and allow you to see the necessary messages. 3. Find the setting that controls which devices the system boots from. This is usually labeled as the ?Boot Order? and commonly shown as a list of devices, such as Floppy, CDROM, First Hard Disk, and so on. If you needed to prepare boot floppies, then make sure that the floppy disk is selected. If you are booting from the CDROM then make sure that that is selected instead. In case of doubt, you should consult the manual that came with your computer, and/or its motherboard. Make the change, then save and exit. The computer should now restart. 4. If you needed to prepare boot floppies, as described in Section 2.3.7 <#INSTALL-FLOPPIES>, then one of them will be the first boot disc, probably the one containing boot.flp. Put this disc in your floppy drive. If you are booting from CDROM, then you will need to turn on the computer, and insert the CDROM at the first opportunity. If your computer starts up as normal and loads your existing operating system, then either: 1. The disks were not inserted early enough in the boot process. Leave them in, and try restarting your computer. 2. The BIOS changes earlier did not work correctly. You should redo that step until you get the right option. 3. Your particular BIOS does not support booting from the desired media. 5. FreeBSD will start to boot. If you are booting from CDROM you will see a display similar to this (version information omitted): Booting from CD-Rom... CD Loader 1.2 Building the boot loader arguments Looking up /BOOT/LOADER... Found Relocating the loader and the BTX Starting the BTX loader BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS CD is cd0 BIOS drive C: is disk0 BIOS drive D: is disk1 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 1.1 Loading /boot/defaults/loader.conf /boot/kernel/kernel text=0x64daa0 data=0xa4e80+0xa9e40 syms=[0x4+0x6cac0+0x4+0x88e9d] \ If you are booting from floppy disc, you will see a display similar to this (version information omitted): Booting from Floppy... Uncompressing ... done BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 1.1 Loading /boot/defaults/loader.conf /kernel text=0x277391 data=0x3268c+0x332a8 | Insert disk labelled "Kernel floppy 1" and press any key... Follow these instructions by removing the boot.flp disc, insert the kern1.flp disc, and press *Enter*. Boot from first floppy; when prompted, insert the other disks as required. 6. Whether you booted from floppy or CDROM, the boot process will then get to the FreeBSD boot loader menu: *Figure 2-1. FreeBSD Boot Loader Menu* Either wait ten seconds, or press *Enter*. ------------------------------------------------------------------------ 2.4.1.2 Booting for the Alpha 1. Start with your computer turned off. 2. Turn on the computer and wait for a boot monitor prompt. 3. If you needed to prepare boot floppies, as described in Section 2.3.7 <#INSTALL-FLOPPIES> then one of them will be the first boot disc, probably the one containing boot.flp. Put this disc in your floppy drive and type the following command to boot the disk (substituting the name of your floppy drive if necessary): >>>BOOT DVA0 -FLAGS '' -FILE '' If you are booting from CDROM, insert the CDROM into the drive and type the following command to start the installation (substituting the name of the appropriate CDROM drive if necessary): >>>BOOT DKA0 -FLAGS '' -FILE '' 4. FreeBSD will start to boot. If you are booting from a floppy disc, at some point you will see the message: Insert disk labelled "Kernel floppy 1" and press any key... Follow these instructions by removing the boot.flp disc, insert the kern1.flp disc, and press *Enter*. 5. Whether you booted from floppy or CDROM, the boot process will then get to this point: Hit [Enter] to boot immediately, or any other key for command prompt. Booting [kernel] in 9 seconds... _ Either wait ten seconds, or press *Enter*. This will then launch the kernel configuration menu. ------------------------------------------------------------------------ 2.4.1.3 Booting for Sparc64® Most Sparc64® systems are set up to boot automatically from disk. To install FreeBSD, you need to boot over the network or from a CDROM, which requires you to break into the PROM (OpenFirmware). To do this, reboot the system, and wait until the boot message appears. It depends on the model, but should look about like: Sun Blade 100 (UltraSPARC-IIe), Keyboard Present Copyright 1998-2001 Sun Microsystems, Inc. All rights reserved. OpenBoot 4.2, 128 MB memory installed, Serial #51090132. Ethernet address 0:3:ba:b:92:d4, Host ID: 830b92d4. If your system proceeds to boot from disk at this point, you need to press *L1*+*A* or *Stop*+*A* on the keyboard, or send a BREAK over the serial console (using for example ~# in tip(1) or cu(1) ) to get to the PROM prompt. It looks like this: ok (1) ok {0} (2) (1) <#PROMPT-SINGLE> This is the prompt used on systems with just one CPU. (2) <#PROMPT-SMP> This is the prompt used on SMP systems, the digit indicates the number of the active CPU. At this point, place the CDROM into your drive, and from the PROM prompt, type boot cdrom. ------------------------------------------------------------------------ 2.4.2 Reviewing the Device Probe Results The last few hundred lines that have been displayed on screen are stored and can be reviewed. To review the buffer, press *Scroll Lock*. This turns on scrolling in the display. You can then use the arrow keys, or *PageUp* and *PageDown* to view the results. Press *Scroll Lock* again to stop scrolling. Do this now, to review the text that scrolled off the screen when the kernel was carrying out the device probes. You will see text similar to Figure 2-2 <#INSTALL-DEV-PROBE>, although the precise text will differ depending on the devices that you have in your computer. *Figure 2-2. Typical Device Probe Results* avail memory = 253050880 (247120K bytes) Preloaded elf kernel "kernel" at 0xc0817000. Preloaded mfs_root "/mfsroot" at 0xc0817084. md0: Preloaded image 4423680 bytes at 0xc03ddcd4 md1: Malloc disk Using $PIR table, 4 entries at 0xc00fde60 npx0: on motherboard npx0: INT 16 interface pcib0: on motherboard pci0: on pcib0 pcib1: at device 1.0 on pci0 pci1: on pcib1 pci1: at 0.0 irq 11 isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0xe000-0xe00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0 port 0xe400-0xe41f irq 10 at device 7.2 on pci 0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr1 uhub0: 2 ports with 2 removable, self powered pci0: (vendor=0x1106, dev=0x3040) at 7.3 dc0: port 0xe800-0xe8ff mem 0xdb000000-0xeb0003ff ir q 11 at device 8.0 on pci0 dc0: Ethernet address: 00:04:5a:74:6b:b5 miibus0: on dc0 ukphy0: on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto ed0: port 0xec00-0xec1f irq 9 at device 10. 0 on pci0 ed0 address 52:54:05:de:73:1b, type NE2000 (16 bit) isa0: too many dependant configs (8) isa0: unexpected small tag 14 orm0: