FreeBSD Handbook

The FreeBSD Documentation Project

Revision: eab1c5d1f6
Copyright
Legal Notice
Last modified on 2021-01-12 19:33:23 +0100 by Daniel Ebdrup Jensen.
Abstract

Welcome to FreeBSD! This handbook covers the installation and day to day use of FreeBSD 12.2-RELEASE, FreeBSD 12.1-RELEASE, and FreeBSD 11.4-RELEASE. This book is the result of ongoing work by many individuals. Some sections might be outdated. Those interested in helping to update and expand this document should send email to the FreeBSD documentation project mailing list.

The latest version of this book is available from the FreeBSD web site. Previous versions can be obtained from https://docs.FreeBSD.org/doc/. The book can be downloaded in a variety of formats and compression options from the FreeBSD FTP server or one of the numerous mirror sites. Printed copies can be purchased at the FreeBSD Mall. Searches can be performed on the handbook and other documents on the search page.


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
2.1. Synopsis
2.2. Minimum Hardware Requirements
2.3. Pre-Installation Tasks
2.4. Starting the Installation
2.5. Using bsdinstall
2.6. Allocating Disk Space
2.7. Fetching Distribution Files
2.8. Accounts, Time Zone, Services and Hardening
2.9. Network Interfaces
2.10. Troubleshooting
2.11. Using the Live CD
3. FreeBSD Basics
3.1. Synopsis
3.2. Virtual Consoles and Terminals
3.3. Users and Basic Account Management
3.4. Permissions
3.5. Directory Structure
3.6. Disk Organization
3.7. Mounting and Unmounting File Systems
3.8. Processes and Daemons
3.9. Shells
3.10. Text Editors
3.11. Devices and Device Nodes
3.12. Manual Pages
4. Installing Applications: Packages and Ports
4.1. Synopsis
4.2. Overview of Software Installation
4.3. Finding Software
4.4. Using pkg for Binary Package Management
4.5. Using the Ports Collection
4.6. Building Packages with Poudriere
4.7. Post-Installation Considerations
4.8. Dealing with Broken Ports
5. The X Window System
5.1. Synopsis
5.2. Terminology
5.3. Installing Xorg
5.4. Xorg Configuration
5.5. Using Fonts in Xorg
5.6. The X Display Manager
5.7. Desktop Environments
5.8. Installing Compiz Fusion
5.9. Troubleshooting
II. Common Tasks
6. Desktop Applications
6.1. Synopsis
6.2. Browsers
6.3. Productivity
6.4. Document Viewers
6.5. Finance
7. Multimedia
7.1. Synopsis
7.2. Setting Up the Sound Card
7.3. MP3 Audio
7.4. Video Playback
7.5. TV Cards
7.6. MythTV
7.7. Image Scanners
8. Configuring the FreeBSD Kernel
8.1. Synopsis
8.2. Why Build a Custom Kernel?
8.3. Finding the System Hardware
8.4. The Configuration File
8.5. Building and Installing a Custom Kernel
8.6. If Something Goes Wrong
9. Printing
9.1. Quick Start
9.2. Printer Connections
9.3. Common Page Description Languages
9.4. Direct Printing
9.5. LPD (Line Printer Daemon)
9.6. Other Printing Systems
10. Linux® Binary Compatibility
10.1. Synopsis
10.2. Configuring Linux® Binary Compatibility
10.3. Advanced Topics
11. WINE
11.1. Synopsis
11.2. WINE Overview & Concepts
11.3. Installing WINE on FreeBSD
11.4. Running a First WINE Program on FreeBSD
11.5. Configuring WINE Installation
11.6. WINE Management GUIs
11.7. WINE in Multi-User FreeBSD Installations
11.8. WINE on FreeBSD FAQ
III. System Administration
12. Configuration and Tuning
12.1. Synopsis
12.2. Starting Services
12.3. Configuring cron(8)
12.4. Managing Services in FreeBSD
12.5. Setting Up Network Interface Cards
12.6. Virtual Hosts
12.7. Configuring System Logging
12.8. Configuration Files
12.9. Tuning with sysctl(8)
12.10. Tuning Disks
12.11. Tuning Kernel Limits
12.12. Adding Swap Space
12.13. Power and Resource Management
13. The FreeBSD Booting Process
13.1. Synopsis
13.2. FreeBSD Boot Process
13.3. Configuring Boot Time Splash Screens
13.4. Device Hints
13.5. Shutdown Sequence
14. Security
14.1. Synopsis
14.2. Introduction
14.3. One-time Passwords
14.4. TCP Wrapper
14.5. Kerberos
14.6. OpenSSL
14.7. VPN over IPsec
14.8. OpenSSH
14.9. Access Control Lists
14.10. Monitoring Third Party Security Issues
14.11. FreeBSD Security Advisories
14.12. Process Accounting
14.13. Resource Limits
14.14. Shared Administration with Sudo
15. Jails
15.1. Synopsis
15.2. Terms Related to Jails
15.3. Creating and Controlling Jails
15.4. Fine Tuning and Administration
15.5. Updating Multiple Jails
15.6. Managing Jails with ezjail
16. Mandatory Access Control
16.1. Synopsis
16.2. Key Terms
16.3. Understanding MAC Labels
16.4. Planning the Security Configuration
16.5. Available MAC Policies
16.6. User Lock Down
16.7. Nagios in a MAC Jail
16.8. Troubleshooting the MAC Framework
17. Security Event Auditing
17.1. Synopsis
17.2. Key Terms
17.3. Audit Configuration
17.4. Working with Audit Trails
18. Storage
18.1. Synopsis
18.2. Adding Disks
18.3. Resizing and Growing Disks
18.4. USB Storage Devices
18.5. Creating and Using CD Media
18.6. Creating and Using DVD Media
18.7. Creating and Using Floppy Disks
18.8. Backup Basics
18.9. Memory Disks
18.10. File System Snapshots
18.11. Disk Quotas
18.12. Encrypting Disk Partitions
18.13. Encrypting Swap
18.14. Highly Available Storage (HAST)
19. GEOM: Modular Disk Transformation Framework
19.1. Synopsis
19.2. RAID0 - Striping
19.3. RAID1 - Mirroring
19.4. RAID3 - Byte-level Striping with Dedicated Parity
19.5. Software RAID Devices
19.6. GEOM Gate Network
19.7. Labeling Disk Devices
19.8. UFS Journaling Through GEOM
20. The Z File System (ZFS)
20.1. What Makes ZFS Different
20.2. Quick Start Guide
20.3. zpool Administration
20.4. zfs Administration
20.5. Delegated Administration
20.6. Advanced Topics
20.7. Additional Resources
20.8. ZFS Features and Terminology
21. Other File Systems
21.1. Synopsis
21.2. Linux® File Systems
22. Virtualization
22.1. Synopsis
22.2. FreeBSD as a Guest on Parallels for Mac OS® X
22.3. FreeBSD as a Guest on Virtual PC for Windows®
22.4. FreeBSD as a Guest on VMware Fusion for Mac OS®
22.5. FreeBSD as a Guest on VirtualBox
22.6. FreeBSD as a Host with VirtualBox
22.7. FreeBSD as a Host with bhyve
22.8. FreeBSD as a Xen™-Host
23. Localization - i18n/L10n Usage and Setup
23.1. Synopsis
23.2. Using Localization
23.3. Finding i18n Applications
23.4. Locale Configuration for Specific Languages
24. Updating and Upgrading FreeBSD
24.1. Synopsis
24.2. FreeBSD Update
24.3. Updating the Documentation Set
24.4. Tracking a Development Branch
24.5. Updating FreeBSD from Source
24.6. Tracking for Multiple Machines
25. DTrace
25.1. Synopsis
25.2. Implementation Differences
25.3. Enabling DTrace Support
25.4. Using DTrace
26. USB Device Mode / USB OTG
26.1. Synopsis
26.2. USB Virtual Serial Ports
26.3. USB Device Mode Network Interfaces
26.4. USB Virtual Storage Device
IV. Network Communication
27. Serial Communications
27.1. Synopsis
27.2. Serial Terminology and Hardware
27.3. Terminals
27.4. Dial-in Service
27.5. Dial-out Service
27.6. Setting Up the Serial Console
28. PPP
28.1. Synopsis
28.2. Configuring PPP
28.3. Troubleshooting PPP Connections
28.4. Using PPP over Ethernet (PPPoE)
28.5. Using PPP over ATM (PPPoA)
29. Electronic Mail
29.1. Synopsis
29.2. Mail Components
29.3. Sendmail Configuration Files
29.4. Changing the Mail Transfer Agent
29.5. Troubleshooting
29.6. Advanced Topics
29.7. Setting Up to Send Only
29.8. Using Mail with a Dialup Connection
29.9. SMTP Authentication
29.10. Mail User Agents
29.11. Using fetchmail
29.12. 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)
30.5. Lightweight Directory Access Protocol (LDAP)
30.6. Dynamic Host Configuration Protocol (DHCP)
30.7. Domain Name System (DNS)
30.8. Apache HTTP Server
30.9. File Transfer Protocol (FTP)
30.10. File and Print Services for Microsoft® Windows® Clients (Samba)
30.11. Clock Synchronization with NTP
30.12. iSCSI Initiator and Target Configuration
31. Firewalls
31.1. Synopsis
31.2. Firewall Concepts
31.3. PF
31.4. IPFW
31.5. IPFILTER (IPF)
31.6. Blacklistd
32. Advanced Networking
32.1. Synopsis
32.2. Gateways and Routes
32.3. Wireless Networking
32.4. USB Tethering
32.5. Bluetooth
32.6. Bridging
32.7. Link Aggregation and Failover
32.8. Diskless Operation with PXE
32.9. IPv6
32.10. Common Address Redundancy Protocol (CARP)
32.11. VLANs
V. Appendices
A. Obtaining FreeBSD
A.1. CD and DVD Sets
A.2. FTP Sites
A.3. Using Subversion
A.4. Using rsync
B. Bibliography
B.1. Books 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. Periodicals, Journals, and Magazines
C. Resources on the Internet
C.1. Websites
C.2. Mailing Lists
C.3. Usenet Newsgroups
C.4. Official Mirrors
D. OpenPGP Keys
D.1. Officers
FreeBSD Glossary
Index
List of Figures
2.1. FreeBSD Boot Loader Menu
2.2. FreeBSD Boot Options Menu
2.3. Welcome Menu
2.4. Keymap Loading
2.5. Keymap Selection Menu
2.6. Keymap Testing Menu
2.7. Setting the Hostname
2.8. Selecting Components to Install
2.9. Installing from the Network
2.10. Partitioning Choices
2.11. Selecting from Multiple Disks
2.12. Selecting Entire Disk or Partition
2.13. Confirmation
2.14. Select Partition Scheme
2.15. Review Created Partitions
2.16. Final Confirmation
2.17. Manually Create Partitions
2.18. Manually Create Partitions
2.19. Manually Create Partitions
2.20. ZFS Partitioning Menu
2.21. ZFS Pool Type
2.22. Disk Selection
2.23. Invalid Selection
2.24. Rescan Devices
2.25. Analyzing a Disk
2.26. Pool Name
2.27. Swap Amount
2.28. Last Chance
2.29. Disk Encryption Password
2.30. Initializing Encryption
2.31. Fetching Distribution Files
2.32. Verifying Distribution Files
2.33. Extracting Distribution Files
2.34. Setting the root Password
2.35. Select a Region
2.36. Select a Country
2.37. Select a Time Zone
2.38. Confirm Time Zone
2.39. Select Date
2.40. Select Time
2.41. Selecting Additional Services to Enable
2.42. Selecting Hardening Security Options
2.43. Add User Accounts
2.44. Enter User Information
2.45. Exit User and Group Management
2.46. Final Configuration
2.47. Manual Configuration
2.48. Complete the Installation
2.49. Choose a Network Interface
2.50. Scanning for Wireless Access Points
2.51. Choosing a Wireless Network
2.52. WPA2 Setup
2.53. Choose IPv4 Networking
2.54. Choose IPv4 DHCP Configuration
2.55. IPv4 Static Configuration
2.56. Choose IPv6 Networking
2.57. Choose IPv6 SLAAC Configuration
2.58. IPv6 Static Configuration
2.59. DNS Configuration
2.60. Choosing a Mirror
32.1. PXE Booting Process with NFS Root Mount
List of Tables
2.1. Partitioning Schemes
3.1. Utilities for Managing User Accounts
3.2. UNIX® Permissions
3.3. Disk Device Names
3.4. Common Environment Variables
5.1. XDM Configuration Files
7.1. Common Error Messages
9.1. Output PDLs
13.1. Loader Built-In Commands
13.2. Kernel Interaction During Boot
14.1. Login Class Resource Limits
17.1. Default Audit Event Classes
17.2. Prefixes for Audit Event Classes
23.1. Common Language and Country Codes
23.2. Defined Terminal Types for Character Sets
23.3. Available Console from Ports Collection
23.4. Available Input Methods
24.1. FreeBSD Versions and Repository Paths
27.1. RS-232C Signal Names
27.2. DB-25 to DB-25 Null-Modem Cable
27.3. DB-9 to DB-9 Null-Modem Cable
27.4. DB-9 to DB-25 Null-Modem Cable
30.1. NIS Terminology
30.2. Additional Users
30.3. Additional Systems
30.4. DNS Terminology
31.1. Useful pfctl Options
32.1. Commonly Seen Routing Table Flags
32.2. Station Capability Codes
32.3. Reserved IPv6 Addresses
List of Examples
2.1. Creating Traditional Split File System Partitions
3.1. Install a Program As the Superuser
3.2. Adding a User on FreeBSD
3.3. rmuser Interactive Account Removal
3.4. Using chpass as Superuser
3.5. Using chpass as Regular User
3.6. Changing Your Password
3.7. Changing Another User's Password as the Superuser
3.8. Adding a Group Using pw(8)
3.9. Adding User Accounts to a New Group Using pw(8)
3.10. Adding a New Member to a Group Using pw(8)
3.11. Using id(1) to Determine Group Membership
3.12. Sample Disk, Slice, and Partition Names
3.13. Conceptual Model of a Disk
5.1. Select Intel® Video Driver in a File
5.2. Select Radeon Video Driver in a File
5.3. Select VESA Video Driver in a File
5.4. Select scfb Video Driver in a File
5.5. Set Screen Resolution in a File
5.6. Manually Setting Monitor Frequencies
5.7. Setting a Keyboard Layout
5.8. Setting Multiple Keyboard Layouts
5.9. Enabling Keyboard Exit from X
5.10. Setting the Number of Mouse Buttons
12.1. Sample Log Server Configuration
12.2. Creating a Swap File
13.1. boot0 Screenshot
13.2. boot2 Screenshot
13.3. Configuring an Insecure Console in /etc/ttys
14.1. Create a Secure Tunnel for SMTP
14.2. Secure Access of a POP3 Server
14.3. Bypassing a Firewall
15.1. mergemaster(8) on Untrusted Jail
15.2. mergemaster(8) on Trusted Jail
15.3. Running BIND in a Jail
18.1. Using dump over ssh
18.2. Using dump over ssh with RSH Set
18.3. Backing Up the Current Directory with tar
18.4. Restoring Up the Current Directory with tar
18.5. Using ls and cpio to Make a Recursive Backup of the Current Directory
18.6. Backing Up the Current Directory with pax
19.1. Labeling Partitions on the Boot Disk
24.1. Increasing the Number of Build Jobs
27.1. Configuring Terminal Entries
30.1. Reloading the inetd Configuration File
30.2. Mounting an Export with autofs(5)
30.3. Sample /etc/ntp.conf
32.1. LACP Aggregation with a Cisco® Switch
32.2. Failover Mode
32.3. Failover Mode Between Ethernet and Wireless Interfaces

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.