Você está na página 1de 39

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

FreeBSD Handbook
The FreeBSD Documentation Project
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The FreeBSD Documentation Project Welcome to FreeBSD! This handbook covers the installation and day to day use of FreeBSD 8.3-RELEASE and FreeBSD 9.1-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. 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.
REDISTRIBUTION AND USE IN SOURCE (XML DOCBOOK) AND 'COMPILED' FORMS (XML, 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 (XML 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. SOUND BLASTER IS A TRADEMARK OF CREATIVE TECHNOLOGY LTD. IN THE UNITED STATES AND/OR OTHER COUNTRIES.

1 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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 COUNTRIES. NEXTHOP ARE REGISTERED AND UNREGISTERED TRADEMARKS OF NEXTHOP IN THE U.S. AND OTHER

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, OPENJDK, SOLARIS, STAROFFICE, SUN BLADE, SUN ENTERPRISE, SUN FIRE, SUNOS, ULTRA AND VIRTUALBOX 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.

2 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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 / Single HTML ] Table of Contents Preface I. Getting Started 1 Introduction 1.1 Synopsis 1.2 Welcome to FreeBSD! 1.3 About the FreeBSD Project 2 Installing FreeBSD 9.X and Later 2.1 Synopsis 2.2 Hardware Requirements 2.3 Pre-Installation Tasks 2.4 Starting the Installation 2.5 Introducing bsdinstall 2.6 Installing from the Network 2.7 Allocating Disk Space 2.8 Committing to the Installation 2.9 Post-Installation 2.10 Troubleshooting 2.11 Using the Live CD 3 Installing FreeBSD 8.X and Earlier 3.1 Synopsis 3.2 Hardware Requirements 3.3 Pre-installation Tasks 3.4 Starting the Installation 3.5 Introducing Sysinstall 3.6 Allocating Disk Space 3.7 Choosing What to Install 3.8 Choosing Your Installation Media 3.9 Committing to the Installation 3.10 Post-installation 3.11 Troubleshooting 3.12 Advanced Installation Guide 3.13 Preparing Your Own Installation Media 4 UNIX Basics 4.1 Synopsis 4.2 Virtual Consoles and Terminals 4.3 Permissions 4.4 Directory Structure

3 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

4.5 Disk Organization 4.6 Mounting and Unmounting File Systems 4.7 Processes 4.8 Daemons, Signals, and Killing Processes 4.9 Shells 4.10 Text Editors 4.11 Devices and Device Nodes 4.12 Binary Formats 4.13 For More Information 5 Installing Applications: Packages and Ports 5.1 Synopsis 5.2 Overview of Software Installation 5.3 Finding Software 5.4 Using Binary Packages 5.5 Using pkgng for Binary Package Management 5.6 Using the Ports Collection 5.7 Post-installation Activities 5.8 Dealing with Broken Ports 6 The X Window System 6.1 Synopsis 6.2 Understanding X 6.3 Installing X11 6.4 X11 Configuration 6.5 Using Fonts in X11 6.6 The X Display Manager 6.7 Desktop Environments II. Common Tasks 7 Desktop Applications 7.1 Synopsis 7.2 Browsers 7.3 Productivity 7.4 Document Viewers 7.5 Finance 8 Multimedia 8.1 Synopsis 8.2 Setting Up the Sound Card 8.3 MP3 Audio 8.4 Video Playback 8.5 Setting Up TV Cards 8.6 MythTV 8.7 Image Scanners 9 Configuring the FreeBSD Kernel 9.1 Synopsis 9.2 Why Build a Custom Kernel? 9.3 Finding the System Hardware 9.4 Kernel Drivers, Subsystems, and Modules

4 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

9.5 Building and Installing a Custom Kernel 9.6 The Configuration File 9.7 If Something Goes Wrong 10 Printing 10.1 Synopsis 10.2 Introduction 10.3 Basic Setup 10.4 Advanced Printer Setup 10.5 Using Printers 10.6 Alternatives to the Standard Spooler 10.7 Troubleshooting 11 Linux Binary Compatibility 11.1 Synopsis 11.2 Installation 11.3 Installing Mathematica 11.4 Installing Maple 11.5 Installing MATLAB 11.6 Installing Oracle 11.7 Advanced Topics III. System Administration 12 Configuration and Tuning 12.1 Synopsis 12.2 Initial Configuration 12.3 Core Configuration 12.4 Application Configuration 12.5 Starting Services 12.6 Configuring the cron Utility 12.7 Using rc(8) Under FreeBSD 12.8 Setting Up Network Interface Cards 12.9 Virtual Hosts 12.10 Configuring the System Logger, syslogd 12.11 Configuration Files 12.12 Tuning with sysctl(8) 12.13 Tuning Disks 12.14 Tuning Kernel Limits 12.15 Adding Swap Space 12.16 Power and Resource Management 12.17 Using and Debugging FreeBSD ACPI 13 The FreeBSD Booting Process 13.1 Synopsis 13.2 The Booting Problem 13.3 The Boot Manager and Boot Stages 13.4 Kernel Interaction During Boot 13.5 Device Hints 13.6 Init: Process Control Initialization 13.7 Shutdown Sequence 14 Users and Basic Account Management

5 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

14.1 Synopsis 14.2 Introduction 14.3 Modifying Accounts 14.4 Limiting Users 14.5 Groups 15 Security 15.1 Synopsis 15.2 Introduction 15.3 Securing FreeBSD 15.4 DES, Blowfish, MD5, SHA256, SHA512, and Crypt 15.5 One-time Passwords 15.6 TCP Wrappers 15.7 Kerberos5 15.8 OpenSSL 15.9 VPN over IPsec 15.10 OpenSSH 15.11 File System Access Control Lists (ACLs) 15.12 Monitoring Third Party Security Issues 15.13 FreeBSD Security Advisories 15.14 Process Accounting 16 Jails 16.1 Synopsis 16.2 Terms Related to Jails 16.3 Introduction 16.4 Creating and Controlling Jails 16.5 Fine Tuning and Administration 16.6 Application of Jails 17 Mandatory Access Control 17.1 Synopsis 17.2 Key Terms in This Chapter 17.3 Explanation of MAC 17.4 Understanding MAC Labels 17.5 Planning the Security Configuration 17.6 Module Configuration 17.7 The mac_seeotheruids(4) Module 17.8 The mac_bsdextended(4) Module 17.9 The mac_ifoff(4) Module 17.10 The mac_portacl(4) Module 17.11 The mac_partition(4) Module 17.12 The MAC Multi-Level Security Module 17.13 The MAC Biba Module 17.14 The MAC LOMAC Module 17.15 Nagios in a MAC Jail 17.16 User Lock Down 17.17 Troubleshooting the MAC Framework 18 Security Event Auditing 18.1 Synopsis 18.2 Key Terms in This Chapter

6 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

18.3 Installing Audit Support 18.4 Audit Configuration 18.5 Administering the Audit Subsystem 19 Storage 19.1 Synopsis 19.2 Device Names 19.3 Adding Disks 19.4 RAID 19.5 USB Storage Devices 19.6 Creating and Using CD Media 19.7 Creating and Using DVD Media 19.8 Creating and Using Floppy Disks 19.9 Creating and Using Data Tapes 19.10 Backups to Floppies 19.11 Backup Strategies 19.12 Backup Basics 19.13 Network, Memory, and File-Backed File Systems 19.14 File System Snapshots 19.15 File System Quotas 19.16 Encrypting Disk Partitions 19.17 Encrypting Swap Space 19.18 Highly Available Storage (HAST) 20 GEOM: Modular Disk Transformation Framework 20.1 Synopsis 20.2 GEOM Introduction 20.3 RAID0 - Striping 20.4 RAID1 - Mirroring 20.5 RAID3 - Byte-level Striping with Dedicated Parity 20.6 GEOM Gate Network Devices 20.7 Labeling Disk Devices 20.8 UFS Journaling Through GEOM 21 File Systems Support 21.1 Synopsis 21.2 The Z File System (ZFS) 21.3 Linux Filesystems 22 The Vinum Volume Manager 22.1 Synopsis 22.2 Disks Are Too Small 22.3 Access Bottlenecks 22.4 Data Integrity 22.5 Vinum Objects 22.6 Some Examples 22.7 Object Naming 22.8 Configuring Vinum 22.9 Using Vinum for the Root Filesystem 23 Virtualization 23.1 Synopsis

7 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

23.2 FreeBSD as a Guest OS 23.3 FreeBSD as a Host 24 Localization - i18n/L10n Usage and Setup 24.1 Synopsis 24.2 The Basics 24.3 Using Localization 24.4 Compiling i18n Programs 24.5 Localizing FreeBSD to Specific Languages 25 Updating and Upgrading FreeBSD 25.1 Synopsis 25.2 FreeBSD Update 25.3 Portsnap: a Ports Collection Update Tool 25.4 Updating the Documentation Set 25.5 Tracking a Development Branch 25.6 Synchronizing Source 25.7 Rebuilding world 25.8 Deleting Obsolete Files, Directories and Libraries 25.9 Tracking for Multiple Machines 26 DTrace 26.1 Synopsis 26.2 Implementation Differences 26.3 Enabling DTrace Support 26.4 Using DTrace 26.5 The D Language IV. Network Communication 27 Serial Communications 27.1 Synopsis 27.2 Introduction 27.3 Terminals 27.4 Dial-in Service 27.5 Dial-out Service 27.6 Setting Up the Serial Console 28 PPP and SLIP 28.1 Synopsis 28.2 Using User PPP 28.3 Using Kernel PPP 28.4 Troubleshooting PPP Connections 28.5 Using PPP over Ethernet (PPPoE) 28.6 Using PPP over ATM (PPPoA) 28.7 Using SLIP 29 Electronic Mail 29.1 Synopsis 29.2 Using Electronic Mail 29.3 sendmail Configuration 29.4 Changing Your Mail Transfer Agent

8 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

29.5 Troubleshooting 29.6 Advanced Topics 29.7 SMTP with UUCP 29.8 Setting Up to Send Only 29.9 Using Mail with a Dialup Connection 29.10 SMTP Authentication 29.11 Mail User Agents 29.12 Using fetchmail 29.13 Using procmail 30 Network Servers 30.1 Synopsis 30.2 The inetd Super-Server 30.3 Network File System (NFS) 30.4 Network Information System (NIS/YP) 30.5 Automatic Network Configuration (DHCP) 30.6 Domain Name System (DNS) 30.7 Apache HTTP Server 30.8 File Transfer Protocol (FTP) 30.9 File and Print Services for Microsoft Windows Clients (Samba) 30.10 Clock Synchronization with NTP 30.11 Remote Host Logging with syslogd 31 Firewalls 31.1 Introduction 31.2 Firewall Concepts 31.3 Firewall Packages 31.4 PF and ALTQ 31.5 The IPFILTER (IPF) Firewall 31.6 IPFW 32 Advanced Networking 32.1 Synopsis 32.2 Gateways and Routes 32.3 Wireless Networking 32.4 Bluetooth 32.5 Bridging 32.6 Link Aggregation and Failover 32.7 Diskless Operation 32.8 PXE Booting with an NFS Root File System 32.9 ISDN 32.10 Network Address Translation 32.11 IPv6 32.12 Asynchronous Transfer Mode (ATM) 32.13 Common Address Redundancy Protocol (CARP) V. Appendices A. Obtaining FreeBSD A.1 CDROM and DVD Publishers A.2 FTP Sites A.3 BitTorrent

9 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

A.4 Anonymous CVS (Deprecated) A.5 Using CTM A.6 Using Subversion A.7 Subversion Mirror Sites A.8 Using CVSup (Deprecated) A.9 CVS Tags A.10 rsync Sites B. Bibliography B.1 Books & Magazines Specific to FreeBSD B.2 Users' Guides B.3 Administrators' Guides B.4 Programmers' Guides B.5 Operating System Internals B.6 Security Reference B.7 Hardware Reference B.8 UNIX History B.9 Magazines and Journals C. Resources on the Internet C.1 Mailing Lists C.2 Usenet Newsgroups C.3 World Wide Web Servers C.4 Email Addresses D. PGP Keys D.1 Officers D.2 Core Team Members D.3 Developers FreeBSD Glossary Index Colophon List of Tables 2-1. Partitioning Schemes 3-1. Sample Device Inventory 3-2. Partition Layout for First Disk 3-3. Partition Layout for Subsequent Disks 3-4. FreeBSD 8.X ISO Image Names and Meanings 4-1. Disk Device Codes 19-1. Physical Disk Naming Conventions 22-1. Vinum Plex Organizations 27-1. DB-25 to DB-25 Null-Modem Cable 27-2. DB-9 to DB-9 Null-Modem Cable 27-3. DB-9 to DB-25 Null-Modem Cable 27-4. Signal Names 32-1. Station Capability Codes 32-2. Reserved IPv6 Addresses List of Figures 2-1. FreeBSD Boot Loader Menu 2-2. Typical Device Probe Results

10 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

2-3. Selecting Installation Media Mode 2-4. Keymap Selection 2-5. Selecting Keyboard Menu 2-6. Setting the Hostname 2-7. Selecting Components to Install 2-8. Installing from the Network 2-9. Choosing a Mirror 2-10. Selecting Guided or Manual Partitioning 2-11. Selecting from Multiple Disks 2-12. Selecting Entire Disk or Partition 2-13. Review Created Partitions 2-14. Manually Create Partitions 2-15. Manually Create Partitions 2-16. Manually Create Partitions 2-17. Final Confirmation 2-18. Fetching Distribution Files 2-19. Verifying Distribution Files 2-20. Extracting Distribution Files 2-21. Setting the root Password 2-22. Choose a Network Interface 2-23. Scanning for Wireless Access Points 2-24. Choosing a Wireless Network 2-25. WPA2 Setup 2-26. Choose IPv4 Networking 2-27. Choose IPv4 DHCP Configuration 2-28. IPv4 Static Configuration 2-29. Choose IPv6 Networking 2-30. Choose IPv6 SLAAC Configuration 2-31. IPv6 Static Configuration 2-32. DNS Configuration 2-33. Select Local or UTC Clock 2-34. Select a Region 2-35. Select a Country 2-36. Select a Time Zone 2-37. Confirm Time Zone 2-38. Selecting Additional Services to Enable 2-39. Enabling Crash Dumps 2-40. Add User Accounts 2-41. Enter User Information 2-42. Exit User and Group Management 2-43. Final Configuration 2-44. Manual Configuration 2-45. Complete the Installation 3-1. FreeBSD Boot Loader Menu 3-2. Typical Device Probe Results 3-3. Selecting Country Menu 3-4. Selecting Keyboard Menu 3-5. Selecting Usage from Sysinstall Main Menu 3-6. Selecting Documentation Menu 3-7. Sysinstall Documentation Menu 3-8. Sysinstall Main Menu 3-9. Sysinstall Keymap Menu 3-10. Sysinstall Main Menu

11 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

3-11. Sysinstall Options 3-12. Begin Standard Installation 3-13. Select Drive for FDisk 3-14. Typical fdisk Partitions Before Editing 3-15. Fdisk Partition Using Entire Disk 3-16. Sysinstall Boot Manager Menu 3-17. Exit Select Drive 3-18. Sysinstall Disklabel Editor 3-19. Sysinstall Disklabel Editor with Auto Defaults 3-20. Free Space for Root Partition 3-21. Edit Root Partition Size 3-22. Choose the Root Partition Type 3-23. Choose the Root Mount Point 3-24. Sysinstall Disklabel Editor 3-25. Choose Distributions 3-26. Confirm Distributions 3-27. Choose Installation Media 3-28. Selecting an Ethernet Device 3-29. Set Network Configuration for ed0 3-30. Editing inetd.conf 3-31. Default Anonymous FTP Configuration 3-32. Edit the FTP Welcome Message 3-33. Editing exports 3-34. System Console Configuration Options 3-35. Screen Saver Options 3-36. Screen Saver Timeout 3-37. System Console Configuration Exit 3-38. Select Your Region 3-39. Select Your Country 3-40. Select Your Time Zone 3-41. Select Mouse Protocol Type 3-42. Set Mouse Protocol 3-43. Configure Mouse Port 3-44. Setting the Mouse Port 3-45. Enable the Mouse Daemon 3-46. Test the Mouse Daemon 3-47. Select Package Category 3-48. Select Packages 3-49. Install Packages 3-50. Confirm Package Installation 3-51. Select User 3-52. Add User Information 3-53. Exit User and Group Management 3-54. Exit Install 3-55. Network Configuration Upper-level 3-56. Select a default MTA 3-57. Ntpdate Configuration 3-58. Network Configuration Lower-level 22-1. Concatenated Organization 22-2. Striped Organization 22-3. RAID-5 Organization 22-4. A Simple Vinum Volume 22-5. A Mirrored Vinum Volume

12 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

22-6. A Striped Vinum Volume 22-7. A Mirrored, Striped Vinum Volume 32-1. PXE Booting Process with NFS Root Mount List of Examples 2-1. Using an Existing Partition 2-2. Shrinking an Existing Partition 2-3. Creating Traditional Split Filesystem Partitions 3-1. Using an Existing Partition Unchanged 3-2. Shrinking an Existing Partition 4-1. Sample Disk, Slice, and Partition Names 4-2. Conceptual Model of a Disk 5-1. Downloading a Package Manually and Installing It Locally 12-1. Creating a Swapfile on FreeBSD 13-1. boot0 Screenshot 13-2. boot2 Screenshot 13-3. An Insecure Console in /etc/ttys 14-1. Adding a User on FreeBSD 14-2. rmuser Interactive Account Removal 14-3. Interactive chpass by Superuser 14-4. Interactive chpass by Normal User 14-5. Changing Your Password 14-6. Changing Another User's Password as the Superuser 14-7. Adding a Group Using pw(8) 14-8. Adding User Accounts to a New Group Using pw(8) 14-9. Adding a New Member to a Group Using pw(8) 14-10. Using id(1) to Determine Group Membership 15-1. Using SSH to Create a Secure Tunnel for SMTP 19-1. Using dump over ssh 19-2. Using dump over ssh with RSH Set 19-3. Using mdconfig to Mount an Existing File System Image 19-4. Creating a New File-Backed Disk with mdconfig 19-5. Configure and Mount a File-Backed Disk with mdmfs 19-6. Creating a New Memory-Based Disk with mdconfig 19-7. Creating a New Memory-Based Disk with mdmfs 20-1. Labeling Partitions on the Boot Disk 27-1. Adding Terminal Entries to /etc/ttys 29-1. Configuring the sendmail Access Database 29-2. Mail Aliases 29-3. Example Virtual Domain Mail Map 30-1. Reloading the inetd Configuration File 30-2. Mounting an Export with amd 30-3. Installing Django with Apache2, mod_python3, and PostgreSQL 30-4. Apache Configuration for Django/mod_python 32-1. LACP Aggregation with a Cisco Switch 32-2. Failover Mode 32-3. Failover Mode Between Wired and Wireless Interfaces 32-4. Branch Office or Home Network 32-5. Head Office or Other LAN

Preface
13 of 1605 3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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.

Changes from the Third Edition


The current online version of the Handbook represents the cumulative effort of many hundreds of contributors over the past 10 years. The following are some of the significant changes since the two volume third edition was published in 2004: Chapter 26, DTrace, has been added with information about the powerful DTrace performance analysis tool. Chapter 21, File Systems Support, has been added with information about non-native file systems in FreeBSD, such as ZFS from Sun. Chapter 18, Security Event Auditing, has been added to cover the new auditing capabilities in FreeBSD and explain its use. Chapter 23, Virtualization, has been added with information about installing FreeBSD on virtualization software. Chapter 2, Installing FreeBSD 9.x and Later, has been added to cover installation of FreeBSD using the new installation utility, bsdinstall.

Changes from the Second Edition (2004)


The third edition was the culmination of over two years of work by the dedicated members of the FreeBSD Documentation Project. The printed edition grew to such a size that it was necessary to publish as two separate volumes. The following are the major changes in this new edition: Chapter 12, 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 15, Security, has been expanded with new information about virtual private networks (VPNs), file system access control lists (ACLs), and security advisories. Chapter 17, 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 19, Storage, has been expanded with new information about USB storage devices, file system snapshots, file system quotas, file and network backed filesystems,

14 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

and encrypted disk partitions. Chapter 22, 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 28, PPP and SLIP. Chapter 29, Electronic Mail, has been expanded with new information about using alternative transport agents, SMTP authentication, UUCP, fetchmail, procmail, and other advanced topics. Chapter 30, 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 32, Advanced Networking, were moved here to improve the presentation. Chapter 32, 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 (2001)


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 3 (Installing FreeBSD) was completely rewritten with many screenshots to make it much easier for new users to grasp the text. Chapter 4 (UNIX Basics) has been expanded to contain additional information about processes, daemons, and signals. Chapter 5 (Installing Applications) has been expanded to contain additional information about binary package management. Chapter 6 (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 13 (The FreeBSD Booting Process) has been expanded.

15 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Chapter 19 (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 27 (Serial Communications) has been completely reorganized and updated for FreeBSD 4.X/5.X. Chapter 28 (PPP and SLIP) has been substantially updated. Many new sections have been added to Chapter 32 (Advanced Networking). Chapter 29 (Electronic Mail) has been expanded to include more information about configuring sendmail. Chapter 11 (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: Configuration and Tuning (Chapter 12). Multimedia (Chapter 8)

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 Introduces FreeBSD to a new user. It describes the history of the FreeBSD Project, its goals and development model. Chapter 3, Installation of FreeBSD 8.x and Earlier Walks a user through the entire installation process of FreeBSD 8.x and earlier using sysinstall. Some advanced installation topics, such as installing through a serial console, are also covered. Chapter 2, Installation of FreeBSD 9.x and Later Walks a user through the entire installation process of FreeBSD 9.x and later using bsdinstall. Chapter 4, 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.

16 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Chapter 5, Installing Applications Covers the installation of third-party software with both FreeBSD's innovative Ports Collection and standard binary packages. Chapter 6, 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 7, Desktop Applications Lists some common desktop applications, such as web browsers and productivity suites, and describes how to install them on FreeBSD. Chapter 8, Multimedia Shows how to set up sound and video playback support for your system. Also describes some sample audio and video applications. Chapter 9, 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 10, Printing Describes managing printers on FreeBSD, including information about banner pages, printer accounting, and initial setup. Chapter 11, Linux Binary Compatibility Describes the Linux compatibility features of FreeBSD. Also provides detailed installation instructions for many popular Linux applications such as Oracle and Mathematica. Chapter 12, 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 13, Booting Process Describes the FreeBSD boot process and explains how to control this process with configuration options. Chapter 14, 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 15, Security Describes many different tools available to help keep your FreeBSD system secure, including Kerberos, IPsec and OpenSSH. Chapter 16, Jails

17 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Describes the jails framework, and the improvements of jails over the traditional chroot support of FreeBSD. Chapter 17, Mandatory Access Control Explains what Mandatory Access Control (MAC) is and how this mechanism can be used to secure a FreeBSD system. Chapter 18, 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 19, 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. Section 20.1, GEOM Describes what the GEOM framework in FreeBSD is and how to configure various supported RAID levels. Chapter 21, File Systems Support Examines support of non-native file systems in FreeBSD, like the Z File System from Sun. Chapter 22, 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 23, Virtualization Describes what virtualization systems offer, and how they can be used with FreeBSD. Chapter 24, Localization Describes how to use FreeBSD in languages other than English. Covers both system and application level localization. Chapter 25, Updating and Upgrading FreeBSD 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. Covers the methods users may take to update their system to the latest security release. Chapter 26, DTrace Describes how to configure and use the DTrace tool from Sun in FreeBSD. Dynamic tracing can help locate performance issues, by performing real time system analysis. Chapter 27, Serial Communications Explains how to connect terminals and modems to your FreeBSD system for both dial in and

18 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

dial out connections. Chapter 28, PPP and SLIP Describes how to use PPP, SLIP, or PPP over Ethernet to connect to remote systems with FreeBSD. Chapter 29, 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 30, 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 31, Firewalls Explains the philosophy behind software-based firewalls and provides detailed information about the configuration of the different firewalls available for FreeBSD. Chapter 32, 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, 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 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, Resources on the Internet Describes the many forums available for FreeBSD users to post questions and engage in technical conversations about FreeBSD. Appendix D, 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

19 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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

20 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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 2 Installing FreeBSD 9.X and Later 3 Installing FreeBSD 8.X and Earlier 4 UNIX Basics 5 Installing Applications: Packages and Ports 6 The X Window System

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.

21 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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, Sun UltraSPARC computers. Ports to other architectures are also underway. You can also read about the history of FreeBSD, or the current release. If you are interested in contributing something to the Project (code, hardware, funding), see the Contributing to FreeBSD 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 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.

22 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

SMP support for machines with multiple CPUs. A full complement of C and C++ 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: FTP servers World Wide Web servers (standard or secure [SSL]) IPv4 and IPv6 routing Firewalls and NAT (IP masquerading) gateways Electronic Mail servers USENET News or Bulletin Board Systems 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

23 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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 CD-ROM, DVD, and via anonymous FTP. Please see Appendix A for more information about obtaining FreeBSD.

1.2.2 Who Uses FreeBSD?


FreeBSD is used as a platform for devices and products from many of the world's largest IT companies, including: Apple Cisco Juniper NetApp FreeBSD is also used to power some of the biggest sites on the Internet, including: Yahoo! Yandex Apache Rambler Sina Pair Networks Sony Japan

24 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Netcraft NetEase Weathernews TELEHOUSE America Experts Exchange 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 386BSDPatchkit 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 CD-ROM (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.

25 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

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 CD-ROM (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 5.5-RELEASE release came out in May 2006. 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 6.4-RELEASE came out in November 2008. There will be no additional releases from the RELENG_6 branch. This branch is the last branch to support the Alpha architecture.

26 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

The RELENG_7 branch was created in October 2007. The first release of this branch was 7.0-RELEASE, which came out in February 2008. The most recent 7.4-RELEASE came out in February 2011. There will be no additional releases from the RELENG_7 branch. The tree was branched again in August 2009, this time for RELENG_8. 8.0-RELEASE, the first release of the 8.X branch, was released in November 2009. The most recent 8.3-RELEASE came out in April 2012. There will be additional releases from the RELENG_8 branch. The RELENG_9 branch was created in September 2011. The first release of this branch was 9.0-RELEASE, which came out in January 2012. The most recent 9.1-RELEASE came out in December 2012. There will be additional releases from the RELENG_9 branch. For now, long-term development projects continue to take place in the 10.X-CURRENT (trunk) branch, and SNAPshot releases of 10.X on CD-ROM (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. 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 SVN repositories For several years, the central source tree for FreeBSD was maintained by CVS (Concurrent Versions System), a freely available source code control tool that comes bundled with FreeBSD. In June 2008, the Project switched to using SVN (Subversion). The switch was deemed necessary, as the technical limitations imposed by CVS were becoming obvious due

27 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

to the rapid expansion of the source tree and the amount of history already stored. The Documentation Project and Ports Collection repositories also moved from CVS to SVN in May 2012 and July 2012, respectively. Please refer to the Synchronizing your source tree section for more information on obtaining the FreeBSD src/ repository and Using the Ports Collection for details on obtaining the FreeBSD Ports Collection. The committers list The committers are the people who have write access to the Subversion tree, and are authorized to make modifications to the FreeBSD source (the term committer comes from the source control commit command, which is used to bring new changes into the 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 2012. 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 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 for more information about the various FreeBSD mailing lists. The FreeBSD Contributors List 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. 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

28 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

to present a stable operating system with a large set of coherent application programs 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, 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 24,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 500 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 CD-ROM 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 5. All recent FreeBSD versions provide an option in the installer (either sysinstall(8) or bsdinstall(8)) to install additional documentation under /usr/local/share/doc/freebsd during the initial system setup. Documentation may also be installed at any later time using packages as described in Section 25.4.6.2. You may view the locally installed manuals with any HTML capable browser using the following URLs: The FreeBSD Handbook
/usr/local/share/doc/freebsd/handbook/index.html

The FreeBSD FAQ


/usr/local/share/doc/freebsd/faq/index.html

You can also view the master (and most frequently updated) copies at http://www.FreeBSD.org/.

29 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Chapter 2 Installing FreeBSD 9.X and Later


Restructured, reorganized, and parts rewritten by Jim Mock. The sysinstall walkthrough, screenshots, and general copy by Randy Pratt. Updated for bsdinstall by Gavin Atkinson and Warren Block.

2.1 Synopsis
FreeBSD comes with a text-based, easy to use installation program. FreeBSD 9.0-RELEASE and later use an installation program called bsdinstall, while releases prior to FreeBSD 9.0-RELEASE using sysinstall for installation. This chapter describes the use of bsdinstall. The use of sysinstall is covered in Chapter 3. After reading this chapter, you will know: How to create the FreeBSD installation media. How FreeBSD subdivides and refers to hard disks. How to start bsdinstall. The questions bsdinstall 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 will be listed. There may be minor differences between the installer and what is shown here, so use this chapter as a general guide rather than as exact literal instructions.

2.2 Hardware Requirements


2.2.1 Minimal Configuration
The minimal configuration to install FreeBSD varies with the FreeBSD version and the hardware architecture. 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 supported CDROM drive, and in some cases a network adapter. This will be covered by Section 2.3.5. 2.2.1.1 FreeBSD/i386 FreeBSD/i386 requires a 486 or better processor and at least 64 MB of RAM. At least 1.1 GB of free hard drive space is needed for the most minimal installation.

30 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Note: On old computers, increasing RAM and hard drive space is usually more effective at improving performance than installing a faster processor.

2.2.1.2 FreeBSD/amd64 There are two classes of processors capable of running FreeBSD/amd64. The first are AMD64 processors, including the AMD Athlon64, 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, Extreme processor families, the Intel Xeon 3000, 5000, and 7000 sequences of processors, and the Intel Core i3, i5 and i7 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 for which we have not yet found a workaround. 2.2.1.3 FreeBSD/powerpc Apple Macintosh All New World Apple Macintosh systems with built-in USB are supported. SMP is supported on machines with multiple CPUs. A 32-bit kernel can only use the first 2 GB of RAM. FireWire is not supported on the Blue & White PowerMac G3. 2.2.1.4 FreeBSD/sparc64 Systems supported by FreeBSD/sparc64 are listed at the FreeBSD/sparc64 Project. A dedicated disk is required for FreeBSD/sparc64. It is not possible to share a disk with another operating system at this time.

2.2.2 Supported Hardware


Hardware architectures and devices supported by a FreeBSD release are listed in the Hardware Notes file. Usually named HARDWARE.TXT, the file is located in the root directory of the release media. Copies of the supported hardware list are also available on the Release Information page of the FreeBSD web site.

2.3 Pre-Installation Tasks


2.3.1 Back Up Your Data
Back up all important data on the target computer where FreeBSD will be installed. Test the backups before continuing. The FreeBSD installer will ask before making changes to the disk, but once the process has started it cannot be undone.

31 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

2.3.2 Decide Where to Install FreeBSD


If FreeBSD will be the only operating system installed, and will be allowed to use the entire hard disk, the rest of this section can be skipped. But if FreeBSD will share the disk with other operating systems, an understanding of disk layout is useful during the installation. 2.3.2.1 Disk Layouts for FreeBSD/i386 and FreeBSD/amd64 Hard disks can be divided into multiple sections. These sections are called partitions. There are two ways of dividing a disk into partitions. A traditional Master Boot Record (MBR) holds a partition table defining up to four primary partitions. (For historical reasons, FreeBSD calls primary partitions slices.) A limit of only four partitions is restrictive for large disks, so one of these primary partitions can be made into an extended partition. Multiple logical partitions may then be created inside the extended partition. This may sound a little unwieldy, and it is. The GUID Partition Table (GPT) is a newer and simpler method of partitioning a disk. GPT is far more versatile than the traditional MBR partition table. Common GPT implementations allow up to 128 partitions per disk, eliminating the need for inconvenient workarounds like logical partitions. Warning: Some older operating systems like Windows XP are not compatible with the GPT partition scheme. If FreeBSD will be sharing a disk with such an operating system, MBR partitioning is required. FreeBSD's standard boot loader requires either a primary or GPT partition. (See Chapter 13 for more information about the FreeBSD booting process.) If all of the primary or GPT partitions are already in use, one must be freed for FreeBSD. A minimal installation of FreeBSD takes as little as 1 GB of disk space. However, that is a very minimal install, leaving almost no free space. A more realistic minimum is 3 GB without a graphical environment, and 5 GB or more if a graphical user interface will be used. Third-party application software requires more space. A variety of free and commercial partition resizing tools are available. GParted Live is a free Live CD which includes the GParted partition editor. GParted is also included with many other Linux Live CD distributions. Warning: Disk partition applications can destroy data. Make a full backup and verify its integrity before modifying disk partitions. Resizing Microsoft Vista partitions can be difficult. A Vista installation CDROM can be useful when attempting such an operation.

Example 2-1. Using an Existing Partition A Windows computer has a single 40 GB disk that has been split into two 20 GB partitions. Windows calls them C: and D:. The C: partition contains 10 GB of data, and the D: partition contains 5 GB of data.

32 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Moving the data from D: to C: frees up the second partition to be used for FreeBSD.

Example 2-2. Shrinking an Existing Partition A Windows computer has a single 40 GB disk and one large partition using the whole disk. Windows shows this 40 GB partition as a single C:. 15 GB of space is being used. The goal is to end up with Windows in a 20 GB partition, and have another 20 GB partition for FreeBSD. There are two ways to do this: 1. Back up your Windows data. Then reinstall Windows, creating a 20 GB partition during the install. 2. Use a partition resizing tool like GParted to shrink the Windows partition and create a new partition in the freed space for FreeBSD.

Disk partitions containing different operating systems make it possible to run any one of those operating systems at a time. An alternative method that allows running multiple operating systems at the same time is covered in Chapter 23.

2.3.3 Collect Network Information


Some FreeBSD installation methods need a network connection to download files. To connect to an Ethernet network (or cable or DSL modem with an Ethernet interface), the installer will request some information about the network. DHCP is commonly used to provide automatic network configuration. If DHCP is not available, this network information must be obtained from the local network administrator or service provider: Network Information 1. IP address 2. Subnet mask 3. Default router IP address 4. Domain name of the local network 5. DNS server IP address(es)

2.3.4 Check for FreeBSD Errata


Although the FreeBSD Project strives to ensure that each release of FreeBSD is as stable as possible, bugs 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 on the FreeBSD web site. Check the errata before installing to make sure that there are no problems that might affect the installation.

33 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Information and errata for all the releases can be found on the release information section of the FreeBSD web site.

2.3.5 Prepare the Installation Media


A FreeBSD installation is started by booting the computer with a FreeBSD installation CD, DVD, or USB memory stick. The installer is not a program that can be run from within another operating system. In addition to the standard installation media which contains copies of all the FreeBSD installation files, there is a bootonly variant. Bootonly install media does not have copies of the installation files, but downloads them from the network during an install. The bootonly install CD is consequently much smaller, and reduces bandwidth usage during the install by only downloading required files. Copies of FreeBSD installation media are available at the FreeBSD web site. Tip: If you already have a copy of FreeBSD on CDROM, DVD, or USB memory stick, this section can be skipped. FreeBSD CD and DVD images are bootable ISO files. Only one CD or DVD is needed for an install. Burn the ISO image to a bootable CD or DVD using the CD recording applications available with your current operating system. To create a bootable memory stick, follow these steps: 1. Acquire the Memory Stick Image Memory stick images for FreeBSD 9.0-RELEASE and later can be downloaded from the ISO-IMAGES/ directory at ftp://ftp.FreeBSD.org/pub/FreeBSD/releases
/arch/arch/ISO-IMAGES/version/FreeBSD-version-RELEASE-arch-memstick.img. Replace arch and version with the architecture and the version number which you

want to install, respectively. For example, the memory stick images for FreeBSD/i386 9.0-RELEASE are available from ftp://ftp.FreeBSD.org/pub/FreeBSD /releases/i386/i386/ISO-IMAGES/9.0/FreeBSD-9.0-RELEASE-i386-memstick.img. Tip: A different directory path is used for FreeBSD 8.X and earlier versions. Details of download and installation of FreeBSD 8.X and earlier is covered in Chapter 3. The memory stick image has a .img extension. The ISO-IMAGES/ directory contains a number of different images, and the one needed depends on the version of FreeBSD being installed, and in some cases, the target hardware. Important: Before proceeding, back up the data on the USB stick, as this procedure will erase it. 2. Write the Image File to the Memory Stick

34 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Using FreeBSD to Write the Image Warning: The example below shows /dev/da0 as the target device where the image will be written. Be very careful that the correct device is used as the output target, or you may destroy existing data. 1. Writing the Image with dd(1) The .img file is not a regular file. It is an image of the complete contents of the memory stick. It cannot simply be copied like a regular file, but must be written directly to the target device with dd(1):
# dd if=FreeBSD-9.0-RELEASE-i386-memstick.img of=/dev/da0 bs=64k

Using Windows to Write the Image Warning: Be sure to give the correct drive letter as the output target, or you may overwrite and destroy existing data. 1. Obtaining Image Writer for Windows Image Writer for Windows is a free application that can correctly write an image file to a memory stick. Download it from https://launchpad.net/win32image-writer/ and extract it into a folder. 2. Writing the Image with Image Writer Double-click the Win32DiskImager icon to start the program. Verify that the drive letter shown under Device is the drive with the memory stick. Click the folder icon and select the image to be written to the memory stick. Click [ Save ] to accept the image file name. Verify that everything is correct, and that no folders on the memory stick are open in other windows. When everything is ready, click [ Write ] to write the image file to the memory stick. Note: Installation from floppy disks is no longer supported. 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:
Your changes will now be written to disk. If you have chosen to overwrite existing data, it will be PERMANENTLY ERASED. Are you sure you want to commit your changes?

35 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

The install can be exited at any time prior to this 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 on i386 and amd64 1. If you prepared a bootable USB stick, as described in Section 2.3.5, then plug in your USB stick before turning on the computer. If you are booting from CDROM, then you will need to turn on the computer, and insert the CDROM at the first opportunity. 2. Configure your machine to boot from either the CDROM or from USB, depending on the media being used for the installation. BIOS configurations allow the selection of a specific boot device. Most systems also provide for selecting a boot device during startup, typically by pressing F10, F11, F12, or Escape. 3. 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. The Plop Boot Manager can be used to boot older computers from CD or USB media. 4. 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... 645MB medium detected 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.02 Consoles: internal video/keyboard BIOS CD is cd0 BIOS drive C: is disk0 BIOS drive D: is disk1 BIOS 636kB/261056kB 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] \

5. The FreeBSD boot loader is displayed:

36 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

Figure 2-1. FreeBSD Boot Loader Menu

Either wait ten seconds, or press Enter. 2.4.1.2 Booting for Macintosh PowerPC On most machines, holding C on the keyboard during boot will boot from the CD. Otherwise, hold Command+Option+O+F, or Windows+Alt+O+F on non-Apple keyboards. At the 0 > prompt, enter
boot cd:,\ppc\loader cd:0

For Xserves without keyboards, see Apple's support web site about booting into Open Firmware. 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:

37 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

ok ok {0}

This is the prompt used on systems with just one CPU. 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, although the precise text will differ depending on the devices that you have in your computer. Figure 2-2. Typical Device Probe Results

Copyright (c) 1992-2011 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 9.0-RELEASE #0 r225473M: Sun Sep 11 16:07:30 BST 2011 root@psi:/usr/obj/usr/src/sys/GENERIC amd64 CPU: Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz (2527.05-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x10676 Family = 6 Model = 17 Stepping = 6 Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CL Features2=0x8e3fd<SSE3,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1> AMD Features=0x20100800<SYSCALL,NX,LM> AMD Features2=0x1<LAHF> TSC: P-state invariant, performance statistics real memory = 3221225472 (3072 MB) avail memory = 2926649344 (2791 MB) Event timer "LAPIC" quality 400 ACPI APIC Table: <TOSHIB A0064 > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs FreeBSD/SMP: 1 package(s) x 2 core(s) cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 ioapic0: Changing APIC ID to 1 ioapic0 <Version 2.0> irqs 0-23 on motherboard kbd1 at kbdmux0 acpi0: <TOSHIB A0064> on motherboard acpi0: Power Button (fixed) acpi0: reservation of 0, a0000 (3) failed acpi0: reservation of 100000, b6690000 (3) failed Timecounter "ACPI-safe" frequency 3579545 Hz quality 850 acpi_timer0: <24-bit timer at 3.579545MHz> port 0xd808-0xd80b on acpi0 cpu0: <ACPI CPU> on acpi0 ACPI Warning: Incorrect checksum in table [ASF!] - 0xFE, should be 0x9A (20110527/tbutils-282) cpu1: <ACPI CPU> on acpi0 pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0 pci0: <ACPI PCI bus> on pcib0 vgapci0: <VGA-compatible display> port 0xcff8-0xcfff mem 0xff400000-0xff7fffff,0xe0000000-0xefff agp0: <Intel GM45 SVGA controller> on vgapci0 agp0: aperture size is 256M, detected 131068k stolen memory vgapci1: <VGA-compatible display> mem 0xffc00000-0xffcfffff at device 2.1 on pci0 pci0: <simple comms> at device 3.0 (no driver attached) em0: <Intel(R) PRO/1000 Network Connection 7.2.3> port 0xcf80-0xcf9f mem 0xff9c0000-0xff9dffff,0 em0: Using an MSI interrupt em0: Ethernet address: 00:1c:7e:6a:ca:b0 uhci0: <Intel 82801I (ICH9) USB controller> port 0xcf60-0xcf7f irq 16 at device 26.0 on pci0 usbus0: <Intel 82801I (ICH9) USB controller> on uhci0 uhci1: <Intel 82801I (ICH9) USB controller> port 0xcf40-0xcf5f irq 21 at device 26.1 on pci0

38 of 1605

3/12/2013 1:24 PM

FreeBSD Handbook

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html

usbus1: <Intel 82801I (ICH9) USB controller> on uhci1 uhci2: <Intel 82801I (ICH9) USB controller> port 0xcf20-0xcf3f irq 19 at device 26.2 on pci0 usbus2: <Intel 82801I (ICH9) USB controller> on uhci2 ehci0: <Intel 82801I (ICH9) USB 2.0 controller> mem 0xff9ff800-0xff9ffbff irq 19 at device 26.7 usbus3: EHCI version 1.0 usbus3: <Intel 82801I (ICH9) USB 2.0 controller> on ehci0 hdac0: <Intel 82801I High Definition Audio Controller> mem 0xff9f8000-0xff9fbfff irq 22 at devic pcib1: <ACPI PCI-PCI bridge> irq 17 at device 28.0 on pci0 pci1: <ACPI PCI bus> on pcib1 iwn0: <Intel(R) WiFi Link 5100> mem 0xff8fe000-0xff8fffff irq 16 at device 0.0 on pci1 pcib2: <ACPI PCI-PCI bridge> irq 16 at device 28.1 on pci0 pci2: <ACPI PCI bus> on pcib2 pcib3: <ACPI PCI-PCI bridge> irq 18 at device 28.2 on pci0 pci4: <ACPI PCI bus> on pcib3 pcib4: <ACPI PCI-PCI bridge> at device 30.0 on pci0 pci5: <ACPI PCI bus> on pcib4 cbb0: <RF5C476 PCI-CardBus Bridge> at device 11.0 on pci5 cardbus0: <CardBus bus> on cbb0 pccard0: <16-bit PCCard bus> on cbb0 isab0: <PCI-ISA bridge> at device 31.0 on pci0 isa0: <ISA bus> on isab0 ahci0: <Intel ICH9M AHCI SATA controller> port 0x8f58-0x8f5f,0x8f54-0x8f57,0x8f48-0x8f4f,0x8f44ahci0: AHCI v1.20 with 4 3Gbps ports, Port Multiplier not supported ahcich0: <AHCI channel> at channel 0 on ahci0 ahcich1: <AHCI channel> at channel 1 on ahci0 ahcich2: <AHCI channel> at channel 4 on ahci0 acpi_lid0: <Control Method Lid Switch> on acpi0 battery0: <ACPI Control Method Battery> on acpi0 acpi_button0: <Power Button> on acpi0 acpi_acad0: <AC Adapter> on acpi0 acpi_toshiba0: <Toshiba HCI Extras> on acpi0 acpi_tz0: <Thermal Zone> on acpi0 attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0 atkbd0: <AT Keyboard> irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model GlidePoint, device ID 0 atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0 Event timer "RTC" frequency 32768 Hz quality 0 hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0 Timecounter "HPET" frequency 14318180 Hz quality 950 Event timer "HPET" frequency 14318180 Hz quality 450 Event timer "HPET1" frequency 14318180 Hz quality 440 Event timer "HPET2" frequency 14318180 Hz quality 440 Event timer "HPET3" frequency 14318180 Hz quality 440 uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 sc0: <System console> at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 ppc0: cannot reserve I/O port range est0: <Enhanced SpeedStep Frequency Control> on cpu0 p4tcc0: <CPU Frequency Thermal Control> on cpu0 est1: <Enhanced SpeedStep Frequency Control> on cpu1 p4tcc1: <CPU Frequency Thermal Control> on cpu1 Timecounters tick every 1.000 msec hdac0: HDA Codec #0: Realtek ALC268 hdac0: HDA Codec #1: Lucent/Agere Systems (Unknown) pcm0: <HDA Realtek ALC268 PCM #0 Analog> at cad 0 nid 1 on hdac0 pcm1: <HDA Realtek ALC268 PCM #1 Analog> at cad 0 nid 1 on hdac0 usbus0: 12Mbps Full Speed USB v1.0 usbus1: 12Mbps Full Speed USB v1.0 usbus2: 12Mbps Full Speed USB v1.0 usbus3: 480Mbps High Speed USB v2.0 ugen0.1: <Intel> at usbus0 uhub0: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0 ugen1.1: <Intel> at usbus1 uhub1: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1 ugen2.1: <Intel> at usbus2 uhub2: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2 ugen3.1: <Intel> at usbus3 uhub3: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3 uhub0: 2 ports with 2 removable, self powered uhub1: 2 ports with 2 removable, self powered uhub2: 2 ports with 2 removable, self powered

39 of 1605

3/12/2013 1:24 PM

Você também pode gostar