text:
Copyright © 1995-2014 The FreeBSD Documentation Project
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:
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.
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.
FreeBSD is a registered trademark of the FreeBSD Foundation.
3Com and HomeConnect are registered trademarks of 3Com Corporation.
3ware is a registered trademark of 3ware Inc.
ARM is a registered trademark of ARM Limited.
Adaptec is a registered trademark of Adaptec, Inc.
Adobe, Acrobat, Acrobat Reader, Flash 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.
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, 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.
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.
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.
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.
Sun, Sun Microsystems, Java, Java Virtual Machine, JDK, JRE, JSP, JVM, Netra, OpenJDK, Solaris, StarOffice, SunOS and VirtualBox are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
MATLAB is a registered trademark of The MathWorks, Inc.
SpeedTouch is a trademark of Thomson.
U.S. Robotics and Sportster are registered trademarks of U.S. Robotics Corporation.
VMware is a trademark of VMware, Inc.
Waterloo Maple and Maple are trademarks or registered trademarks of Waterloo Maple Inc.
Mathematica is a registered trademark of Wolfram Research, Inc.
XFree86 is a trademark of The XFree86 Project, Inc.
Ogg Vorbis and Xiph.Org are trademarks of Xiph.Org.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and the FreeBSD Project was aware of the trademark claim, the designations have been followed by the "™" or the "®" symbol.
Welcome to FreeBSD! This handbook covers the installation
and day to day use of
FreeBSD 8.4-RELEASE and
FreeBSD 9.2-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
Mall. You may also want to
search the
Interactive Account
as Regular
ssh with RSH
and cpio
to Make a Recursive Backup of the Current Directorypax
to Mount an Existing
File System Imagemdconfig
The FreeBSD newcomer will find that the first section of this book guides the user through the FreeBSD installation process and gently introduces the concepts and conventions that underpin UNIX®. Working through this section requires little more than the desire to explore, and the ability to take on board new concepts as they are introduced.
Once you have traveled this far, the second, far larger, section of the Handbook is a comprehensive reference to all manner of topics of interest to FreeBSD system administrators. Some of these chapters may recommend that you do some prior reading, and this is noted in the synopsis at the beginning of each chapter.
For a list of additional sources of information, please see Appendix B, Bibliography.
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 24, DTrace has been added with information about the powerful DTrace performance analysis tool.
Chapter 20, File Systems Support has been added with information about non-native file systems in FreeBSD, such as ZFS from Sun™.
Chapter 17, Security Event Auditing has been added to cover the new auditing capabilities in FreeBSD and explain its use.
Chapter 21, Virtualization has been added with information about installing FreeBSD on virtualization software.
Chapter 2, Installing FreeBSD 9.X
Later has been added to cover
installation of FreeBSD using the new installation utility,
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
system utility, and more kernel tuning
Chapter 14, Security has been expanded with new information about virtual private networks (VPNs), file system access control lists (ACLs), and security advisories.
Chapter 16, Mandatory Access Control is a new chapter with this edition. It explains what MAC is and how this mechanism can be used to secure a FreeBSD system.
Chapter 18, Storage has been expanded with new information about USB storage devices, file system snapshots, file system quotas, file and network backed filesystems, and encrypted disk partitions.
A troubleshooting section has been added to Chapter 26, PPP.
Chapter 27, Electronic Mail has been expanded with new information about using alternative transport agents, SMTP authentication, UUCP, fetchmail, procmail, and other advanced topics.
Chapter 28, 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 30, Advanced Networking were moved here to improve the presentation.
Chapter 30, 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.
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 8.X
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: Packages and Ports 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.
Chapter 18, 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 25, Serial Communications has been completely reorganized and updated for FreeBSD 4.X/5.X.
Chapter 26, PPP has been substantially updated.
Many new sections have been added to Chapter 30, Advanced Networking.
Chapter 27, Electronic Mail has been expanded to include more information about configuring sendmail.
Chapter 11, Linux® Binary Compatibility has been expanded to include information about installing Oracle® and SAP® R/3®.
The following new topics are covered in this second edition:
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.
Introduces FreeBSD to a new user. It describes the history of the FreeBSD Project, its goals and development model.
LaterWalks a user through the entire installation process of
FreeBSD 9.x
and later using
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.
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.
Covers the installation of third-party software with both FreeBSD's innovative "Ports Collection" and standard binary packages.
Describes the X Window System in general and using X11 on FreeBSD in particular. Also describes common and desktop environments such as KDE GNOME.
Lists some common desktop applications, such as web browsers and productivity suites, and describes how to install them on FreeBSD.
Shows how to set up sound and video playback support for your system. Also describes some sample audio and video applications.
Explains why you might need to configure a new kernel and provides detailed instructions for configuring, building, and installing a custom kernel.
Describes managing printers on FreeBSD, including information about banner pages, printer accounting, and initial setup.
Describes the Linux® compatibility features of FreeBSD. Also provides detailed installation instructions for many popular Linux® applications such as Oracle® and Mathematica®.
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.
Describes the FreeBSD boot process and explains how to control this process with configuration options.
Describes many different tools available to help keep your FreeBSD system secure, including Kerberos, IPsec and OpenSSH.
Describes the jails framework, and the improvements of jails over the traditional chroot support of FreeBSD.
Explains what Mandatory Access Control (MAC) is and how this mechanism can be used to secure a FreeBSD system.
Describes what FreeBSD Event Auditing is, how it can be installed, configured, and how audit trails can be inspected or monitored.
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.
Describes what the GEOM framework in FreeBSD is and how to configure various supported RAID levels.
Examines support of non-native file systems in FreeBSD, like the Z File System from Sun™.
Describes what virtualization systems offer, and how they can be used with FreeBSD.
Describes how to use FreeBSD in languages other than English. Covers both system and application level localization.
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.
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.
Explains how to connect terminals and modems to your FreeBSD system for both dial in and dial out connections.
Describes how to use PPP to connect to remote systems with FreeBSD.
Explains the different components of an email server and dives into simple configuration topics for the most popular mail server software: sendmail.
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.
Explains the philosophy behind software-based firewalls and provides detailed information about the configuration of the different firewalls available for FreeBSD.
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.
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.
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.
Describes the many forums available for FreeBSD users to post questions and engage in technical conversations about FreeBSD.
Lists the PGP fingerprints of several FreeBSD Developers.
To provide a consistent and easy to read text, several conventions are followed throughout the book.
An italic font is used for filenames, URLs, emphasized text, and the first usage of technical terms.
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.
A bold font is used for applications, commands, and keys.
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:
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 starting with C:\>
indicate a MS-DOS® command. Unless otherwise noted, these
commands may be executed from a "Command Prompt"
window in a modern Microsoft® Windows®
Examples starting with #
indicate a command that
must be invoked as the superuser in FreeBSD. You can login as
to type the command, or login as your
normal account and use su(1) to gain
superuser privileges.
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.
The book you are holding represents the efforts of many hundreds of people around the world. Whether they sent in fixes for typos, or submitted complete chapters, all the contributions have been useful.
Several companies have supported the development of this document by paying authors to work on it full-time, paying for publication, etc. In particular, BSDi (subsequently acquired by Wind River Systems) paid members of the FreeBSD Documentation Project to work on improving this book full time leading up to the publication of the first printed edition in March 2000 (ISBN 1-57176-241-8). Wind River Systems then paid several additional authors to make a number of improvements to the print-output infrastructure and to add additional chapters to the text. This work culminated in the publication of the second printed edition in November 2001 (ISBN 1-57176-303-1). In 2003-2004, FreeBSD Mall, Inc, paid several contributors to improve the Handbook in preparation for the third printed edition.
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.
Thank you for your interest in FreeBSD! The following chapter covers various aspects of the FreeBSD Project, such as its history, goals, development model, and so on.
After reading this chapter, you will know:
How FreeBSD relates to other computer operating systems.
The history of the FreeBSD Project.
The goals of the FreeBSD Project.
The basics of the FreeBSD open-source development model.
And of course: where the name "FreeBSD" comes from.
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.
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.
The industry standard X Window System (X11R7) can provide a graphical user interface (GUI) on any machine 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.
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. FreeBSD offers performance and reliability on par with commercial offerings, combined with many cutting-edge features not available anywhere else.
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:
Education: Are you a student of computer science or a related engineering field? There is no better way of learning about operating systems, computer architecture and networking than the hands on, under the hood experience that FreeBSD can provide. A number of freely available CAD, mathematical and graphic design packages also make it highly useful to those whose primary interest in a computer is to get other work done!
Research: With source code for the entire system available, FreeBSD is an excellent platform for research in operating systems as well as other branches of computer science. FreeBSD's freely available nature also makes it possible for remote groups to collaborate on ideas or shared development without having to worry about special licensing agreements or limitations on what may be discussed in open forums.
Networking: Need a new router? A name server (DNS)? A firewall to keep people out of your internal network? FreeBSD can easily turn that unused PC sitting in the corner into an advanced router with sophisticated packet-filtering capabilities.
Embedded: FreeBSD makes an excellent platform to build embedded systems upon. With support for the ARM®, MIPS® and PowerPC® platforms, coupled with a robust network stack, cutting edge features and the permissive BSD license FreeBSD makes an excellent foundation for building embedded routers, firewalls, and other devices.
Desktop: FreeBSD makes a fine choice for an inexpensive desktop solution using the freely available X11 server. FreeBSD offers a choice from many open-source desktop environments, including the standard GNOME and KDE graphical user interfaces. FreeBSD can even boot "diskless" from a central server, making individual workstations even cheaper and easier to administer.
Software Development: The basic FreeBSD system comes with a full complement of development tools including a full C/C++ compiler and debugger suite. Support for many other languages are also available through the ports and packages collection.
FreeBSD is available to download free of charge, or can be obtained on either CD-ROM or DVD. Please see Appendix A, Obtaining FreeBSD for more information about obtaining FreeBSD.
FreeBSD's advanced features, proven security, and predictable release cycle, as well as its permissive license have lead to its use as a platform for building many commericial and open source appliances, devices, and products, including those from many of the world's largest IT companies:
Apache - The Apache Software Foundation runs most of its public facing infrastructure, including possibly one of the largest SVN repositories in the world with over 1.4 million commits, on FreeBSD.
Apple - OS X borrows heavily from FreeBSD for the network stack, virtual file system, and many userland components. Apple iOS also contains elements borrowed from FreeBSD.
Cisco - IronPort network security and anti-spam appliances run a modified FreeBSD kernel.
Citrix - The NetScaler line of security appliances provide layer 4-7 load balancing, content caching, application firewall, secure VPN, and mobile cloud network access, along with the power of a FreeBSD shell.
Dell KACE - The KACE system management appliances run FreeBSD because of its reliability, scalability, and the community that supports its continued development.
Experts Exchange - All public facing web servers are powered by FreeBSD and they make extensive use of jails to isolate development and testing environments without the overhead of virtualization.
Isilon - Isilon's enterprise storage appliances are based on FreeBSD. The extremely liberal FreeBSD license allowed Isilon to integrate their intellectual property throughout the kernel and focus on building their product instead of an operating system.
iXsystems - The TrueNAS line of unified storage appliances is based on FreeBSD. In addition to their commercial products, iXsystems also manages development of the open source projects PC-BSD and FreeNAS.
Juniper - The JunOS operating system that powers all Juniper networking gear (including routers, switches, security, and networking appliances) is based on FreeBSD. Juniper is one of many vendors that showcases the symbiotic relationship between the project and vendors of commercial products. Improvements generated at Juniper are upstreamed into FreeBSD to reduce the complexity of integrating new features from FreeBSD back into JunOS in the future.
McAfee - SecurOS, the basis of McAfee enterprise firewall products including Sidewinder is based on FreeBSD.
NetApp - The Data ONTAP GX line of storage appliances are based on FreeBSD. In addition, NetApp has contributed back many features, including the new BSD licensed hypervisor, bhyve.
Netflix - The OpenConnect appliance that Netflix uses to stream movies to its customers is based on FreeBSD. Netflix has make extensive contributions to the codebase and works to maintain a zero delta from mainline FreeBSD. Netflix OpenConnect appliances are responsible for delivering more than 32% of all Internet traffic in North America.
Sandvine - Sandvine uses FreeBSD as the basis of their high performance realtime network processing platforms that make up their intelligent network policy control products.
Sony - The PlayStation 4 gaming console runs a modified version of FreeBSD.
Sophos - The Sophos Email Appliance product is based on a hardened FreeBSD and scans inbound mail for spam and viruses, while also monitoring outbound mail for malware as well as the accidental loss of sensitive information.
Spectra Logic - The nTier line of archive grade storage appliances run FreeBSD and OpenZFS.
The Weather Channel - The IntelliStar appliance that is installed at each local cable providers headend and is responsible for injecting local weather forecasts into the cable TV network's programming runs FreeBSD.
Verisign - Verisign is responsible for operating the .com and .net root domain registries as well as the accompanying DNS infrastructure. They rely on a number of different network operating systems including FreeBSD to ensure there is no common point of failure in their infrastructure.
WhatsApp - When WhatsApp needed a platform that would be able to handle more than 1 million concurrent TCP connections per server, they chose FreeBSD. They then proceeded to scale past 2.5 million connections per server.
Wheel Systems - The FUDO security appliance allows enterprises to monitor, control, record, and audit contractors and administrators who work on their systems. Based on all of the best security features of FreeBSD including ZFS, GELI, Capsicum, HAST, and auditdistd.
FreeBSD has also spawned a number of related open source projects:
BSD Router - A FreeBSD based replacement for large enterprise routers designed to run on standard PC hardware.
FreeNAS - A customized FreeBSD designed to be used as a network file server appliance. Provides a python based web interface to simplify the management of both the UFS and ZFS file systems. Includes support for NFS, SMB/CIFS, AFP, FTP, and iSCSI. Includes an extensible plugin system based on FreeBSD jails.
GhostBSD - A desktop oriented distribution of FreeBSD bundled with the Gnome desktop environment.
mfsBSD - A toolkit for building a FreeBSD system image that runs entirely from memory.
NAS4Free - A file server distribution based on FreeBSD with a PHP powered web interface.
PC-BSD - A customized version of FreeBSD geared towards desktop users with graphical utilities to exposing the power of FreeBSD to all users. Designed to ease the transition of Windows and OS X users.
pfSense - A firewall distribution based on FreeBSD with a huge array of features and extensive IPv6 support.
m0n0wall - A stripped down version of FreeBSD bundled with a web server and PHP. Designed as an embedded firewall appliance with a footprint of less than 12 MB.
ZRouter - An open source alternative firmware for embedded devices based on FreeBSD. Designed to replace the proprietary firmware on off-the-shelf routers.
FreeBSD is also used to power some of the biggest sites on the Internet, including:
and many more. Wikipedia also maintains a list of products based on FreeBSD
The following section provides some background information on the project, including a brief history, project goals, and the development model of the project.
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 Jordan Hubbard.
The 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. The early working title for the project was 386BSD 0.5 or 386BSD Interim in reference of 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, they 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.
The trio thought that the goal remained worthwhile, even without Bill's support, and so they adopted the name "FreeBSD" coined by David Greenman. The 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, Jordan 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 they followed it with the highly successful FreeBSD 1.1 release in May of 1994.
Around this time, some rather unexpected storm clouds formed on the horizon as Novell and U.C. Berkeley settled their long-running lawsuit over the legal status of the Berkeley Net/2 tape. A condition of that settlement was U.C. Berkeley's concession that large parts of Net/2 were "encumbered" code and the property of Novell, who had in turn acquired it from AT&T some time previously. What Berkeley got in return was Novell's "blessing" that the 4.4BSD-Lite release, when it was finally released, would be declared unencumbered and all existing Net/2 users would be strongly encouraged to switch. This included FreeBSD, and the project was given until the end of July 1994 to stop shipping its own Net/2 based product. Under the terms of that agreement, the project was allowed one last release before the deadline, that release being FreeBSD 184.108.40.206.
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, and in December it released FreeBSD 2.0 to the world. 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.
Since that time, FreeBSD has made a series of releases each time improving the stability, speed, and feature set of the previous version.
For now, long-term development projects continue to take place in the 10.X-CURRENT (trunk) branch, and snapshot releases of 10.X are continually made available from the snapshot server as work progresses.
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.
The development of FreeBSD is a very open and flexible process, being literally built from the contributions of thousands of people around the world, as can be seen from our list of contributors. FreeBSD's development infrastructure allow these thousands of contributors 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:
For several years, the central source tree for FreeBSD
was maintained by
(Concurrent Versions System), a freely available source
code control tool. 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
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
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 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.
Like most developers, most members of the core team are also 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!
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, Resources on the Internet 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 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!
In addition to the base distributions, FreeBSD offers a
ported software collection with thousands of commonly
sought-after programs. At the time of this writing, there
were over 24,000 ports! The list of ports ranges from
http servers, to games, languages, editors, and almost
everything in between. The entire Ports Collection requires
approximately 500 MB. 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 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
) 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, Installing Applications: Packages and Ports.
All recent FreeBSD versions provide an option in the
installer (either sysinstall(8) or bsdinstall(8)) to
install additional documentation under
during the
initial system setup. Documentation may also be installed at
any later time using packages as described in
Section 126.96.36.199, "Using Documentation Packages". You may view the
locally installed manuals with any HTML capable browser using
the following URLs:
You can also view the master (and most frequently updated)
copies at http://www.FreeBSD.org/
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, Installing FreeBSD 8.X
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.
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.
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, "Prepare the Installation Media".
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.
On old computers, increasing RAM and hard drive space is usually more effective at improving performance than installing a faster processor.
There are two classes of processors capable of running FreeBSD/amd64. The first are AMD64 processors, including the AMD Athlon™64, AMD Athlon™64-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.
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.
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.
Hardware architectures and devices supported by a FreeBSD
release are listed in the Hardware Notes file. Usually named
, 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.
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.
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.
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.
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, The FreeBSD Booting Process 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.
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.
A Windows® computer has a single 40 GB disk that
has been split into two 20 GB partitions. Windows®
calls them C:
. The
partition contains 10 GB
of data, and the D:
contains 5 GB of data.
Moving the data from D:
frees up the second partition
to be used for FreeBSD.
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
. 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:
Back up your Windows® data. Then reinstall Windows®, creating a 20 GB partition during the install.
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 21, Virtualization.
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:
IP address
Subnet mask
Default router IP address
Domain name of the local network
DNS server IP address(es)
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.
Information and errata for all the releases can be found on the release information section of the FreeBSD web site.
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. Also download
from the same directory
as the image file, and use it to check the image file's
integrity by calculating a checksum.
FreeBSD provides sha256(1) for this, while other operating
systems have similar programs. Compare the calculated
checksum with the one shown in
. The checksums must
match exactly. If the checksums do not match, the file is
corrupt and should be discarded.
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. On FreeBSD,
recording is provided by cdrecord(1) from
, installed
from the Ports Collection.
To create a bootable memory stick, follow these steps:
Acquire the Memory Stick Image
Memory stick images for FreeBSD 9.0-RELEASE and
later can be downloaded from the
directory at
Replace arch
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
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, Installing FreeBSD 8.X
The memory stick image has a .img
extension. The ISO-IMAGES/
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.
Before proceeding, back up the data on the USB stick, as this procedure will erase it.
Write the Image File to the Memory Stick
The example below shows
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.
Be sure to give the correct drive letter as the output target, or you may overwrite and destroy existing data.
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/win32-image-writer/
and extract it into a folder.
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
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 to
write the image file to the memory stick.
Installation from floppy disks is no longer supported.
You are now ready to start installing FreeBSD.
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?
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.
If you prepared a "bootable" USB stick, as described in Section 2.3.5, "Prepare the Installation Media", 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.
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.
If your computer starts up as normal and loads your existing operating system, then either:
The disks were not inserted early enough in the boot process. Leave them in, and try restarting your computer.
The BIOS changes earlier did not work correctly. You should redo that step until you get the right option.
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.
FreeBSD will start to boot. If you are booting from CDROM you will see a display similar to this (version information omitted):
The FreeBSD boot loader is displayed:
Either wait ten seconds, or press Enter.
On most machines, holding C on the
keyboard during boot will boot from the CD. Otherwise, hold
on non-Apple® keyboards. At the 0 >
prompt, enter
For Xserves without keyboards, see Apple®'s support web site about booting into Open Firmware.
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:
If your system proceeds to boot from disk at this point,
you need to press
on the keyboard, or send a BREAK
over the
serial console (using for example ~#
tip(1) or cu(1)) to get to the
prompt. It looks like this:
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
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, "Typical Device Probe Results", although the precise text will differ depending on the devices that you have in your computer.
Check the probe results carefully to make sure that FreeBSD
found all the devices you expected. If a device was not
found, then it will not be listed.
modules allows you to add in support for devices
which are not in the GENERIC
After the procedure of device probing, you will see Figure 2.3, "Selecting Installation Media Mode". The install media can be used in three ways: to install FreeBSD, as a live CD, or to simply access a FreeBSD shell. Use the arrow keys to choose an option, and Enter to select.
here will enter the installer.bsdinstall is a text-based FreeBSD
installer program written by Nathan Whitehorn <firstname.lastname@example.com>
and introduced
in 2011 for FreeBSD 9.0.
Kris Moore <email@example.com>
pc-sysinstall is included with
PC-BSD, and can
also be used to
install FreeBSD. Although sometimes confused with
bsdinstall, the two are not
The bsdinstall menu system is controlled by the arrow keys, Enter, Tab, Space, and other keys.
Depending on the system console being used, bsdinstall may initially prompt to select a non-default keyboard layout.
is selected, the following keyboard selection screen will be displayed. Otherwise, this selection menu will not be displayed, and a default keyboard mapping will be used.Select the keymap that most closely represents the mapping of the keyboard attached to the system, using the up/down arrow keys and pressing Enter.
Pressing Esc will use the default keymap. is also a safe option if the choice of keymap is not clear.
Next, bsdinstall will prompt for the hostname to be given to the newly installed system.
The entered hostname should be a fully-qualified hostname,
such as machine3.example.com
Next, bsdinstall will prompt to select optional components to install.
Deciding which components to install will depend largely on the intended use of the system and the amount of disk space available. The FreeBSD Kernel and userland (collectively the "base system") are always installed.
Depending on the type of installation, some of these components may not appear.
- Additional documentation,
mostly of historical interest. Documentation provided by
the FreeBSD Documentation Project may be installed
- Several traditional BSD
games, including fortune,
rot13, and others.
- Compatibility libraries for
running 32-bit applications on a 64-bit version of
- The FreeBSD Ports
The ports collection is an easy and convenient way to install software. The Ports Collection does not contain the source code necessary to compile the software. Instead, it is a collection of files which automates the downloading, compiling and installation of third-party software packages. Chapter 5, Installing Applications: Packages and Ports discusses how to use the ports collection.
The installation program does not check to see if you have adequate space. Select this option only if you have adequate hard disk space. As of FreeBSD 9.0, the FreeBSD Ports Collection takes up about 500 MB of disk space. You can safely assume a larger value for more recent versions of FreeBSD.
- System source code.
FreeBSD comes with full source code for both the kernel and the userland. Although not required for the majority of applications, it may be required to build certain software supplied as source (for example, device drivers or kernel modules), or for developing FreeBSD itself.
The full source tree requires 1 GB of disk space, and recompiling the entire FreeBSD system requires an additional 5 GB of space.
The bootonly installation media does not hold copies of the installation files. When a bootonly installation method is used, the files must be retrieved over a network connection as they are needed.
After the network connection has been configured as shown in Section 2.9.2, "Configuring Network Interfaces", a mirror site is selected. Mirror sites cache copies of the FreeBSD files. Choose a mirror site located in the same region of the world as the computer on which FreeBSD is being installed. Files can be retrieved more quickly when the mirror is close to the target computer, and installation time will be reduced.
Installation will continue as if the installation files were located on local media.
There are three ways to allocate disk space for FreeBSD. Guided partitioning automatically sets up disk partitions, while Manual partitioning allows advanced users to create customized partitions. Finally, there's the option of starting a shell where command-line programs like gpart(8), fdisk(8), and bsdlabel(8) can be used directly.
If multiple disks are connected, choose the one where FreeBSD is to be installed.
The entire disk can be allocated to FreeBSD, or just a portion of it. If
is chosen, a general partition layout filling the whole disk is created. Selecting creates a partition layout in unused space on the disk.After the partition layout has been created, review it carefully for accuracy. If a mistake has been made, selecting
will reset the partitions as they were previously, or will recreate the automatic FreeBSD partitions. Partitions can be manually created, modified, or deleted. When the partitioning is correct, select to continue with the installation.Manual partitioning goes straight to the partition editor.
Highlighting a drive (ada0
this example) and selecting
displays a menu
for choosing the type of partitioning
GPT partitioning is usually the most appropriate choice for PC-compatible computers. Older PC operating systems that are not compatible with GPT may require MBR partitioning instead. The other partitioning schemes are generally used for uncommon or older computer systems.
Abbreviation | Description |
APM | Apple Partition Map, used by PowerPC® Macintosh®. |
BSD | BSD Labels without an MBR, sometimes called "dangerously dedicated mode". See bsdlabel(8). |
GPT | GUID Partition Table. |
MBR | Master Boot Record. |
PC98 | MBR variant, used by NEC PC-98 computers. |
VTOC8 | Volume Table Of Contents, used by Sun SPARC64 and UltraSPARC computers. |
After the partitioning scheme has been selected and created, selecting
again will create new partitions.A standard FreeBSD GPT installation uses at least three partitions:
- FreeBSD boot
- A FreeBSD UFS
- FreeBSD swap
Another partition type worth noting is
, used for partitions that will
contain a FreeBSD ZFS filesystem. See
Section 20.2, "The Z File System (ZFS)". gpart(8) shows more
of the available GPT partition
Multiple filesystem partitions can be used, and some
people may prefer a traditional layout with separate
partitions for the /
, /tmp
, and
filesystems. See
Example 2.3, "Creating Traditional Split Filesystem
Partitions" for an
Size may be entered with common abbreviations: K for kilobytes, M for megabytes, or G for gigabytes.
Proper sector alignment provides the best performance, and making partition sizes even multiples of 4K bytes helps to ensure alignment on drives with either 512-byte or 4K-byte sectors. Generally, using partition sizes that are even multiples of 1M or 1G is the easiest way to make sure every partition starts at an even multiple of 4K. One exception: at present, the freebsd-boot partition should be no larger than 512K due to boot code limitations.
A mountpoint is needed if this partition will contain a
filesystem. If only a single UFS partition will be created,
the mountpoint should be /
A label is also requested. A label
is a name by which this partition will be known. Drive
names or numbers can change if the drive is connected to
a different controller or port, but the partition label does
not change. Referring to labels instead of drive names
and partition numbers in files like
makes the system more tolerant
of changing hardware. GPT labels appear in
when a disk is attached.
Other partitioning schemes have different label
capabilities, and their labels appear in different directories
in /dev/
Use a unique label on every filesystem to avoid
conflicts from identical labels. A few letters from the
computer's name, use, or location can be added to the label.
For instance, labroot
for the UFS root partition on
the lab's computer.
For a traditional partition layout where the
, /var
, and /usr
directories are separate filesystems on their own
partitions, create a GPT partitioning scheme, then create
the partitions as shown. Partition sizes shown are typical
for a 20G target disk. If more space is available on the
target disk, larger swap or /var
partitions may be useful. Labels shown here are prefixed
with ex
for "example", but
readers should use other unique label values as described
By default, FreeBSD's gptboot
the first UFS partition found to be the
Partition Type | Size | Mountpoint | Label |
freebsd-boot | 512K | ||
freebsd-ufs | 2G | / | exrootfs |
freebsd-swap | 4G | exswap | |
freebsd-ufs | 2G | /var | exvarfs |
freebsd-ufs | 1G | /tmp | extmpfs |
freebsd-ufs | accept the default (remainder of the disk) | /usr | exusrfs |
After the custom partitions have been created, select
to continue with the installation.This is the last chance for aborting the installation to prevent changes to the hard drive.
Select Enter to proceed. If changes need to be made, select to return to the partition editor. will exit the installer without making any changes to the hard drive.
and pressInstallation time will vary depending on the distributions chosen, installation media, and speed of the computer. There will be a series of messages displayed indicating progress.
Firstly, the installer will write the partitions to the
disk, and perform a newfs
to initialise the
If doing a network install, bsdinstall will then proceed to download the required distribution files.
Next, the integrity of the distribution files is verified, to ensure they have not been corrupted during download or misread from the installation media.
Finally, the verified distribution files are extracted to the disk.
Once all requested distribution files have been extracted, bsdinstall will then drop straight into the post-installation configuration tasks (see Section 2.9, "Post-Installation").
Configuration of various options follows a successful installation of FreeBSD. An option can be configured by re-entering the configuration options from the final menu before booting into the newly installed FreeBSD system.
The root
password must be set. Note that while entering the password,
the characters being typed are not displayed on the screen.
After the password has been entered, it must be entered again.
This helps prevent typing errors.
After the password has been successfully entered, the installation will continue.
Network configuration will be skipped if it has already been done as part of a bootonly installation.
A list of all the network interfaces found on the computer is shown next. Select one to be configured.
If a wireless network interface is chosen, wireless identification and security parameters must be entered to allow it to connect to the network.
Wireless networks are identified by a Service Set Identifier, or SSID. The SSID is a short, unique name given to each network.
Most wireless networks encrypt transmitted data to protect information from unauthorized viewing. WPA2 encryption is strongly recommended. Older encryption types, like WEP, offer very little security.
The first step in connecting to a wireless network is to scan for wireless access points.
SSIDs found during the scan are listed, followed by a description of the encryption types available for that network. If the desired SSID does not appear in the list, select
to scan again. If the desired network still does not appear, check for problems with antenna connections or try moving the computer closer to the access point. Rescan after each change is made.The encryption information for connecting to the selected wireless network is entered after selecting the network. With WPA2, only a password (also known as the Pre-Shared Key, or PSK) is needed. Characters typed into the input box are shown as asterisks for security.
Network configuration continues after selection of the wireless network and entry of the connection information.
Choose whether IPv4 networking is to be used. This is the most common type of network connection.
There are two methods of IPv4 configuration. DHCP will automatically configure the network interface correctly, and is the preferred method. Static configuration requires manual entry of network information.
Do not enter random network information, as it will not work. Obtain the information shown in Section 2.3.3, "Collect Network Information" from the network administrator or service provider.
If a DHCP server is available, select
to automatically configure the network interface.Static configuration of the network interface requires entry of some IPv4 information.
IP Address
- The
manually-assigned IPv4 address to be assigned to this
computer. This address must be unique and not already
in use by another piece of equipment on the local
Subnet Mask
- The subnet mask
used for the local network. Typically, this is
Default Router
- The IP address
of the default router on this network. Usually this
is the address of the router or other network
equipment that connects the local network to the
Internet. Also known as the
default gateway.
IPv6 is a newer method of network configuration. If IPv6 is available and desired, choose
to select it.IPv6 also has two methods of configuration. SLAAC , or StateLess Address AutoConfiguration, will automatically configure the network interface correctly. Static configuration requires manual entry of network information.
SLAAC allows an IPv6 network component to request autoconfiguration information from a local router. See RFC4862 for more information.
Static configuration of the network interface requires entry of the IPv6 configuration information.
IPv6 Address
- The
manually-assigned IP address to be
assigned to this computer. This address must be
unique and not already in use by another piece of
equipment on the local network.
Default Router
- The IPv6
address of the default router on this network.
Usually this is the address of the router or other
network equipment that connects the local network to
the Internet. Also known as the
default gateway.
The Domain Name System (or
DNS) Resolver
converts hostnames to and from network addresses. If
DHCP or SLAAC was used
to autoconfigure the network interface, the Resolver
values may already be present. Otherwise,
enter the local network's domain name in the Search
and DNS #2
the IP addresses for the local
DNS servers. At least one
DNS server is required.
Setting the time zone for your machine will allow it to automatically correct for any regional time changes and perform other time zone related functions properly.
The example shown is for a machine located in the Eastern time zone of the United States. Your selections will vary according to your geographical location.
Select Enter. If you do not know whether the system uses UTC or local time, select to choose the more commonly-used local time.
or according to how the machine's clock is configured and pressThe appropriate region is selected using the arrow keys and then pressing Enter.
Select the appropriate country using the arrow keys and press Enter.
The appropriate time zone is selected using the arrow keys and pressing Enter.
Confirm the abbreviation for the time zone is correct. If it looks okay, press Enter to continue with the post-installation configuration.
Additional system services which will be started at boot can be enabled. All of these services are optional.
- Secure Shell
(SSH) daemon for
secure remote access.
- Provides mouse usage
within the system console.
- Network Time Protocol
daemon for automatic clock synchronization.
- System power control
utility for power control and energy saving.
bsdinstall will prompt if crash dumps should be enabled on the target system. Enabling crash dumps can be very useful in debugging issues with the system, so users are encouraged to enable crash dumps whenever possible. Select to enable crash dumps, or to proceed without crash dumps enabled.
Adding at least one user during the installation allows
the system to be used without being logged in as
. When logged
in as root
, there
are essentially no limits or protection on what can be done.
Logging in as a normal user is safer and more secure.
to add new users.Enter the information for the user to be added.
- The name the user will
enter to log in. Typically the first letter of their
first name combined with their last name.
Full name
- The user's full
- User ID. Typically, this
is left blank so the system will assign a value.
Login group
- The user's group.
Typically left blank to accept the default.
Invite user into
other groups?
- Additional groups to which the
user will be added as a member.
Login class
- Typically left blank
for the default.
- The interactive shell for
this user. In the example, csh(1) has been
Home directory
- The user's home
directory. The default is usually correct.
Home directory permissions
Permissions on the user's home directory. The default is
usually correct.
Use password-based authentication?
- Typically yes
Use an empty password?
Typically no
Use a random password?
- Typically
Enter password
- The actual
password for this user. Characters typed will not show on
the screen.
Enter password again
- The password
must be typed again for verification.
Lock out the account after
- Typically no
After entering everything, a summary is shown, and the
system asks if it is correct. If a mistake was made during
entry, enter no
and try again. If
everything is correct, enter yes
to create
the new user.
If there are more users to add, answer the Add another
question with yes
. Enter
to finish adding users and continue the
For more information on adding users and user management, see Section 4.3, "Users and Basic Account Management".
After everything has been installed and configured, a final chance is provided to modify settings.
Use this menu to make any changes or do any additional configuration before completing the installation.
Add User
- Described in
Section 2.9.6, "Add Users".
Root Password
- Described in
Section 2.9.1, "Setting the root
- Described in
Section 2.5.2, "Setting the Hostname".
- Described in
Section 2.9.2, "Configuring Network Interfaces".
- Described in
Section 2.9.4, "Selecting Services to Enable".
Time Zone
- Described in
Section 2.9.3, "Setting the Time Zone".
- Download and install the
FreeBSD Handbook (which is what you are reading now).
After any final configuration is complete, select
to leave the installation.bsdinstall will prompt if there are any additional configuration that needs to be done before rebooting into the new system. Select to exit to a shell within the new system, or to proceed to the last step of the installation.
If further configuration or special setup is needed, selecting
will boot the install media into Live CD mode.When the installation is complete, select
to reboot the computer and start the new FreeBSD system. Do not forget to remove the FreeBSD install CD, DVD, or USB memory stick, or the computer may boot from it again.As FreeBSD boots, many informational messages are displayed. Most will scroll off the screen; this is normal. After the system finishes booting, a login prompt is displayed. Messages that scrolled off the screen can be reviewed by pressing Scroll-Lock to turn on the scroll-back buffer. The PgUp, PgDn, and arrow keys can be used to scroll back through the messages. Pressing Scroll-Lock again unlocks the display and returns to the normal screen.
At the login:
prompt, enter the
username added during the installation,
in the
example. Avoid logging in as
except when
The scroll-back buffer examined above is limited in
size, so not all of the messages may have been visible.
After logging in, most of them can be seen from the command
line by typing dmesg | less
at the
prompt. Press q to return to the command
line after viewing.
Typical boot messages (version information omitted):
Generating the RSA and DSA keys may take some time on slower machines. This happens only on the initial boot-up of a new installation, and only if sshd is set to start automatically. Subsequent boots will be faster.
FreeBSD does not install graphical environments by default, but many are available. See Chapter 6, The X Window System for more information.
Proper shutdown of a FreeBSD computer helps protect data and
even hardware from damage. Do not just turn off the power.
If the user is a member of the
group, become
the superuser by typing su
at the command
line and entering the
Otherwise, log in as
and use
shutdown -p now
. The system will close
down cleanly and turn itself off.
The Ctrl+Alt+Del key combination can be used to reboot the system, but is not recommended during normal operation.
The following section covers basic installation troubleshooting, such as common problems people have reported.
Due to various limitations of the PC architecture, it is impossible for probing to be 100% reliable, however, there are a few things you can do if it fails.
Check the Hardware Notes document for your version of FreeBSD to make sure your hardware is supported.
If your hardware is supported and you still experience
lock-ups or other problems, you will need to build a
custom kernel. This will
allow you to add in support for devices which are not present
in the GENERIC
kernel. The kernel on the
boot disks is configured assuming that most hardware devices
are in their factory default configuration in terms of IRQs,
IO addresses, and DMA channels. If your hardware has been
reconfigured, you will most likely need to edit the kernel
configuration and recompile to tell FreeBSD where to find
It is also possible that a probe for a device not present will cause a later probe for another device that is present to fail. In that case, the probes for the conflicting driver(s) should be disabled.
Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard. Motherboard firmware is usually referred to as the BIOS. Most motherboard and computer manufacturers have a website for upgrades and upgrade information.
Manufacturers generally advise against upgrading the motherboard BIOS unless there is a good reason for doing so, like a critical update. The upgrade process can go wrong, leaving the BIOS incomplete and the computer inoperative.
188.8.131.52. | My system hangs while probing hardware during boot, or it behaves strangely during install. |
FreeBSD makes extensive use of the system
ACPI service on the i386, amd64, and ia64 platforms to
aid in system configuration if it is detected during
boot. Unfortunately, some bugs still exist in both the
ACPI driver and within system motherboards and
firmware. ACPI can be disabled by setting
the set hint.acpi.0.disabled="1" This is reset each time the system is booted, so it
is necessary to
add |
A live CD of FreeBSD is available on the same CD as the main installation program. This is useful for those who are still wondering whether FreeBSD is the right operating system for them and want to test some of the features before installing.
The following points should be noted while using the live CD:
To gain access to the system, authentication is
required. The username is
, and the
password is blank.
As the system runs directly from the CD, performance will be significantly slower than that of a system installed on a hard disk.
The live CD provides a command prompt and not a graphical interface.
FreeBSD provides a text-based, easy to use installation
program. FreeBSD 9.0-RELEASE and later use the installation program
known as bsdinstall(8)
while FreeBSD 8.X
sysinstall(8). This chapter describes
how to use sysinstall(8).
The use of bsdinstall(8)
is covered in Chapter 2, Installing FreeBSD 9.X
After reading this chapter, you will know:
How to create the FreeBSD installation media.
How FreeBSD refers to and subdivides hard disks.
How to start sysinstall(8).
The questions sysinstall(8) asks, 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 to install, and verify that the system's hardware is supported.
In general, these installation instructions are written for the i386™ and FreeBSD/amd64 architectures. Where applicable, instructions specific to other platforms will be listed. There may be minor differences between the installer and what is shown here. This chapter should be used as a general guide rather than a literal installation manual.
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 chosen to install FreeBSD, a floppy drive, CDROM drive, or network adapter may be needed. Instructions on how to prepare the installation media can be found in Section 3.3.7, "Prepare the Boot Media".
Both FreeBSD/i386 and FreeBSD/pc98 require a 486 or better processor, at least 24 MB of RAM, and at least 150 MB of free hard drive space for the most minimal installation.
In the case of older hardware, installing more RAM and more hard drive space is often more important than a faster processor.
There are two classes of processors capable of running FreeBSD/amd64. The first are AMD64 processors, including the AMD Athlon™64, AMD Athlon™64-FX, and AMD Opteron™ or better processors.
The second class of processors includes those using the Intel® EM64T architecture. Examples of these processors include the Intel® Core™ 2 Duo, Quad, Extreme processor families, and the Intel® Xeon™ 3000, 5000, and 7000 sequences of processors.
If the machine is based on an nVidia nForce3 Pro-150, the BIOS setup must be used to disable the IO APIC. If this option does not exist, disable ACPI instead as there are bugs in the Pro-150 chipset.
To install FreeBSD/sparc64, use a supported platform (see Section 3.2.2, "Supported Hardware").
A dedicated disk is needed for FreeBSD/sparc64 as it is not possible to share a disk with another operating system at this time.
A list of supported hardware is provided with each FreeBSD
release in the FreeBSD Hardware Notes. This document can usually
be found in a file named HARDWARE.TXT
, in
the top-level directory of a CDROM or FTP distribution, or in
sysinstall(8)'s documentation menu.
It lists, for a given architecture, which hardware devices are
known to be supported by each release of FreeBSD. Copies of the
supported hardware list for various releases and architectures
can also be found on the Release
Information page of the FreeBSD website.
Before installing FreeBSD it is recommended to inventory the components in the computer. The FreeBSD installation routines will show components such as hard disks, network cards, and CDROM drives with their model number and manufacturer. FreeBSD will also attempt to determine the correct configuration for these devices, including information about IRQ and I/O port usage. Due to the vagaries of computer hardware, this process is not always completely successful, and FreeBSD may need some manual configuration.
If another operating system is already installed,
use the facilities provided
by that operating systems to view the hardware configuration.
If the settings of an expansion
card are not obvious, check if they are printed on the
card itself. Popular IRQ
numbers are 3, 5, and 7, and I/O port addresses are normally
written as
hexadecimal numbers, such as 0x330
It is recommended to print or write down this information before installing FreeBSD. It may help to use a table, as seen in this example:
Device Name | IRQ | I/O port(s) | Notes |
First hard disk | N/A | N/A | 40 GB, made by Seagate, first IDE master |
CDROM | N/A | N/A | First IDE slave |
Second hard disk | N/A | N/A | 20 GB, made by IBM, second IDE master |
First IDE controller | 14 | 0x1f0 | |
Network card | N/A | N/A | Intel® 10/100 |
Modem | N/A | N/A | 3Com® 56K faxmodem, on COM1 |
… |
Once the inventory of the components in the computer is complete, check if it matches the hardware requirements of the FreeBSD release to install.
If the computer contains valuable data, ensure it is backed up, and that the backup has been tested before installing FreeBSD. The FreeBSD installer will prompt before writing any data to disk, but once that process has started, it cannot be undone.
If FreeBSD is to be installed on the entire hard disk, skip this section.
However, if FreeBSD will co-exist with other operating systems, a rough understanding of how data is laid out on the disk is useful.
A PC disk can be divided into discrete chunks known as partitions. Since FreeBSD also has partitions, naming can quickly become confusing. Therefore, these disk chunks are referred to as slices in FreeBSD. For example, the FreeBSD version of fdisk(8) refers to slices instead of partitions. By design, the PC only supports four partitions per disk. These partitions are called primary partitions. To work around this limitation and allow more than four partitions, a new partition type was created, the extended partition. A disk may contain only one extended partition. Special partitions, called logical partitions, can be created inside this extended partition.
Each partition has a partition ID, which is
a number used to identify the type of data on the partition. FreeBSD
partitions have the partition ID of 165
In general, each operating system will identify
partitions in a particular way. For example,
Windows®, assigns each primary and logical partition a
drive letter, starting with
FreeBSD must be installed into a primary partition. If there are multiple disks, a FreeBSD partition can be created on all, or some, of them. When FreeBSD is installed, at least one partition must be available. This might be a blank partition or it might be an existing partition whose data can be overwritten.
If all the partitions on all the disks are in use,
free one of them for FreeBSD using the tools
provided by an existing operating system, such as Windows®
If there is a spare partition, use that. If it is too small, shrink one or more existing partitions to create more available space.
A minimal installation of FreeBSD takes as little as 100 MB of disk space. However, that is a very minimal install, leaving almost no space for files. A more realistic minimum is 250 MB without a graphical environment, and 350 MB or more for a graphical user interface. If other third-party software will be installed, even more space is needed.
You can use a tool such as GParted to resize your partitions and make space for FreeBSD. GParted is known to work on NTFS and is available on a number of Live CD Linux distributions, such as SystemRescueCD.
Incorrect use of a shrinking tool can delete the data on the disk. Always have a recent, working backup before using this type of tool.
Consider a computer with a single 4 GB disk
already has a version of Windows® installed, where the
disk has been split into two drive letters,
, each of which is 2 GB in size.
There is 1 GB of data on C:
0.5 GB of data on
This disk has two partitions, one per
drive letter. Copy all existing data from
to C:
, which
will free up the second partition, ready for FreeBSD.
Consider a computer with a single 4 GB disk
that already has a version of Windows® installed. When
Windows® was installed, it created one large partition,
drive that is 4 GB in size.
Currently, 1.5 GB of space is used, and FreeBSD should
have 2 GB
of space.
In order to install FreeBSD, either:
Backup the Windows® data and then reinstall Windows®, asking for a 2 GB partition at install time.
Use one of the tools described above to shrink your Windows® partition.
Before installing from an FTP site or an NFS server, make note of the network configuration. The installer will prompt for this information so that it can connect to the network to complete the installation.
If using an Ethernet network or an Internet connection using an Ethernet adapter via cable or DSL, the following information is needed:
IP address
IP address of the default gateway
DNS server IP addresses
Subnet Mask
If this information is unknown, ask the system administrator or service provider. Make note if this information is assigned automatically using DHCP.
If using a dialup modem, FreeBSD can still be installed over the Internet, it will just take a very long time.
You will need to know:
The phone number to dial the Internet Service Provider (ISP)
The COM: port the modem is connected to
The username and password for the ISP account
Although the FreeBSD Project strives to ensure that each release of FreeBSD is as stable as possible, bugs do occasionally creep into the process. On rare occasions those bugs affect the installation process. As these problems are discovered and fixed, they are noted in the FreeBSD Errata, which is found on the FreeBSD website. Check the errata before installing to make sure that there are no late-breaking problems to be aware of.
Information about all releases, including the errata for each release, can be found on the release information section of the FreeBSD website.
The FreeBSD installer can install FreeBSD from files located in any of the following places:
A CDROM or DVD
A USB Memory Stick
A MS-DOS® partition on the same computer
Floppy disks (FreeBSD/pc98 only)
An FTP site through a firewall or using an HTTP proxy
An NFS server
A dedicated parallel or serial connection
If installing from a purchased FreeBSD CD/DVD, skip ahead to Section 3.3.7, "Prepare the Boot Media".
To obtain the FreeBSD installation files, skip ahead to Section 3.13, "Preparing Custom Installation Media" which explains how to prepare the installation media. After reading that section, come back here and read on to Section 3.3.7, "Prepare the Boot Media".
The FreeBSD installation process is started by booting the computer into the FreeBSD installer. It is not a program that can be run within another operating system. The computer normally boots using the operating system installed on the hard disk, but it can also be configured to boot from a CDROM or from a USB disk.
If installing from a CD/DVD to a computer whose BIOS supports booting from the CD/DVD, skip this section. The FreeBSD CD/DVD images are bootable and can be used to install FreeBSD without any other special preparation.
To create a bootable memory stick, follow these steps:
Acquire the Memory Stick Image
Memory stick images for
FreeBSD 8.X
can be downloaded
the ISO-IMAGES/
directory at
Replace arch
with the
architecture and the version number to
install. For example, the memory stick
images for FreeBSD/i386 8.4-RELEASE are
available from ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.4/FreeBSD-8.4-RELEASE-i386-memstick.img
A different directory path is used for
FreeBSD 9.0-RELEASE and later versions. How to
download and install
FreeBSD 9.X
is covered in Chapter 2, Installing FreeBSD 9.X
The memory stick image has a .img
extension. The ISO-IMAGES/
contains a number of different images and the one to
use depends on the version of FreeBSD and the
type of media supported by the hardware being installed
Before proceeding, back up the data on the USB stick, as this procedure will erase it.
Write the Image File to the Memory Stick
The example below
lists /dev/da0
as the
target device where the image will be written. Be very careful
that you have the correct device as the output target, or you
may destroy your existing data.
Writing the Image with dd(1)
The .img
is not a regular file that can
just be copied to the
memory stick. It is an image of the complete contents of the
disk. This means that
dd(1) must be used to write the image directly to
the disk:
If an
Operation not permitted
error is displayed, make certain that the target device
is not in use, mounted, or being automounted by
another program. Then try
Make sure to use the correct drive letter as the output target, as this command will overwrite and destroy any existing data on the specified device.
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
and extract it into a folder.
Writing the Image with Image Writer
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 to accept the image file
name. Verify that everything is correct, and that no folders
on the memory stick are open in other windows. Finally,
click to write the image file to
the drive.
To create the boot floppy images for a FreeBSD/pc98 installation, follow these steps:
Acquire the Boot Floppy Images
The FreeBSD/pc98 boot disks
can be downloaded from the floppies directory,
Replace version
with the
version number to install.
The floppy images have a .flp
extension. floppies/
contains a number
of different images. Download
as well as the number of
files associated with the type of installation, such as
The FTP program must use binary mode to download these disk images. Some web browsers use text or ASCII mode, which will be apparent if the disks are not bootable.
Prepare the Floppy Disks
Prepare one floppy disk per downloaded image file. It is imperative that these disks are free from defects. The easiest way to test this is to reformat the disks. Do not trust pre-formatted floppies. The format utility in Windows® will not tell about the presence of bad blocks, it simply marks them as "bad" and ignores them. It is advised to use brand new floppies.
If the installer crashes, freezes, or otherwise misbehaves, one of the first things to suspect is the floppies. Write the floppy image files to new disks and try again.
Write the Image Files to the Floppy Disks
The .flp
files are
not regular files that can be copied
to the disk.
They are images of the complete contents of the
Specific tools must be used to write the
images directly to the disk.
FreeBSD provides a tool called
for creating the floppies on a
computer running
Windows®. This tool can be downloaded from
on the FreeBSD FTP site. Download this tool, insert a
floppy, then specify the filename to write to the floppy
Repeat this command for each .flp
file, replacing the floppy disk each time, being sure to label
the disks with the name of the file.
Adjust the command line as necessary, depending on where
the .flp
files are located.
When writing the floppies on a UNIX®-like system, such as another FreeBSD system, use dd(1) to write the image files directly to disk. On FreeBSD, run:
On FreeBSD, /dev/fd0
refers to the
first floppy disk. Other UNIX®
variants might have different names for the floppy disk
device, so check the documentation for the
system as necessary.
You are now ready to start installing FreeBSD.
By default, the installer will not make any changes to the disk(s) until after the following message:
Last Chance: Are you SURE you want continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents!
The install can be exited at any time prior to this final warning without changing the contents of the hard drive. If there is a concern that something is configured incorrectly, turn the computer off before this point, and no damage will be done.
Turn on the computer. As it starts it should display an option to enter the system set up menu, or BIOS, commonly reached by keys like F2, F10, Del, or Alt+S. Use whichever keystroke is indicated on screen. In some cases the computer may display a graphic while it starts. Typically, pressing Esc will dismiss the graphic and display the boot messages.
Find the setting that controls which devices the system boots
from. This is usually labeled as the "Boot Order"
and commonly shown as a list of devices, such as
First Hard Disk
, and so on.
If booting from the CD/DVD, make sure that the CDROM drive is selected. If booting from a USB disk, make sure that it is selected instead. When in doubt, consult the manual that came with the computer or its motherboard.
Make the change, then save and exit. The computer should now restart.
If using a prepared a "bootable" USB stick, as described in Section 3.3.7, "Prepare the Boot Media", plug in the USB stick before turning on the computer.
If booting from CD/DVD, turn on the computer, and insert the CD/DVD at the first opportunity.
For FreeBSD/pc98, installation boot floppies are
available and can be prepared as described in Section 3.3.7, "Prepare the Boot Media". The first floppy
disc will contain boot.flp
. Put
this floppy in the floppy drive to boot into the
If the computer starts up as normal and loads the existing operating system, then either:
The disks were not inserted early enough in the boot process. Leave them in, and try restarting the computer.
The BIOS changes did not work correctly. Redo that step until the right option is selected.
That particular BIOS does not support booting from the desired media.
FreeBSD will start to boot. If booting from CD/DVD, messages will be displayed, similar to these:
If booting from floppy disc, a display similar to this will be shown:
Remove the
floppy, insert the
next floppy, and press
When prompted, insert the other disks as required.
The boot process will then display the FreeBSD boot loader menu:
Either wait ten seconds, or press Enter.
Most SPARC64® systems are set to boot automatically from disk. To install FreeBSD, boot over the network or from a CD/DVD and wait until the boot message appears. The message depends on the model, but should look similar to:
If the system proceeds to boot from disk,
on the keyboard, or send a BREAK
over the
serial console using ~#
tip(1) or cu(1) to get to the PROM prompt. It
looks like this:
This is the prompt used on systems with just one CPU. | |
This is the prompt used on SMP systems and the digit indicates the number of the active CPU. |
At this point, place the CD/DVD into the drive and from
the PROM prompt, type boot cdrom
The last few hundred lines that have been displayed on screen are stored and can be reviewed.
To review this buffer, press Scroll Lock to turn on scrolling in the display. 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. Text similar to Figure 3.2, "Typical Device Probe Results" will be displayed, although it will differ depending on the devices in the computer.
Check the probe results carefully to make sure that FreeBSD found
all the devices. If a device was not found, it will
not be listed. A custom kernel
can be used to add in support for devices which are not in the
After the device probe, the menu shown in Figure 3.3, "Selecting Country Menu" will be displayed. Use the arrow key to choose a country, region, or group. Then press Enter to set the country.
If Enter.
is selected as the country, the standard American keyboard map will be used. If a different country is chosen, the following menu will be displayed. Use the arrow keys to choose the correct keyboard map and pressAfter the country selection, the sysinstall(8) main menu will display.
The FreeBSD 8.X
sysinstall(8), is console based and
divided into a number of menus and screens that can be used to
configure and control the installation process.
This menu system is controlled by the arrow keys, Enter, Tab, Space, and other keys. To view a detailed description of these keys and what they do, ensure that the entry is highlighted and that the button is selected, as shown in Figure 3.5, "Selecting Usage from Sysinstall Main Menu", then press Enter.
The instructions for using the menu system will be displayed. After reviewing them, press Enter to return to the Main Menu.
From the Main Menu, select Enter.
with the arrow keys and pressThis will display the Documentation Menu.
It is important to read the documents provided. To view a document, select it with the arrow keys and press Enter. When finished reading a document, press Enter to return to the Documentation Menu.
To return to the Main Installation Menu, select Enter.
with the arrow keys and pressTo change the keyboard mapping, use the arrow keys to select Enter. This is only required when using a non-standard or non-US keyboard.
from the menu and pressA different keyboard mapping may be chosen by selecting the menu item using the up and down arrow keys and pressing Space. Pressing Space again will unselect the item. When finished, choose the using the arrow keys and press Enter.
Only a partial list is shown in this screen representation. Selecting Tab will use the default keymap and return to the Main Install Menu.
by pressingSelect Enter.
and pressThe default values are usually fine for most users and do not need to be changed. The release name will vary according to the version being installed.
The description of the selected item will appear at the bottom of the screen highlighted in blue. Notice that one of the options is
to reset all values to startup defaults.Press F1 to read the help screen about the various options.
Press Q to return to the Main Install menu.
The first task is to allocate disk space for FreeBSD, and label that space so that sysinstall(8) can prepare it. In order to do this you need to know how FreeBSD expects to find information on the disk.
Before installing and configuring FreeBSD it is important to be aware how FreeBSD deals with BIOS drive mappings.
In a PC running a BIOS-dependent operating system such as Microsoft® Windows®, the BIOS is able to abstract the normal disk drive order and the operating system goes along with the change. This allows the user to boot from a disk drive other than the "primary master". This is especially convenient for users buy an identical second hard drive, and perform routine copies of the first drive to the second drive. If the first drive fails, is attacked by a virus, or is scribbled upon by an operating system defect, they can easily recover by instructing the BIOS to logically swap the drives. It is like switching the cables on the drives, without having to open the case.
Systems with SCSI controllers often include BIOS extensions which allow the SCSI drives to be re-ordered in a similar fashion for up to seven drives.
A user who is accustomed to taking advantage of these features may become surprised when the results with FreeBSD are not as expected. FreeBSD does not use the BIOS, and does not know the "logical BIOS drive mapping". This can lead to perplexing situations, especially when drives are physically identical in geometry and have been made as data clones of one another.
When using FreeBSD, always restore the BIOS to natural drive numbering before installing FreeBSD, and then leave it that way. If drives need to be switched around, take the time to open the case and move the jumpers and cables.
After choosing to begin a standard installation in sysinstall(8), this message will appear:
Press Enter and
a list of all the hard drives that the kernel found when it
carried out the device probes will be displayed.
Figure 3.13, "Select Drive for FDisk" shows an example from a
system with two IDE disks called
and ad2
Note that ad1
is not
listed here.
Consider two IDE hard disks where one
is the master on the first IDE controller and one is the
master on
the second IDE controller. If FreeBSD numbered these as
, everything would work.
But if a third disk is later added as the slave device on
first IDE controller, it would now be ad1
and the previous ad1
would become
. Because device names
are used to find filesystems,
some filesystems may no longer
appear correctly, requiring a change to the FreeBSD
To work around this, the kernel can be configured to name IDE
disks based on where they are and not the order in which they
found. With this scheme, the master disk on the second IDE
controller will always be
, even if there are no
or ad1
This configuration is the default for the FreeBSD kernel, which
is why the display in this example shows
. The machine on which this screenshot
was taken had IDE disks on both master channels of the IDE
controllers and no disks on the slave channels.
Select the disk on which to install FreeBSD, and then press FDisk will start, with a display similar to that shown in Figure 3.14, "Typical Default FDisk Partitions".
.The FDisk display is broken into three sections.
The first section, covering the first two lines of the display, shows details about the currently selected disk, including its FreeBSD name, the disk geometry, and the total size of the disk.
The second section shows the slices that are currently on the
disk, where they start and end, how large they are, the name FreeBSD
gives them, and their description and sub-type. This example shows two
small unused slices which are artifacts of disk layout schemes
on the
PC. It also shows one large FAT slice, which
appears as C:
Windows®, and an extended slice, which may contain other
drive letters in Windows®.
The third section shows the commands that are available in FDisk.
This step varies, depending on how the disk is to be sliced.
To install FreeBSD to the entire disk, which will delete
all the other data on this disk, press A,
corresponds to the option.
The existing slices will be removed and replaced with a small
flagged as unused
and one large slice for FreeBSD. Then,
select the newly created FreeBSD slice using the arrow
keys and press S to mark the slice as being
bootable. The screen will then look similar to
Figure 3.15, "Fdisk Partition Using Entire Disk". Note the
in the Flags
column, which
indicates that this slice is active, and will be
booted from.
If an existing slice needs to be deleted to make space for FreeBSD, select the slice using the arrow keys and press D. Then, press C to be prompted for the size of the slice to create. Enter the appropriate value and press Enter. The default value in this box represents the largest possible slice to make, which could be the largest contiguous block of unallocated space or the size of the entire hard disk.
If you have already made space for FreeBSD then you can press C to create a new slice. Again, you will be prompted for the size of slice you would like to create.
When finished, press Q. Any changes will be saved in sysinstall(8), but will not yet be written to disk.
The next menu provides the option to install a boot manager. In general, install the FreeBSD boot manager if:
There is more than one drive and FreeBSD will be installed onto a drive other than the first one.
FreeBSD will be installed alongside another operating system on the same disk, and you want to choose whether to start FreeBSD or the other operating system when the computer starts.
If FreeBSD is going to be the only operating system on this machine, installed on the first hard disk, then the
boot manager will suffice. Choose if using a third-party boot manager capable of booting FreeBSD.Make a selection and press Enter.
The help screen, reached by pressing F1, discusses the problems that can be encountered when trying to share the hard disk between operating systems.
If there is more than one drive, it will return to the Select Drives screen after the boot manager selection. To install FreeBSD on to more than one disk, select another disk and repeat the slice process using FDisk.
If installing FreeBSD on a drive other than the first drive, the FreeBSD boot manager needs to be installed on both drives.
Use Tab to toggle between the last drive selected, , and .
Press Tab once to toggle to , then press Enter to continue with the installation.
Next, create some partitions inside each slice.
Remember that each partition is lettered, from
through to h
, and that
partitions b
, c
, and
have conventional meanings that should
be adhered
Certain applications can benefit from particular partition schemes, especially when laying out partitions across more than one disk. However, for a first FreeBSD installation, do not give too much thought to how to partition the disk. It is more important to install FreeBSD and start learning how to use it. You can always re-install FreeBSD to change the partition scheme after becoming more familiar with the operating system.
The following scheme features four partitions: one for swap space and three for filesystems.
Partition | Filesystem | Size | Description |
a | / | 1 GB | This is the root filesystem. Every other filesystem will be mounted somewhere under this one. 1 GB is a reasonable size for this filesystem as user files should not be stored here and a regular FreeBSD install will put about 128 MB of data here. |
b | N/A | 2-3 x RAM | The system's swap space is kept on the |
e | /var | 512 MB to 4096 MB | /var
files that are constantly varying, such as
log files and other administrative files. Many
of these files are read from or written to extensively
FreeBSD's day-to-day running. Putting these files on another
filesystem allows FreeBSD to optimize the access of these
files without affecting other files in other directories that
do not have the same access pattern. |
f | /usr | Rest of disk (at least 8 GB) | All other files will typically be stored in
/usr and its
subdirectories. |
The values above are given as example and should be used
by experienced users only. Users are encouraged to use the
automatic partition layout called Auto
by the FreeBSD partition editor.
If installing FreeBSD on to more than one disk, create partitions in the other configured slices. The easiest way to do this is to create two partitions on each disk, one for the swap space, and one for a filesystem.
Partition | Filesystem | Size | Description |
b | N/A | See description | Swap space can be split across
each disk. Even though the a partition is
free, convention dictates that swap space stays on the
b partition. |
e | /diskn | Rest of disk | The rest of the disk is taken up with one big partition.
This could easily be put on the a
partition, instead of the e partition.
However, convention says that the a
partition on a slice is reserved for the filesystem that will
be the root (/ )
filesystem. Following
this convention is not necessary, but
sysinstall(8) uses it, so following it
makes the installation slightly cleaner.
This filesystem can be mounted anywhere; this example
mounts it as
/diskn ,
n is a number that changes for each
disk. |
Having chosen the partition layout, create it using sysinstall(8).
Press Enter to start the FreeBSD partition editor, called Disklabel.
Figure 3.18, "Sysinstall Disklabel Editor" shows the display when Disklabel starts. The display is divided into three sections.
The first few lines show the name of the disk being
worked on and the slice that contains the partitions to
create. At this point, Disklabel
this the Partition name
rather than slice
This display also shows the amount of free space within the slice;
that is, space that was set aside in the slice, but that has not yet
been assigned to a partition.
The middle of the display shows the partitions that have been created, the name of the filesystem that each partition contains, their size, and some options pertaining to the creation of the filesystem.
The bottom third of the screen shows the keystrokes that are valid in Disklabel.
Disklabel can automatically create partitions and assign them default sizes. The default sizes are calculated with the help of an internal partition sizing algorithm based on the disk size. Press A to see a display similar to that shown in Figure 3.19, "Sysinstall Disklabel Editor with Auto Defaults". Depending on the size of the disk, the defaults may or may not be appropriate.
The default partitioning assigns
its own
partition instead
of being part of the /
partition. This
helps avoid filling the /
partition with
temporary files.
To replace the default partitions, use the arrow keys to select the first partition and press D to delete it. Repeat this to delete all the suggested partitions.
To create the first partition, a
mounted as
, make sure the
proper disk slice
at the top of
the screen is selected and press C. A dialog box
will appear, prompting for the size of the new partition,
as shown
in Figure 3.20, "Free Space for Root Partition". The size can
be entered as
the number of disk blocks to use or as a
number followed by either M
for megabytes,
for gigabytes, or C
The default size shown will create a partition that takes up the
rest of the slice. If using the partition sizes described
in the earlier example, delete the existing figure using
Backspace, and then type in
, as shown in
Figure 3.21, "Edit Root Partition Size". Then press
After choosing the partition's size, the installer will ask whether this partition will contain a filesystem or swap space. The dialog box is shown in Figure 3.22, "Choose the Root Partition Type". This first partition will contain a filesystem, so check that is selected and press Enter.
Finally, tell
Disklabel where the filesystem will
mounted. The dialog box is shown in
Figure 3.23, "Choose the Root Mount Point". Type
, and
then press Enter.
The display will then update to show the newly created
partition. Repeat this procedure for the other
partitions. When creating the swap partition, it will not
prompt for the filesystem mount point. When creating the
final partition,
, leave the
suggested size as is to
use the rest of the slice.
The final FreeBSD DiskLabel Editor screen will appear similar to Figure 3.24, "Sysinstall Disklabel Editor", although the values chosen may be different. Press Q to finish.
Deciding which distribution set to install will depend largely on the intended use of the system and the amount of disk space available. The predefined options range from installing the smallest possible configuration to everything. Those who are new to UNIX® or FreeBSD should select one of these canned options. Customizing a distribution set is typically for the more experienced user.
Press F1 for more information on the distribution set options and what they contain. When finished reviewing the help, press Enter to return to the Select Distributions Menu.
If a graphical user interface is desired, the configuration of Xorg and selection of a default desktop must be done after the installation of FreeBSD. More information regarding the installation and configuration of a Xorg can be found in Chapter 6, The X Window System.
If compiling a custom kernel is anticipated, select an option which includes the source code. For more information on why a custom kernel should be built or how to build a custom kernel, see Chapter 9, Configuring the FreeBSD Kernel.
The most versatile system is one that includes everything. If there is adequate disk space, select Figure 3.25, "Choose Distributions", by using the arrow keys and pressing Enter. If there is a concern about disk space, consider using an option that is more suitable for the situation. Do not fret over the perfect choice, as other distributions can be added after installation.
, as shown inAfter selecting the desired distribution, an opportunity to install the FreeBSD Ports Collection is presented. The Ports Collection is an easy and convenient way to install software as it provides a collection of files that automate the downloading, compiling, and installation of third-party software packages. Chapter 5, Installing Applications: Packages and Ports discusses how to use the Ports Collection.
The installation program does not check to see if you have adequate space. Select this option only if you have adequate hard disk space. As of FreeBSD 9.2, the FreeBSD Ports Collection takes up about 500 MB of disk space. You can safely assume a larger value for more recent versions of FreeBSD.
Select Enter to continue. The Choose Distributions menu will redisplay.
with the arrow keys to install the Ports Collection or to skip this option. PressOnce satisfied with the options, select Enter to continue.
with the arrow keys, ensure that is highlighted, and pressIf installing from a CD/DVD, use the arrow keys to highlight Enter to proceed with the installation.
. Ensure that is highlighted, then pressFor other methods of installation, select the appropriate option and follow the instructions.
Press F1 to display the Online Help for installation media. Press Enter to return to the media selection menu.
There are three FTP installation modes to choose from: active FTP, passive FTP, or via a HTTP proxy.
This option makes all FTP transfers use "Active" mode. This will not work through firewalls, but will often work with older FTP servers that do not support passive mode. If the connection hangs with passive mode (the default), try using active mode.
This option instructs sysinstall(8) to use passive mode for all FTP operations. This allows the user to pass through firewalls that do not allow incoming connections on random TCP ports.
This option instructs sysinstall(8) to use the HTTP protocol to connect to a proxy for all FTP operations. The proxy will translate the requests and send them to the FTP server. This allows the user to pass through firewalls that do not allow FTP, but offer a HTTP proxy. In this case, specify the proxy in addition to the FTP server.
For a proxy FTP server, give the name of the server as
part of the username, after an "@" sign. The
proxy server then "fakes" the real server. For
example, to install from
, using the proxy
FTP server foo.example.com
listening on port 1234, go to the options menu, set the FTP
username to email@example.com
and the
password to an email address. As the installation media,
specify FTP (or passive FTP, if the proxy supports it), and
the URL
Since /pub/FreeBSD
is proxied under
, the proxy
will fetch the files
from ftp.FreeBSD.org
as the
installer requests them.
The installation can now proceed if desired. This is also the last chance for aborting the installation to prevent changes to the hard drive.
Select Enter to proceed.
and pressThe installation time will vary according to the distribution chosen, installation media, and the speed of the computer. There will be a series of messages displayed, indicating the status.
The installation is complete when the following message is displayed:
Press Enter to proceed with post-installation configurations.
Selecting Enter will abort the installation so no changes will be made to the system. The following message will appear:
and pressingThis message is generated because nothing was installed. Pressing Enter will return to the Main Installation Menu to exit the installation.
Configuration of various options can be performed after a successful installation. An option can be configured by re-entering the configuration menus before booting the new FreeBSD system or after boot using sysinstall(8) and then selecting the menu.
If PPP was previously configured for an FTP install, this screen will not display and can be configured after boot as described above.
For detailed information on Local Area Networks and configuring FreeBSD as a gateway/router refer to the Advanced Networking chapter.
To configure a network device, select Enter. Otherwise, select to continue.
and pressSelect the interface to be configured with the arrow keys and press Enter.
In this private local area network, the current Internet type protocol (IPv4) was sufficient and Enter pressed.
was selected with the arrow keys andIf connected to an existing IPv6 network with an RA server, choose Enter. It will take several seconds to scan for RA servers.
and pressIf Dynamic Host Configuration Protocol DHCP) is not required, select Enter.
with the arrow keys and pressSelecting dhclient(8) and, if successful, will fill in the network configuration information automatically. Refer to Section 28.6, "Dynamic Host Configuration Protocol (DHCP)" for more information.
will executeThe following Network Configuration screen shows the configuration of the Ethernet device for a system that will act as the gateway for a Local Area Network.
Use Tab to select the information fields and fill in appropriate information:
The fully-qualified hostname, such as
this case.
The name of the domain that the machine is
in, such as example.com
for this case.
IP address of host forwarding packets to non-local destinations. This must be filled in if the machine is a node on the network. Leave this field blank if the machine is the gateway to the Internet for the network. The IPv4 Gateway is also known as the default gateway or default route.
IP address of the local DNS server. There is no
DNS server on this private local area network so the IP
address of the provider's DNS server
) was used.
The IP address to be used for this interface was
The address block being used for this local area
network is
with a netmask of
Any additional interface-specific options to ifconfig(8). There were none in this case.
Use Tab to select when finished and press Enter.
Choosing Enter will bring the machine up on the network so it is ready for use. However, this does not accomplish much during installation, since the machine still needs to be rebooted.
and pressingIf the machine will be acting as the gateway for a local area network and forwarding packets between other machines, select Enter. If the machine is a node on a network, select and press Enter to continue.
and pressIf /etc/inetd.conf
with a text editor.
See Section 28.2.1, "Configuration File" for more information.
Otherwise, select
to configure these services during install. An additional confirmation will display:Select
to continue.Selecting #
at the beginning
of the lines representing those services.
Once the edits are complete, press Esc to display a menu which will exit the editor and save the changes.
Selecting sshd(8), the daemon for OpenSSH. This allows secure remote access to the machine. For more information about OpenSSH, see Section 14.8, "OpenSSH".
will enableSelecting the default Enter will still allow users who have accounts with passwords to use FTP to access the machine.
and pressingAnyone can access the machine if anonymous FTP connections are allowed. The security implications should be considered before enabling this option. For more information about security, see Chapter 14, Security.
To allow anonymous FTP, use the arrow keys to select Enter. An additional confirmation will display:
and pressThis message indicates that the FTP service will also
have to be enabled in /etc/inetd.conf
to allow anonymous FTP connections. Select and
Enter to continue. The following screen
will display:
Use Tab to select the information fields and fill in appropriate information:
The user ID to assign to the anonymous FTP user. All files uploaded will be owned by this ID.
Which group to place the anonymous FTP user into.
String describing this user in
Where files available for anonymous FTP will be kept.
Where files uploaded by anonymous FTP users will go.
The FTP root directory will be put in /var
by default. If there is not enough room there for the
anticipated FTP needs, use /usr
by setting the FTP root directory to
Once satisfied with the values, press Enter to continue.
If Enter and the cu(1) editor will automatically start.
is selected, pressUse the instructions to change the message. Note the file name location at the bottom of the editor screen.
Press Esc and a pop-up menu will default to . Press Enter to exit and continue. Press Enter again to save any changes.
The Network File System (NFS) allows sharing of files across a network. A machine can be configured as a server, a client, or both. Refer to Section 28.3, "Network File System (NFS)" for more information.
If there is no need for a NFS server, select Enter.
and pressIf /etc/exports
must be
Press Enter to continue. A text editor will
start, allowing /etc/exports
to be
Use the instructions to add the exported filesystems. Note the file name location at the bottom of the editor screen.
Press Esc and a pop-up menu will default to . Press Enter to exit and continue.
There are several options available to customize the system console.
To view and configure the options, select Enter.
and pressA commonly used option is the screen saver. Use the arrow keys to select Enter.
and then pressSelect the desired screen saver using the arrow keys and then press Enter. The System Console Configuration menu will redisplay.
The default time interval is 300 seconds. To change the time interval, select Enter. A pop-up menu will appear:
again. At the Screen Saver Options menu, select using the arrow keys and pressThe value can be changed, then select Enter to return to the System Console Configuration menu.
and pressSelect Enter to continue with the post-installation configuration.
and pressSetting the time zone allows the system to automatically correct for any regional time changes and perform other time zone related functions properly.
The example shown is for a machine located in the Eastern time zone of the United States. The selections will vary according to the geographic location.
Select Enter to set the time zone.
and pressSelect Enter.
or according to how the machine's clock is configured, then pressThe appropriate region is selected using the arrow keys and then pressing Enter.
Select the appropriate country using the arrow keys and press Enter.
The appropriate time zone is selected using the arrow keys and pressing Enter.
Confirm that the abbreviation for the time zone is correct. If it looks okay, press Enter to continue with the post-installation configuration.
This option allows cut and paste in the console and user programs using a 3-button mouse. If using a 2-button mouse, refer to moused(8) for details on emulating the 3-button style. This example depicts a non-USB mouse configuration:
Select Enter.
for a PS/2, serial, or bus mouse, or for a USB mouse, then pressUse the arrow keys to select Enter.
and pressThe mouse used in this example is a PS/2 type, so the default Enter to exit this menu.
is appropriate. To change the mouse protocol, use the arrow keys to select another option. Ensure that is highlighted and pressUse the arrow keys to select Enter.
and pressThis system had a PS/2 mouse, so the default Enter.
is appropriate. To change the port, use the arrow keys and then pressLast, use the arrow keys to select Enter to enable and test the mouse daemon.
, and pressMove the mouse around the screen to verify that the cursor responds properly. If it does, select Enter. If not, the mouse has not been configured correctly. Select and try using different configuration options.
and pressSelect Enter to continue with the post-installation configuration.
with the arrow keys and pressPackages are pre-compiled binaries and are a convenient way to install software.
Installation of one package is shown for purposes of illustration. Additional packages can also be added at this time if desired. After installation, sysinstall(8) can be used to add additional packages.
Select Enter to be presented with the Package Selection screens:
and pressOnly packages on the current installation media are available for installation at any given time.
All packages available will be displayed if Enter.
is selected. Otherwise, select a particular category. Highlight the selection with the arrow keys and pressA menu will display showing all the packages available for the selection made:
The bash shell is shown as selected. Select as many packages as desired by highlighting the package and pressing Space. A short description of each package will appear in the lower left corner of the screen.
Press Tab to toggle between the last selected package, , and .
Once finished marking the packages for installation, press Tab once to toggle to and press Enter to return to the Package Selection menu.
The left and right arrow keys will also toggle between Enter to return to the Package Selection menu.
and . This method can also be used to select and pressUse the Tab and arrow keys to select and press Enter to see the installation confirmation message:
Select Enter to start the package installation. Installation messages will appear until all of the installations have completed. Make note if there are any error messages.
and pressThe final configuration continues after packages are installed. If no packages are selected, select
to return to the final configuration.Add at least one user during the installation so
that the system can be used without logging in as
. The root partition is generally small
and running applications as root
can quickly
fill it. A bigger danger is noted below:
Select Enter to continue with adding a user.
and pressSelect Enter.
with the arrow keys and pressThe following descriptions will appear in the lower part of the screen as the items are selected with Tab to assist with entering the required information:
The login name of the new user (mandatory).
The numerical ID for this user (leave blank for automatic choice).
The login group name for this user (leave blank for automatic choice).
The password for this user (enter this field with care!).
The user's full name (comment).
The groups this user belongs to.
The user's home directory (leave blank for default).
The user's login shell (leave blank for
default of /bin/sh
In this example, the login shell was changed from
to use the
bash shell that was previously installed as
a package. Do not use a shell that does not exist or the user
not be able to login. The most common shell used in FreeBSD
is the C shell,
The user was also added to the wheel
to be able to become a superuser with root
Once satisfied, press
and the User and Group Management menu will redisplay:Groups can also be added at this time. Otherwise, this menu may be accessed using sysinstall(8) at a later time.
When finished adding users, select Enter to continue the installation.
with the arrow keys and pressPress Enter to set the root
The password will need to be typed in twice correctly. Do not forget this password. Notice that the typed password is not echoed, nor are asterisks displayed.
The installation will continue after the password is successfully entered.
A message will ask if configuration is complete:
Select Enter to return to the Main Installation Menu.
with the arrow keys and pressSelect Enter. The installer will prompt to confirm exiting the installation:
with the arrow keys and pressSelect
. If booting from the CDROM drive, the following message will remind you to remove the disk:The CDROM drive is locked until the machine starts to reboot, then the disk can quickly be removed from the drive. Press
to reboot.The system will reboot so watch for any error messages that may appear, see Section 3.10.15, "FreeBSD Bootup" for more details.
Configuring network services can be a daunting task for users that lack previous knowledge in this area. Since networking and the Internet are critical to all modern operating systems, it is useful to have some understanding of FreeBSD's extensive networking capabilities.
Network services are programs that accept input from
anywhere on the network. Since
there have been cases where bugs in network services have been
exploited by attackers, it is important to
only enable needed network services. If
in doubt, do not enable a network service until
it is needed. Services can be enabled
with sysinstall(8) or by
Selecting the
option will display a menu similar to the one below:The first option, Section 3.10.1, "Network Device Configuration".
, is covered inSelecting the amd(8). This is usually used in conjunction with NFS for automatically mounting remote filesystems.
option adds support forNext is the
option. When selected, a menu will pop up where specific AMD flags can be entered. The menu already contains a set of default options:-a
sets the default mount
location which is specified here as
. -l
specifies the default log
however, when syslogd(8) is used, all log
activity will be sent to the system log daemon.
is used
to mount an exported file system from a remote
host, while /net
is used to mount an exported filesystem from an
IP address. The default
options for AMD exports are defined in
option permits anonymous FTP connections. Select this option to make this machine an anonymous FTP server. Be aware of the security risks involved with this option. Another menu will be displayed to explain the security risks and configuration in depth.The
menu will configure the machine to be a gateway. This menu can also be used to unset the option if it was accidentally selected during installation.The inetd(8).
option can be used to configure or completely disableThe
option is used to configure the system's default Mail Transfer Agent (MTA). Selecting this option will bring up the following menu:This menu offers a choice as to which MTA to install and set as the default. An MTA is a mail server which delivers email to users on the system or the Internet.
Select Sendmail as the default MTA. Select to set Sendmail as the default MTA, but disable its ability to receive incoming email from the Internet. The other options, and , provide alternatives to Sendmail.
to installThe next menu after the MTA menu is Section 28.3, "Network File System (NFS)" for more information about client and server configuration.
. This menu is used to configure the system to communicate with a NFS server which in turn is used to make filesystems available to other machines on the network over the NFS protocol. SeeBelow that option is the
option, for setting the system up as an NFS server. This adds the required information to start up the Remote Procedure Call RPC services. RPC is used to coordinate connections between hosts and programs.Next in line is the
option, which deals with time synchronization. When selected, a menu like the one below shows up:From this menu, select the server which is geographically closest. This will make the time synchronization more accurate as a farther server may have more connection latency.
The next option is the PCNFSD selection. This option will install the net/pcnfsd package from the Ports Collection. This is a useful utility which provides NFS authentication services for systems which are unable to provide their own, such as Microsoft's MS-DOS® operating system.
Now, scroll down a bit to see the other options:
between NFS servers and clients is managed
by rpcbind(8) which is
required for NFS servers to operate
correctly. Status monitoring is provided by
rpc.statd(8) and the reported status is usually held
in /var/db/statd.status
. The
next option is for rpc.lockd(8)
which provides file locking
services. This is usually used with
rpc.statd(8) to monitor which hosts are
requesting locks and how frequently they request them.
While these last two options are useful for debugging, they
are not required for NFS servers and clients
to operate correctly.
The next menu,
routed(8), manages network routing tables,
discovers multicast routers, and supplies a copy of the routing
tables to any physically connected host on the network upon
request. This is mainly used for machines which act as a
gateway for the local network. If selected, a menu will
request the default location of the utility.
To accept the default location,
press Enter. Yet
another menu will ask for the
flags to pass to routed(8). The
default of -q
should appear
on the screen.
The next menu, rwhod(8) during system initialization. This utility broadcasts system messages across the network periodically, or collects them when in "consumer" mode. More information can be found in ruptime(1) and rwho(1).
, startsThe next to last option in the list is for sshd(8), the secure shell server for OpenSSH. It is highly recommended over the standard telnetd(8) and ftpd(8) servers as it is used to create a secure, encrypted connection from one host to another.
The final option is
which are defined in RFC 1323 and RFC 1644. While on many hosts this can speed up connections, it can also cause some connections to be dropped. It is not recommended for servers, but may be beneficial for stand alone machines.Once the network services are configured, scroll up to the very top item which is sysinstall(8) by selecting twice then .
and continue on to the next configuration item or simply exitIf everything went well, messages will scroll along the screen and a login prompt will appear. To view these messages, press Scroll-Lock then use PgUp and PgDn. Press Scroll-Lock again to return to the prompt.
All of the messages may not display due to buffer limitations, but they can be read after logging using dmesg(8).
Login using the username and password which were set
during installation. Avoid logging in as
except when necessary.
Typical boot messages (version information omitted):
Generating the RSA and DSA keys may take some time on slower machines. This happens only on the initial boot-up of a new installation. Subsequent boots will be faster.
If Xorg has been configured
and a default desktop
chosen, it can be started by typing startx
the command line.
It is important to properly shutdown the operating
system. Do not just turn off the power. First, become the
superuser using
su(1) and entering the
password. This will work only if the user
is a member of wheel
Otherwise, login as root
. To shutdown
the system, type
shutdown -h now
It is safe to turn off the power after the shutdown command has been issued and the message "Please press any key to reboot" appears. If any key is pressed instead of turning off the power switch, the system will reboot.
The Ctrl+Alt+Del key combination can also be used to reboot the system; however, this is not recommended.
This section covers basic installation troubleshooting of common problems. There are also a few questions and answers for people wishing to dual-boot FreeBSD with Windows®.
Due to various limitations of the PC architecture, it is impossible for device probing to be 100% reliable. However, there are a few things to try if it fails.
Check the Hardware Notes document for the version of FreeBSD to make sure the hardware is supported.
If the hardware is supported but still experiences
lock-ups or other problems, build a custom kernel
to add in support for devices which are not present in the
kernel. The default kernel
assumes that most hardware devices are in their
factory default configuration in terms of IRQs, I/O addresses,
DMA channels. If the hardware has been reconfigured,
create a custom kernel configuration file and recompile to
FreeBSD where to find things.
It is also possible that a probe for a device not present will cause a later probe for another device that is present to fail. In that case, the probes for the conflicting driver(s) should be disabled.
Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard BIOS. Most motherboard and computer manufacturers have a website where upgrade information may be located.
Most manufacturers strongly advise against upgrading the motherboard BIOS unless there is a good reason for doing so, such as a critical update. The upgrade process can go wrong, causing permanent damage to the BIOS chip.
At this time, FreeBSD does not support file systems compressed with the Double Space™ application. Therefore the file system will need to be uncompressed before FreeBSD can access the data. This can be done by running the Compression Agent located in the > > menu.
FreeBSD can support MS-DOS® file systems (sometimes called
FAT file systems). The mount_msdosfs(8) command grafts such file
systems onto the existing directory hierarchy, allowing the file
system's contents to be accessed. The mount_msdosfs(8) program
is not usually
invoked directly; instead, it is called by the system through a line
in /etc/fstab
or by using
with the appropriate parameters.
A typical line in /etc/fstab
exist for this to work. For details about the format of
, see fstab(5).
A typical call to mount(8) for a FAT filesystem looks like:
In this example, the FAT filesystem is located on the first partition of the primary hard disk. The output from dmesg(8) and mount(8) should produce enough information to give an idea of the partition layout.
FreeBSD may number FAT partitions differently than other operating systems. In particular, extended partitions are usually given higher slice numbers than primary partitions. Use fdisk(8) to help determine which slices belong to FreeBSD and which belong to other operating systems.
NTFS partitions can also be mounted in a similar manner using mount_ntfs(8).
188.8.131.52. | My system hangs while probing hardware during boot or it behaves strangely during install. |
FreeBSD makes extensive use of the system
ACPI service on the i386, amd64, and ia64 platforms to
aid in system configuration if it is detected during
boot. Unfortunately, some bugs still exist in the
ACPI driver and various system motherboards.
The use of ACPI can be disabled by setting
set hint.acpi.0.disabled="1" This is reset each time the system is booted, so it
is necessary to
add | |
220.127.116.11. | When booting from the hard disk for the first time after installing FreeBSD, the kernel loads and probes hardware, but stops with messages like: changing root device to ad1s1a panic: cannot mount root What is wrong? |
This can occur when the boot disk is not the first disk in the system. The BIOS uses a different numbering scheme to FreeBSD, and working out which numbers correspond to which is difficult to get right. If this occurs, tell FreeBSD where the root filesystem is by specifying the BIOS disk number, the disk type, and the FreeBSD disk number for that type. Consider two IDE disks,
each configured as the master on their respective IDE
bus, where FreeBSD should be booted from the second disk.
BIOS sees these as disk 0 and disk 1, while FreeBSD sees
them as If FreeBSD is on BIOS disk 1, of type
1:ad(2,a)kernel Note that if there is a slave on the primary bus, the above is not necessary and is effectively wrong. The second situation involves booting from a SCSI
disk when there are one or more IDE disks in the system.
In this case, the FreeBSD disk number is lower than the
BIOS disk number. For two IDE disks and a
SCSI disk, where the SCSI disk is BIOS disk 2,
type 2:da(0,a)kernel This tells FreeBSD to boot from BIOS disk 2,
which is the first SCSI disk in the system. If there
is only IDE disk, use Once the correct value to use is determined,
put the command
in | |
188.8.131.52. | When booting from the hard disk for the first time
after installing FreeBSD, the Boot Manager prompt just
prints |
The hard disk geometry was set incorrectly in the partition editor when FreeBSD was installed. Go back into the partition editor and specify the actual geometry of the hard disk. FreeBSD must be reinstalled again from the beginning with the correct geometry. For a dedicated FreeBSD system that does not need future compatibility with another operating system, use the entire disk by selecting in the installer's partition editor. | |
126.96.36.199. | The system finds the ed(4) network card but continuously displays device timeout errors. |
The card is probably on a different IRQ from what
is specified in
Either move the jumper on the card to the
configuration setting or specify the IRQ as
Another possibility is that the card is at IRQ 9, which is shared by IRQ 2 and frequently a cause of problems, especially if a VGA card is using IRQ 2. Do not use IRQ 2 or 9 if at all possible. | |
126.96.36.199. | When sysinstall(8) is used in an Xorg terminal, the yellow font is difficult to read against the light gray background. Is there a way to provide higher contrast for this application? |
If the default
colors chosen by sysinstall(8)
make text illegible while using x11/xterm or x11/rxvt,
add the following to |
This section describes how to install FreeBSD in exceptional cases.
This type of installation is called a "headless install" because the machine to be installed does not have either an attached monitor or a VGA output. This type of installation is possible using a serial console, another machine which acts as the main display and keyboard. To do this, follow the steps to create an installation USB stick, explained in Section 3.3.7, "Prepare the Boot Media", or download the correct installation ISO image as described in Section 3.13.1, "Creating an Installation ISO".
To modify the installation media to boot into a serial console, follow these steps. If using a CD/DVD media, skip the first step):
Enabling the Installation USB Stick to Boot into a Serial Console
By default, booting into the USB stick boots into the installer. To instead boot into a serial console, mount the USB disk onto a FreeBSD system using mount(8):
Adapt the device node and the mount point to the situation.
Once the USB stick is mounted, set
it to boot into a serial console.
Add this line to /boot/loader.conf
on the USB stick:
Now that the USB is stick configured correctly, unmount the disk using umount(8):
Now, unplug the USB stick and jump directly to the third step of this procedure.
Enabling the Installation CD/DVD to Boot into a Serial Console
By default, when booting into the installation CD/DVD, FreeBSD boots into its normal install mode. To instead boot into a serial console, extract, modify, and regenerate the ISO image before burning it to the CD/DVD media.
From the FreeBSD system with the saved installation ISO image, use tar(1) to extract all the files:
Next, set the installation media to boot into a
serial console. Add this line to the
of the extracted
ISO image:
Then, create a new ISO image from the modified tree. This example uses mkisofs(8) from the sysutils/cdrtools package or port:
Now that the ISO image is configured correctly, burn it to a CD/DVD media using a burning application.
Connecting the Null-modem Cable
Connect a null-modem cable to the serial ports of the two machines. A normal serial cable will not work. A null-modem cable is required.
Booting Up for the Install
It is now time to go ahead and start the install. Plug in the USB stick or insert the CD/DVD media in the headless install machine and power it on.
Connecting to the Headless Machine
Next, connect to that machine with cu(1):
The headless machine can now be controlled using cu(1). It will load the kernel and then dispaly a selection of which type of terminal to use. Select the FreeBSD color console and proceed with the installation.
Some situations may require a customized FreeBSD installation media and/or source. This might be physical media or a source that sysinstall(8) can use to retrieve the installation files. Some example situations include:
A local network with many machines has a private FTP server hosting the FreeBSD installation files which the machines should use for installation.
FreeBSD does not recognize the CD/DVD drive but Windows® does. In this case, copy the FreeBSD installation files to a Windows® partition on the same computer, and then install FreeBSD using those files.
The computer to install does not have a CD/DVD drive or a network card, but can be connected using a null-printer cable to a computer that does.
A tape will be be used to install FreeBSD.
As part of each release, the FreeBSD Project provides ISO images for each supported architecture. These images can be written ("burned") to CD or DVD media using a burning application, and then used to install FreeBSD. If a CD/DVD writer is available, this is the easiest way to install FreeBSD.
Download the Correct ISO Images
The ISO images for each release can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/ISO-IMAGES-arch/version
or the closest mirror.
or the closest mirror. Substitute
as appropriate.
An image directory normally contains the following images:
Filename | Contents |
FreeBSD-version-RELEASE-arch-bootonly.iso | This CD image starts the installation process by booting from a CD-ROM drive but it does not contain the support for installing FreeBSD from the CD itself. Perform a network based install, such as from an FTP server, after booting from this CD. |
FreeBSD-version-RELEASE-arch-dvd1.iso.gz | This DVD image contains everything necessary to install the base FreeBSD operating system, a collection of pre-built packages, and the documentation. It also supports booting into a "livefs" based rescue mode. |
FreeBSD-version-RELEASE-arch-memstick.img | This image can be written to a USB memory stick in order to install machines capable of booting from USB drives. It also supports booting into a "livefs" based rescue mode. The only included package is the documentation package. |
FreeBSD-version-RELEASE-arch-mini-memstick.img | This image can be written to a USB memory
stick in order to install machines capable of
booting from USB drives. Similar to the
bootonly.iso image, it does
not contain the distribution sets on the medium
itself, but does support network-based
installations (for example, via ftp). |
FreeBSD-version-RELEASE-arch-disc1.iso | This CD image contains the base FreeBSD operating system and the documentation package but no other packages. |
FreeBSD-version-RELEASE-arch-disc2.iso | A CD image with as many third-party packages
as would fit on the disc. This image is not
available for FreeBSD 9.X . |
FreeBSD-version-RELEASE-arch-disc3.iso | Another CD image with as many third-party
packages as would fit on the disc. This image is
not available for FreeBSD 9.X . |
FreeBSD-version-RELEASE-arch-livefs.iso | This CD image contains support for booting into a "livefs" based rescue mode but does not support doing an install from the CD itself. |
When performing a CD installation, download either
the bootonly
ISO image
or disc1
. Do not download
both, since disc1
contains everything that the bootonly
ISO image contains.
Use the bootonly
ISO to perform a
network install over the Internet. Additional software
can be installed as needed using
the Ports Collection as described in
Chapter 5, Installing Applications: Packages and Ports.
Use dvd1
install FreeBSD
and a selection of third-party packages
from the disc.
Burn the Media
Next, write the downloaded image(s) to disc. If using another FreeBSD system, refer to Section 18.6.3, "burncd" and Section 18.6.4, "cdrecord" for instructions.
If using another platform, use any burning utility that exists for that platform. The images are in the standard ISO format which most CD writing applications support.
To build a customized release of FreeBSD, refer to the Release Engineering Article.
FreeBSD discs are laid out in the same way as the FTP site. This makes it easy to create a local FTP site that can be used by other machines on a network to install FreeBSD.
On the FreeBSD computer that will host the FTP site, ensure that the CD/DVD is in the drive and mounted:
Create an account for anonymous FTP. Use vipw(8) to insert this line:
Ensure that the FTP service is enabled in
Anyone with network connectivity to the machine can now
chose a media type of FTP and type in
ftp://your machine
after picking "Other" in the FTP sites menu during
the install.
If the boot media for the FTP clients is not precisely the same version as that provided by the local FTP site, sysinstall(8) will not complete the installation. To override this, go into the menu and change the distribution name to .
This approach is acceptable for a machine on the local network which is protected by a firewall. Offering anonymous FTP services to other machines over the Internet exposes the computer to increased security risks. It is strongly recommended to follow good security practices when providing services over the Internet.
To prepare for an installation from a Windows®
copy the files from the distribution into a directory
in the root directory of the
partition, such as c:\freebsd
. Since the
directory structure must be
reproduced, it is recommended to use
when copying from a CD/DVD.
For example, to prepare for a minimal installation of
This example assumes that C:
has enough
free space and E:
is where the
is mounted.
Alternatively, download the distribution from ftp.FreeBSD.org. Each distribution is in its own directory; for example, the base distribution can be found in the 8.4/base/ directory.
Copy the distributions to install from a Windows®
partition to c:\freebsd
. Both the
and kernel
distributions are needed for
the most minimal installation.
There are three types of network installations available: Ethernet, PPP, and PLIP.
For the fastest possible network installation, use an Ethernet adapter. FreeBSD supports most common Ethernet cards. A list of supported cards is provided in the Hardware Notes for each release of FreeBSD. If using a supported PCMCIA Ethernet card, be sure that it is plugged in before the system is powered on as FreeBSD does not support hot insertion of PCMCIA cards during installation.
Make note of the system's IP address, subnet mask, hostname, default gateway address, and DNS server addresses if these values are statically assigned. If installing by FTP through a HTTP proxy, make note of the proxy's address. If you do not know these values, ask the system administrator or ISP before trying this type of installation.
If using a dialup modem, have the service provider's PPP information handy as it is needed early in the installation process.
If PAP or CHAP are used to connect to the
ISP without using a script,
type dial
at the FreeBSD
ppp prompt. Otherwise,
know how to dial the ISP using the
"AT commands"
specific to the modem, as the PPP dialer provides only a
simple terminal emulator. Refer to Section 26.2, "Configuring PPP" and ../../../../doc/en_US.ISO8859-1/books/faq/ppp.html
for further information.
Logging can be directed to the screen using
set log local ...
If a hard-wired connection to another FreeBSD machine is available, the installation can occur over a null-modem parallel port cable. The data rate over the parallel port is higher than what is typically possible over a serial line.
To perform an NFS installation, copy the needed FreeBSD distribution files to an NFS server and then point the installer's NFS media selection to it.
If the server supports only a "privileged
set the option NFS Secure
in the
menu so that the installation
If using a poor quality Ethernet card which suffers
from slow transfer rates, toggle the
NFS Slow
flag to on.
In order for an NFS installation to
work, the server must
support subdir mounts. For example, if the
FreeBSD 9.2 distribution lives on:
will have to allow the direct mounting
of /usr/archive/stuff/FreeBSD
not just
In FreeBSD, this
is controlled by using -alldirs
. Other
servers may have different conventions. If the server is
permission denied messages,
it is likely that this is not enabled
This chapter covers the basic commands and functionality of the FreeBSD operating system. Much of this material is relevant for any UNIX®-like operating system. New FreeBSD users are encouraged to read through this chapter carefully.
After reading this chapter, you will know:
How to use and configure virtual consoles.
How to create and manage users and groups on FreeBSD.
How UNIX® file permissions and FreeBSD file flags work.
The default FreeBSD file system layout.
The FreeBSD disk organization.
How to mount and unmount file systems.
What processes, daemons, and signals are.
What a shell is, and how to change the default login environment.
How to use basic text editors.
What devices and device nodes are.
How to read manual pages for more information.
Unless FreeBSD has been configured to automatically start a graphical environment during startup, the system will boot into a command line login prompt, as seen in this example:
The first line contains some information about the system.
The amd64
indicates that the system in this
example is running a 64-bit version of FreeBSD. The hostname is
, and
indicates that this is the
"system console". The second line is the login
Since FreeBSD is a multiuser system, it needs some way to distinguish between different users. This is accomplished by requiring every user to log into the system before gaining access to the programs on the system. Every user has a unique name "username" and a personal "password".
To log into the system console, type the username that was configured during system installation, as described in Section 2.9.6, "Add Users", and press Enter. Then enter the password associated with the username and press Enter. The password is not echoed for security reasons.
Once the correct password is input, the message of the
day (MOTD) will be displayed followed
by a command prompt. Depending upon the shell that was
selected when the user was created, this prompt will be a
, $
, or
character. The prompt indicates that
the user is now logged into the FreeBSD system console and ready
to try the available commands.
While the system console can be used to interact with the system, a user working from the command line at the keyboard of a FreeBSD system will typically instead log into a virtual console. This is because system messages are configured by default to display on the system console. These messages will appear over the command or file that the user is working on, making it difficult to concentrate on the work at hand.
By default, FreeBSD is configured to provide several virtual consoles for inputting commands. Each virtual console has its own login prompt and shell and it is easy to switch between virtual consoles. This essentially provides the command line equivalent of having several windows open at the same time in a graphical environment.
The key combinations
have been reserved by FreeBSD for switching between virtual
consoles. Use
to switch to the system console
to access the first virtual console
to access the second virtual console
), and so on.
When switching from one console to the next, FreeBSD takes manages the screen output. The result is an illusion of having multiple virtual screens and keyboards that can be used to type commands for FreeBSD to run. The programs that are launched in one virtual console do not stop running when the user switches to a different virtual console.
Refer to syscons(4), atkbd(4), vidcontrol(1) and kbdcontrol(1) for a more technical description of the FreeBSD console and its keyboard drivers.
In FreeBSD, the number of available virtual consoles is
configured in this section of
To disable a virtual console, put a comment symbol
) at the beginning of the line
representing that virtual console. For example, to reduce the
number of available virtual consoles from eight to four, put a
in front of the last four lines
representing virtual consoles ttyv5
through ttyv8
Do not comment out the line for the
system console ttyv0
. Note that the last
virtual console (ttyv8
) is used to access
the graphical environment if Xorg
has been installed and configured as described in
Chapter 6, The X Window System.
For a detailed description of every column in this file and the available options for the virtual consoles, refer to ttys(5).
The FreeBSD boot menu provides an option labelled as
"Boot Single User". If this option is selected,
the system will boot into a special mode known as
"single user mode". This mode is typically used
to repair a system that will not boot or to reset the
password when
it is not known. While in single user mode, networking and
other virtual consoles are not available. However, full
access to the
system is available, and by default, the
password is not
needed. For these reasons, physical access to the keyboard is
needed to boot into this mode and determining who has physical
access to the keyboard is something to consider when securing
a FreeBSD system.
The settings which control single user mode are found in
this section of /etc/ttys
By default, the status is set to
. This assumes that who has physical
access to the keyboard is either not important or it is
controlled by a physical security policy. If this setting is
changed to insecure
, the assumption is that
the environment itself is insecure because anyone can access
the keyboard. When this line is changed to
, FreeBSD will prompt for the
password when a
user selects to boot into single user mode.
Be careful when changing this setting to
! If the
password is
forgotten, booting into single user mode is still possible,
but may be difficult for someone who is not familiar with
the FreeBSD booting process.
The FreeBSD console default video mode may be adjusted to
1024x768, 1280x1024, or any other size supported by the
graphics chip and monitor. To use a different video mode
load the VESA
To determine which video modes are supported by the hardware, use vidcontrol(1). To get a list of supported video modes issue the following:
The output of this command lists the video modes that are
supported by the hardware. To select a new video mode,
specify the mode using vidcontrol(1) as the
If the new video mode is acceptable, it can be permanently
set on boot by adding it to
FreeBSD allows multiple users to use the computer at the same time. While only one user can sit in front of the screen and use the keyboard at any one time, any number of users can log in to the system through the network. To use the system, each user should have their own user account.
This chapter describes:
The different types of user accounts on a FreeBSD system.
How to add, remove, and modify user accounts.
How to set limits to control the resources that users and groups are allowed to access.
How to create groups and add users as members of a group.
Since all access to the FreeBSD system is achieved using accounts and all processes are run by users, user and account management is important.
There are three main types of accounts: system accounts, user accounts, and the superuser account.
System accounts are used to run services such as DNS, mail, and web servers. The reason for this is security; if all services ran as the superuser, they could act without restriction.
Examples of system accounts are
, and
is the
generic unprivileged system account. However, the more
services that use
, the more
files and processes that user will become associated with,
and hence the more privileged that user becomes.
User accounts are assigned to real people and are used to log in and use the system. Every person accessing the system should have a unique user account. This allows the administrator to find out who is doing what and prevents users from clobbering the settings of other users.
Each user can set up their own environment to accommodate their use of the system, by configuring their default shell, editor, key bindings, and language settings.
Every user account on a FreeBSD system has certain information associated with it:
The user name is typed at the
prompt. Each user must have
a unique user name. There are a number of rules for
creating valid user names which are documented in
passwd(5). It is recommended to use user names
that consist of eight or fewer, all lower case
characters in order to maintain backwards
compatibility with applications.
Each account has an associated password.
The User ID (UID) is a number used to uniquely identify the user to the FreeBSD system. Commands that allow a user name to be specified will first convert it to the UID. It is recommended to use a UID less than 65535, since higher values may cause compatibility issues with some software.
The Group ID (GID) is a number used to uniquely identify the primary group that the user belongs to. Groups are a mechanism for controlling access to resources based on a user's GID rather than their UID. This can significantly reduce the size of some configuration files and allows users to be members of more than one group. It is recommended to use a GID of 65535 or lower as higher GIDs may break some software.
Login classes are an extension to the group mechanism that provide additional flexibility when tailoring the system to different users. Login classes are discussed further in Section 4.3.3, "Limiting Users".
By default, passwords do not expire. However, password expiration can be enabled on a per-user basis, forcing some or all users to change their passwords after a certain amount of time has elapsed.
By default, FreeBSD does not expire accounts. When creating accounts that need a limited lifespan, such as student accounts in a school, specify the account expiry date using pw(8). After the expiry time has elapsed, the account cannot be used to log in to the system, although the account's directories and files will remain.
The user name uniquely identifies the account to FreeBSD, but does not necessarily reflect the user's real name. Similar to a comment, this information can contain spaces, uppercase characters, and be more than 8 characters long.
The home directory is the full path to a directory
on the system. This is the user's starting directory
when the user logs in. A common convention is to put
all user home directories under
. Each user
stores their personal files and subdirectories in
their own home directory.
The shell provides the user's default environment for interacting with the system. There are many different kinds of shells and experienced users will have their own preferences, which can be reflected in their account settings.
The superuser account, usually called
, is used to
manage the system with no limitations on privileges. For
this reason, it should not be used for day-to-day tasks like
sending and receiving mail, general exploration of the
system, or programming.
The superuser, unlike other user accounts, can operate without limits, and misuse of the superuser account may result in spectacular disasters. User accounts are unable to destroy the operating system by mistake, so it is recommended to login as a user account and to only become the superuser when a command requires extra privilege.
Always double and triple-check any commands issued as the superuser, since an extra space or missing character can mean irreparable data loss.
There are several ways to gain superuser privilege.
While one can log in as
, this is
highly discouraged.
Instead, use su(1) to become the superuser. If
is specified when running this command,
the user will also inherit the root user's environment. The
user running this command must be in the
group or
else the command will fail. The user must also know the
password for the
In this example, the user only becomes superuser in
order to run make install
as this step
requires superuser privilege. Once the command completes,
the user types exit
to leave the
superuser account and return to the privilege of their user
The built-in su(1) framework works well for single systems or small networks with just one system administrator. An alternative is to install the security/sudo package or port. This software provides activity logging and allows the administrator to configure which users can run which commands as the superuser.
FreeBSD provides a variety of different commands to manage user accounts. The most common commands are summarized in Table 4.1, "Utilities for Managing User Accounts", followed by some examples of their usage. See the manual page for each utility for more details and usage examples.
Command | Summary |
adduser(8) | The recommended command-line application for adding new users. |
rmuser(8) | The recommended command-line application for removing users. |
chpass(1) | A flexible tool for changing user database information. |
passwd(1) | The command-line tool to change user passwords. |
pw(8) | A powerful and flexible tool for modifying all aspects of user accounts. |
The recommended program for adding new users is
adduser(8). When a new user is added, this program
automatically updates /etc/passwd
. It also creates a home
directory for the new user, copies in the default
configuration files from
, and can optionally
mail the new user a welcome message. This utility must be
run as the superuser.
The adduser(8) utility is interactive and walks
through the steps for creating a new user account. As seen
in Example 4.2, "Adding a User on FreeBSD", either input
the required information or press Return
to accept the default value shown in square brackets.
In this example, the user has been invited into the
allowing them to become the superuser with su(1).
When finished, the utility will prompt to either
create another user or to exit.
Since the password is not echoed when typed, be careful to not mistype the password when creating the user account.
To completely remove a user from the system, run rmuser(8) as the superuser. This command performs the following steps:
Removes the user's crontab(1) entry, if one exists.
Removes any at(1) jobs belonging to the user.
Kills all processes owned by the user.
Removes the user from the system's local password file.
Optionally removes the user's home directory, if it is owned by the user.
Removes the incoming mail files belonging to the
user from /var/mail
Removes all files owned by the user from temporary
file storage areas such as
Finally, removes the username from all groups to
which it belongs in /etc/group
. If
a group becomes empty and the group name is the same as
the username, the group is removed. This complements
the per-user unique groups created by
rmuser(8) cannot be used to remove superuser accounts since that is almost always an indication of massive destruction.
By default, an interactive mode is used, as shown in the following example.
Interactive Account
RemovalAny user can use chpass(1) to change their default shell and personal information associated with their user account. The superuser can use this utility to change additional account information for any user.
When passed no options, aside from an optional username, chpass(1) displays an editor containing user information. When the user exits from the editor, the user database is updated with the new information.
This utility will prompt for the user's password when exiting the editor, unless the utility is run as the superuser.
In Example 4.4, "Using chpass
Superuser", the
superuser has typed chpass jru
and is
now viewing the fields that can be changed for this user.
If jru
runs this
command instead, only the last six fields will be displayed
and available for editing. This is shown in
Example 4.5, "Using chpass
as Regular
as Regular
UserThe commands chfn(1) and chsh(1) are links
to chpass(1), as are ypchpass(1), ypchfn(1),
and ypchsh(1). Since NIS support
is automatic, specifying the yp
the command is not necessary. How to configure NIS is
covered in Chapter 28, Network Servers.
Any user can easily change their password using passwd(1). To prevent accidental or unauthorized changes, this command will prompt for the user's original password before a new password can be set:
The superuser can change any user's password by specifying the username when running passwd(1). When this utility is run as the superuser, it will not prompt for the user's current password. This allows the password to be changed when a user cannot remember the original password.
As with chpass(1), yppasswd(1) is a link to passwd(1), so NIS works with either command.
The pw(8) utility can create, remove, modify, and display users and groups. It functions as a front end to the system user and group files. pw(8) has a very powerful set of command line options that make it suitable for use in shell scripts, but new users may find it more complicated than the other commands presented in this section.
FreeBSD provides several methods for an administrator to limit the amount of system resources an individual may use. These limits are discussed in two sections: disk quotas and other resource limits.
Disk quotas limit the amount of disk space available to users and provide a way to quickly check that usage without calculating it every time. Quotas are discussed in Section 18.13, "File System Quotas".
The other resource limits include ways to limit the amount of CPU, memory, and other resources a user may consume. These are defined using login classes and are discussed here.
Login classes are defined in
and are described in
detail in login.conf(5). Each user account is assigned
to a login class, default
by default, and
each login class has a set of login capabilities associated
with it. A login capability is a
pair, where
is a well-known identifier and
is an arbitrary string which
is processed accordingly depending on the
. Setting up login classes and
capabilities is rather straightforward and is also described
in login.conf(5).
FreeBSD does not normally read the configuration in
directly, but instead
reads the /etc/login.conf.db
which provides faster lookups. Whenever
is edited, the
must be updated by
executing the following command:
Resource limits differ from the default login capabilities in two ways. First, for every limit, there is a soft (current) and hard limit. A soft limit may be adjusted by the user or application, but may not be set higher than the hard limit. The hard limit may be lowered by the user, but can only be raised by the superuser. Second, most resource limits apply per process to a specific user, not to the user as a whole. These differences are mandated by the specific handling of the limits, not by the implementation of the login capability framework.
Below are the most commonly used resource limits. The rest of the limits, along with all the other login capabilities, can be found in login.conf(5).
The limit on the size of a core file
generated by a program is subordinate to other limits
on disk usage, such as filesize
, or
disk quotas. This limit is often used as a less-severe
method of controlling disk space consumption. Since
users do not generate core files themselves, and often
do not delete them, setting this may save them from
running out of disk space should a large program
The maximum amount of CPU time a user's process may consume. Offending processes will be killed by the kernel.
The maximum size of a file the user may own. Unlike disk quotas, this limit is enforced on individual files, not the set of all files a user owns.
The maximum number of processes
a user can run. This includes foreground and background
processes. This limit may not be larger than the system
limit specified by the kern.maxproc
sysctl(8). Setting this limit too small may hinder
a user's productivity as it is often useful to be logged
in multiple times or to execute pipelines. Some tasks,
such as compiling a large program, start lots of
The maximum amount of memory a process may request to be locked into main memory using mlock(2). Some system-critical programs, such as amd(8), lock into main memory so that if the system begins to swap, they do not contribute to disk thrashing.
The maximum amount of memory a process may consume at any given time. It includes both core memory and swap usage. This is not a catch-all limit for restricting memory consumption, but is a good start.
The maximum number of files a process may have open
In FreeBSD, files are used to represent sockets and IPC
channels, so be careful not to set this too low. The
system-wide limit for this is defined by the
The limit on the amount of network memory, and thus mbufs , a user may consume. This can be generally used to limit network communications.
The maximum size of a process stack . This alone is not sufficient to limit the amount of memory a program may use so it should be used in conjunction with other limits.
There are a few other things to remember when setting resource limits. Following are some general tips, suggestions, and miscellaneous comments.
Processes started at system startup by
are assigned to the
login class.
Although the /etc/login.conf
comes with the system is a good source of reasonable
values for most limits, they may not be appropriate for
every system. Setting a limit too high may open the
system up to abuse, while setting it too low may put a
strain on productivity.
Users of Xorg should probably be granted more resources than other users. Xorg by itself takes a lot of resources, but it also encourages users to run more programs simultaneously.
Many limits apply to individual processes, not the
user as a whole. For example, setting
to 50 means that each process
the user runs may open up to 50 files. The total amount
of files a user may open is the value of
multiplied by the value of
. This also applies to memory
For further information on resource limits and login classes and capabilities in general, refer to cap_mkdb(1), getrlimit(2), and login.conf(5).
A group is a list of users. A group is identified by its group name and GID. In FreeBSD, the kernel uses the UID of a process, and the list of groups it belongs to, to determine what the process is allowed to do. Most of the time, the GID of a user or process usually means the first group in the list.
The group name to GID mapping is listed
in /etc/group
. This is a plain text file
with four colon-delimited fields. The first field is the
group name, the second is the encrypted password, the third
the GID, and the fourth the comma-delimited
list of members. For a more complete description of the
syntax, refer to group(5).
The superuser can modify /etc/group
using a text editor. Alternatively, pw(8) can be used to
add and edit groups. For example, to add a group called
and then
confirm that it exists:
In this example, 1100
is the
GID of
. Right
now, teamtwo
has no
members. This command will add
as a member of
The argument to -M
is a comma-delimited
list of users to be added to a new (empty) group or to replace
the members of an existing group. To the user, this group
membership is different from (and in addition to) the user's
primary group listed in the password file. This means that
the user will not show up as a member when using
with pw(8), but will show up
when the information is queried via id(1) or a similar
tool. When pw(8) is used to add a user to a group, it
only manipulates /etc/group
and does not
attempt to read additional data from
In this example, the argument to -m
is a
comma-delimited list of users who are to be added to the
group. Unlike the previous example, these users are appended
to the group and do not replace existing users in the
In this example,
is a member of
the groups jru
For more information about this command and the format of
, refer to pw(8) and
In FreeBSD, every file and directory has an associated set of permissions and several utilities are available for viewing and modifying these permissions. Understanding how permissions work is necessary to make sure that users are able to access the files that they need and are unable to improperly access the files used by the operating system or owned by other users.
This section discusses the traditional UNIX® permissions used in FreeBSD. For finer grained file system access control, refer to Section 14.9, "Filesystem Access Control Lists (ACL)s".
In UNIX®, basic permissions are assigned using
three types of access: read, write, and execute. These access
types are used to determine file access to the file's owner,
group, and others (everyone else). The read, write, and execute
permissions can be represented as the letters
, w
, and
. They can also be represented as binary
numbers as each permission is either on or off
). When represented as a number, the
order is always read as rwx
, where
has an on value of 4
has an on value of 2
and x
has an on value of
Table 4.1 summarizes the possible numeric and alphabetic
possibilities. When reading the "Directory
Listing" column, a -
is used to
represent a permission that is set to off.
Value | Permission | Directory Listing |
0 | No read, no write, no execute | --- |
1 | No read, no write, execute | --x |
2 | No read, write, no execute | -w- |
3 | No read, write, execute | -wx |
4 | Read, no write, no execute | r-- |
5 | Read, no write, execute | r-x |
6 | Read, write, no execute | rw- |
7 | Read, write, execute | rwx |
Use the -l
argument to ls(1) to view a
long directory listing that includes a column of information
about a file's permissions for the owner, group, and everyone
else. For example, a ls -l
in an arbitrary
directory may show:
The first (leftmost) character in the first column indicates
whether this file is a regular file, a directory, a special
character device, a socket, or any other special pseudo-file
device. In this example, the -
indicates a
regular file. The next three characters, rw-
in this example, give the permissions for the owner of the file.
The next three characters, r--
, give the
permissions for the group that the file belongs to. The final
three characters, r--
, give the permissions
for the rest of the world. A dash means that the permission is
turned off. In this example, the permissions are set so the
owner can read and write to the file, the group can read the
file, and the rest of the world can only read the file.
According to the table above, the permissions for this file
would be 644
, where each digit represents the
three parts of the file's permission.
How does the system control permissions on devices? FreeBSD
treats most hardware devices as a file that programs can open,
read, and write data to. These special device files are
stored in /dev/
Directories are also treated as files. They have read, write, and execute permissions. The executable bit for a directory has a slightly different meaning than that of files. When a directory is marked executable, it means it is possible to change into that directory using cd(1). This also means that it is possible to access the files within that directory, subject to the permissions on the files themselves.
In order to perform a directory listing, the read permission must be set on the directory. In order to delete a file that one knows the name of, it is necessary to have write and execute permissions to the directory containing the file.
There are more permission bits, but they are primarily used in special circumstances such as setuid binaries and sticky directories. For more information on file permissions and how to set them, refer to chmod(1).
Symbolic permissions use characters instead of octal values to assign permissions to files or directories. Symbolic permissions use the syntax of (who) (action) (permissions), where the following values are available:
Option | Letter | Represents |
(who) | u | User |
(who) | g | Group owner |
(who) | o | Other |
(who) | a | All ("world") |
(action) | + | Adding permissions |
(action) | - | Removing permissions |
(action) | = | Explicitly set permissions |
(permissions) | r | Read |
(permissions) | w | Write |
(permissions) | x | Execute |
(permissions) | t | Sticky bit |
(permissions) | s | Set UID or GID |
These values are used with chmod(1), but with
letters instead of numbers. For example, the following
command would block other users from accessing
A comma separated list can be provided when more than one
set of changes to a file must be made. For example, the
following command removes the group and
"world" write permission on
, and adds the execute
permissions for everyone:
In addition to file permissions, FreeBSD supports the use of
"file flags". These flags add an additional
level of security and control over files, but not directories.
With file flags, even
can be
prevented from removing or altering files.
File flags are modified using chflags(1). For
example, to enable the system undeletable flag on the file
, issue the following
To disable the system undeletable flag, put a
"no" in front of the
To view the flags of a file, use -lo
Several file flags may only be added or removed by the
user. In other
cases, the file owner may set its file flags. Refer to
chflags(1) and chflags(2) for more
Other than the permissions already discussed, there are
three other specific settings that all administrators should
know about. They are the setuid
, and sticky
These settings are important for some UNIX® operations as they provide functionality not normally granted to normal users. To understand them, the difference between the real user ID and effective user ID must be noted.
The real user ID is the UID who owns
or starts the process. The effective UID
is the user ID the process runs as. As an example,
passwd(1) runs with the real user ID when a user changes
their password. However, in order to update the password
database, the command runs as the effective ID of the
user. This
allows users to change their passwords without seeing a
Permission Denied error.
The setuid permission may be set by prefixing a permission set with the number four (4) as shown in the following example:
The permissions on
now look like the following:
Note that a s
is now part of the
permission set designated for the file owner, replacing the
executable bit. This allows utilities which need elevated
permissions, such as passwd(1).
The nosuid
mount(8) option will
cause such binaries to silently fail without alerting
the user. That option is not completely reliable as a
wrapper may be able to circumvent
To view this in real time, open two terminals. On
one, type passwd
as a normal user.
While it waits for a new password, check the process
table and look at the user information for
In terminal A:
In terminal B:
Although passwd(1) is run as a normal user, it is
using the effective UID of
The setgid
permission performs the
same function as the setuid
except that it alters the group settings. When an application
or utility executes with this setting, it will be granted the
permissions based on the group that owns the file, not the
user who started the process.
To set the setgid
permission on a
file, provide chmod(1) with a leading two (2):
In the following listing, notice that the
is now in the field designated for the
group permission settings:
In these examples, even though the shell script in question is an executable file, it will not run with a different EUID or effective user ID. This is because shell scripts may not access the setuid(2) system calls.
The setuid
permission bits may lower system
security, by allowing for elevated permissions. The third
special permission, the sticky bit
, can
strengthen the security of a system.
When the sticky bit
is set on a
directory, it allows file deletion only by the file owner.
This is useful to prevent file deletion in public directories,
such as /tmp
, by users
who do not own the file. To utilize this permission, prefix
the permission set with a one (1):
The sticky bit
permission will display
as a t
at the very end of the permission
The FreeBSD directory hierarchy is fundamental to obtaining an overall understanding of the system. The most important directory is root or, "/". This directory is the first one mounted at boot time and it contains the base system necessary to prepare the operating system for multi-user operation. The root directory also contains mount points for other file systems that are mounted during the transition to multi-user operation.
A mount point is a directory where additional file systems
can be grafted onto a parent file system (usually the root file
system). This is further described in
Section 4.6, "Disk Organization". Standard mount points
include /usr/
, /var/
, /mnt/
, and
. These directories are usually
referenced to entries in /etc/fstab
. This
file is a table of various file systems and mount points and is
read by the system. Most of the file systems in
are mounted automatically at
boot time from the script rc(8) unless their entry includes
. Details can be found in
Section 4.7.1, "The fstab
A complete description of the file system hierarchy is available in hier(7). The following table provides a brief overview of the most common directories.
Directory | Description |
/ | Root directory of the file system. |
/bin/ | User utilities fundamental to both single-user and multi-user environments. |
/boot/ | Programs and configuration files used during operating system bootstrap. |
/boot/defaults/ | Default boot configuration files. Refer to loader.conf(5) for details. |
/dev/ | Device nodes. Refer to intro(4) for details. |
/etc/ | System configuration files and scripts. |
/etc/defaults/ | Default system configuration files. Refer to rc(8) for details. |
/etc/mail/ | Configuration files for mail transport agents such as sendmail(8). |
/etc/namedb/ | named(8) configuration files. |
/etc/periodic/ | Scripts that run daily, weekly, and monthly, via cron(8). Refer to periodic(8) for details. |
/etc/ppp/ | ppp(8) configuration files. |
/mnt/ | Empty directory commonly used by system administrators as a temporary mount point. |
/proc/ | Process file system. Refer to procfs(5), mount_procfs(8) for details. |
/rescue/ | Statically linked programs for emergency recovery as described in rescue(8). |
/root/ | Home directory for the
account. |
/sbin/ | System programs and administration utilities fundamental to both single-user and multi-user environments. |
/tmp/ | Temporary files which are usually
not preserved across a system
reboot. A memory-based file system is often mounted
at /tmp . This can be automated
using the tmpmfs-related variables of rc.conf(5)
or with an entry in /etc/fstab ;
refer to mdmfs(8) for details. |
/usr/ | The majority of user utilities and applications. |
/usr/bin/ | Common utilities, programming tools, and applications. |
/usr/include/ | Standard C include files. |
/usr/lib/ | Archive libraries. |
/usr/libdata/ | Miscellaneous utility data files. |
/usr/libexec/ | System daemons and system utilities executed by other programs. |
/usr/local/ | Local executables and libraries. Also used as
the default destination for the FreeBSD ports framework.
Within /usr/local , the general
layout sketched out by hier(7) for
/usr should be used. Exceptions
are the man directory, which is directly under
/usr/local rather than under
/usr/local/share , and the ports
documentation is in
share/doc/port . |
/usr/obj/ | Architecture-specific target tree produced by
building the /usr/src
tree. |
/usr/ports/ | The FreeBSD Ports Collection (optional). |
/usr/sbin/ | System daemons and system utilities executed by users. |
/usr/share/ | Architecture-independent files. |
/usr/src/ | BSD and/or local source files. |
/var/ | Multi-purpose log, temporary, transient, and
spool files. A memory-based file system is sometimes
mounted at
/var . This can
be automated using the varmfs-related variables in
rc.conf(5) or with an entry in
/etc/fstab ; refer to
mdmfs(8) for details. |
/var/log/ | Miscellaneous system log files. |
/var/mail/ | User mailbox files. |
/var/spool/ | Miscellaneous printer and mail system spooling directories. |
/var/tmp/ | Temporary files which are usually preserved
across a system reboot, unless
/var is a
memory-based file system. |
/var/yp/ | NIS maps. |
The smallest unit of organization that FreeBSD uses to find
files is the filename. Filenames are case-sensitive, which
means that readme.txt
are two separate files. FreeBSD
does not use the extension of a file to determine whether the
file is a program, document, or some other form of data.
Files are stored in directories. A directory may contain no files, or it may contain many hundreds of files. A directory can also contain other directories, allowing a hierarchy of directories within one another in order to organize data.
Files and directories are referenced by giving the file or
directory name, followed by a forward slash,
, followed by any other directory names that
are necessary. For example, if the directory
contains a directory
which contains the
file readme.txt
, the full name, or
path, to the file is
. Note that this is
different from Windows® which uses \
separate file and directory names. FreeBSD does not use drive
letters, or other drive names in the path. For example, one
would not type c:\foo\bar\readme.txt
Directories and files are stored in a file system. Each
file system contains exactly one directory at the very top
level, called the root directory for that
file system. This root directory can contain other directories.
One file system is designated the
root file system or /
Every other file system is mounted under
the root file system. No matter how many disks are on the FreeBSD
system, every directory appears to be part of the same
Consider three file systems, called A
, and C
. Each file
system has one root directory, which contains two other
directories, called A1
(and likewise B1
Call A
the root file system. If
ls(1) is used to view the contents of this directory,
it will show two subdirectories, A1
. The directory tree looks like
A file system must be mounted on to a directory in another
file system. When mounting file system B
on to the directory A1
, the root directory
of B
replaces A1
, and
the directories in B
Any files that are in the B1
directories can be reached with the path
as necessary. Any
files that were in /A1
have been temporarily hidden. They will reappear if
is unmounted from
If B
had been mounted on
then the diagram would look like
and the paths would be
File systems can be mounted on top of one another.
Continuing the last example, the C
system could be mounted on top of the B1
directory in the B
file system, leading to
this arrangement:
Or C
could be mounted directly on to the
file system, under the
It is entirely possible to have one large root file system, and not need to create any others. There are some drawbacks to this approach, and one advantage.
Different file systems can have different
mount options. For example, the root
file system can be mounted read-only, making it impossible
for users to inadvertently delete or edit a critical file.
Separating user-writable file systems, such as
, from other
file systems allows them to be mounted
nosuid. This option prevents the
suid/guid bits
on executables stored on the file system from taking effect,
possibly improving security.
FreeBSD automatically optimizes the layout of files on a file system, depending on how the file system is being used. So a file system that contains many small files that are written frequently will have a different optimization to one that contains fewer, larger files. By having one big file system this optimization breaks down.
FreeBSD's file systems are robust if power is lost. However, a power loss at a critical point could still damage the structure of the file system. By splitting data over multiple file systems it is more likely that the system will still come up, making it easier to restore from backup as necessary.
File systems are a fixed size. If you create a file system when you install FreeBSD and give it a specific size, you may later discover that you need to make the partition bigger. This is not easily accomplished without backing up, recreating the file system with the new size, and then restoring the backed up data.
FreeBSD features the growfs(8) command, which makes it possible to increase the size of file system on the fly, removing this limitation.
File systems are contained in partitions. This does not
have the same meaning as the common usage of the term partition
(for example, MS-DOS® partition), because of FreeBSD's UNIX®
heritage. Each partition is identified by a letter from
through to h
. Each
partition can contain only one file system, which means that
file systems are often described by either their typical mount
point in the file system hierarchy, or the letter of the
partition they are contained in.
FreeBSD also uses disk space for swap space to provide virtual memory. This allows your computer to behave as though it has much more memory than it actually does. When FreeBSD runs out of memory, it moves some of the data that is not currently being used to the swap space, and moves it back in (moving something else out) when it needs it.
Some partitions have certain conventions associated with them.
Partition | Convention |
a | Normally contains the root file system. |
b | Normally contains swap space. |
c | Normally the same size as the enclosing slice.
This allows utilities that need to work on the entire
slice, such as a bad block scanner, to work on the
c partition. A file system would not
normally be created on this partition. |
d | Partition d used to have a
special meaning associated with it, although that is now
gone and d may work as any normal
partition. |
Disks in FreeBSD are divided into slices, referred to in Windows® as partitions, which are numbered from 1 to 4. These are then divided into partitions, which contain file systems, and are labeled using letters.
Slice numbers follow the device name, prefixed with an
, starting at 1. So
"da0s1" is the first slice on
the first SCSI drive. There can only be four physical slices on
a disk, but there can be logical slices inside physical slices
of the appropriate type. These extended slices are numbered
starting at 5, so "ad0s5" is
the first extended slice on the first IDE disk. These devices
are used by file systems that expect to occupy a slice.
Slices, "dangerously dedicated" physical
drives, and other drives contain
partitions, which are represented as
letters from a
to h
. This
letter is appended to the device name, so
"da0a" is the
partition on the first
drive, which is
"dangerously dedicated".
"ad1s3e" is the fifth
partition in the third slice of the second IDE disk
Finally, each disk on the system is identified. A disk name starts with a code that indicates the type of disk, and then a number, indicating which disk it is. Unlike slices, disk numbering starts at 0. Common codes are listed in Table 4.3, "Disk Device Codes".
When referring to a partition, include the disk name,
, the slice number, and then the partition
letter. Examples are shown in
Example 4.12, "Sample Disk, Slice, and Partition Names".
Example 4.13, "Conceptual Model of a Disk" shows a conceptual model of a disk layout.
When installing FreeBSD, configure the disk slices, create partitions within the slice to be used for FreeBSD, create a file system or swap space in each partition, and decide where each file system will be mounted.
Code | Meaning |
ad | ATAPI (IDE) disk |
da | SCSI direct access disk |
acd | ATAPI (IDE) CDROM |
cd | SCSI CDROM |
fd | Floppy disk |
Name | Meaning |
ad0s1a | The first partition (a ) on the
first slice (s1 ) on the first IDE
disk (ad0 ). |
da1s2e | The fifth partition (e ) on the
second slice (s2 ) on the second
SCSI disk (da1 ). |
This diagram shows FreeBSD's view of the first IDE disk
attached to the system. Assume that the disk is 4 GB in
size, and contains two 2 GB slices (MS-DOS® partitions).
The first slice contains a MS-DOS® disk,
, and the second slice contains a
FreeBSD installation. This example FreeBSD installation has three
data partitions, and a swap partition.
The three partitions will each hold a file system.
Partition a
will be used for the root file
system, e
for the
hierarchy, and f
for the
The file system is best visualized as a tree, rooted, as it
were, at /
, and the other
directories in the root directory are branches, which may have
their own branches, such as
, and so
There are various reasons to house some of these
directories on separate file systems.
contains the
directories log/
, and various types
of temporary files, and as such, may get filled up. Filling up
the root file system is not a good idea, so splitting
is often
Another common reason to contain certain directory trees on other file systems is if they are to be housed on separate physical disks, or are separate virtual disks, such as Network File System mounts, described in Section 28.3, "Network File System (NFS)", or CDROM drives.
During the boot process (Chapter 13, The FreeBSD Booting Process), file
systems listed in /etc/fstab
automatically mounted except for the entries containing
. This file contains entries in the
following format:
An existing device name as explained in Section 18.2, "Device Names".
An existing directory on which to mount the file system.
The file system type to pass to mount(8). The
default FreeBSD file system is
Either rw
for read-write file
systems, or ro
for read-only file
systems, followed by any other options that may be
needed. A common option is noauto
file systems not normally mounted during the boot
sequence. Other options are listed in
Used by dump(8) to determine which file systems require dumping. If the field is missing, a value of zero is assumed.
Determines the order in which file systems should be
checked. File systems that should be skipped should
have their passno
set to zero. The
root file system needs to be checked before everything
else and should have its passno
to one. The other file systems should be set to
values greater than one. If more than one file system
has the same passno
, fsck(8)
will attempt to check file systems in parallel if
Refer to fstab(5) for more information on the format
of /etc/fstab
and its options.
File systems are mounted using mount(8). The most basic syntax is as follows:
This command provides many options which are described in mount(8), The most commonly used options include:
Mount all the file systems listed in
, except those marked as
"noauto", excluded by the
flag, or those that are already
Do everything except for the actual mount system
call. This option is useful in conjunction with the
flag to determine what mount(8)
is actually trying to do.
Force the mount of an unclean file system (dangerous), or the revocation of write access when downgrading a file system's mount status from read-write to read-only.
Mount the file system read-only. This is identical
to using -o ro
Mount the specified file system type or mount only
file systems of the given type, if -a
is included. "ufs" is the default file
system type.
Update mount options on the file system.
Be verbose.
Mount the file system read-write.
The following options can be passed to -o
as a comma-separated list:
Do not interpret setuid or setgid flags on the file system. This is also a useful security option.
To unmount a file system use umount(8). This command
takes one parameter which can be a mountpoint, device name,
or -A
All forms take -f
to force unmounting,
and -v
for verbosity. Be warned that
is not generally a good idea as it might
crash the computer or damage data on the file system.
To unmount all mounted file systems, or just the file
system types listed after -t
, use
or -A
. Note that
does not attempt to unmount the root file
FreeBSD is a multi-tasking operating system. Each program running at any one time is called a process. Every running command starts at least one new process and there are a number of system processes that are run by FreeBSD.
Each process is uniquely identified by a number called a
process ID (PID).
Similar to files, each process has one owner and group, and
the owner and group permissions are used to determine which
files and devices the process can open. Most processes also
have a parent process that started them. For example, the
shell is a process, and any command started in the shell is a
process which has the shell as its parent process. The
exception is a special process called init(8) which is
always the first process to start at boot time and which always
has a PID of 1
Some programs are not designed to be run with continuous user input and disconnect from the terminal at the first opportunity. For example, a web server responds to web requests, rather than user input. Mail servers are another example of this type of application. These types of programs are known as daemons. The term daemon comes from Greek mythology and represents an entity that is neither good nor evil, and which invisibly performs useful tasks. This is why the BSD mascot is the cheerful-looking daemon with sneakers and a pitchfork.
There is a convention to name programs that normally run as
daemons with a trailing "d". For example,
BIND is the Berkeley Internet Name
Domain, but the actual program that executes is
. The
Apache web server program is
and the line printer spooling daemon
is lpd
. This is only a naming convention.
For example, the main mail daemon for the
Sendmail application is
, and not
To see the processes running on the system, use ps(1) or top(1). To display a static list of the currently running processes, their PIDs, how much memory they are using, and the command they were started with, use ps(1). To display all the running processes and update the display every few seconds in order to interactively see what the computer is doing, use top(1).
By default, ps(1) only shows the commands that are running and owned by the user. For example:
The output from ps(1) is organized into a number of
columns. The PID
column displays the
process ID. PIDs are assigned starting at
1, go up to 99999, then wrap around back to the beginning.
However, a PID is not reassigned if it is
already in use. The TT
column shows the
tty the program is running on and STAT
shows the program's state. TIME
is the
amount of time the program has been running on the CPU. This
is usually not the elapsed time since the program was started,
as most programs spend a lot of time waiting for things to
happen before they need to spend time on the CPU. Finally,
is the command that was used to
start the program.
A number of different options are available to change the
information that is displayed. One of the most useful sets is
, where a
information about all the running processes of all users,
displays the username and memory usage of
the process' owner, x
information about daemon processes, and ww
causes ps(1) to display the full command line for each
process, rather than truncating it once it gets too long to
fit on the screen.
The output from top(1) is similar:
The output is split into two sections. The header (the
first five or six lines) shows the PID of
the last process to run, the system load averages (which are a
measure of how busy the system is), the system uptime (time
since the last reboot) and the current time. The other
figures in the header relate to how many processes are
running, how much memory and swap space has been used, and how
much time the system is spending in different CPU states. If
the system has been formatted with the ZFS
file system, the ARC
line provides an
indication of how much data was read from the memory cache
instead of from disk.
Below the header is a series of columns containing similar information to the output from ps(1), such as the PID, username, amount of CPU time, and the command that started the process. By default, top(1) also displays the amount of memory space taken by the process. This is split into two columns: one for total size and one for resident size. Total size is how much memory the application has needed and the resident size is how much it is actually using now.
top(1) automatically updates the display every two
seconds. A different interval can be specified with
One way to communicate with any running process or daemon
is to send a signal using kill(1).
There are a number of different signals; some have a specific
meaning while others are described in the application's
documentation. A user can only send a signal to a process
they own and sending a signal to someone else's process will
result in a permission denied error. The exception is the
user, who can
send signals to anyone's processes.
The operating system can also send a signal to a process.
If an application is badly written and tries to access memory
that it is not supposed to, FreeBSD will send the process the
"Segmentation Violation" signal
). If an application has been
written to use the alarm(3) system call to be alerted
after a period of time has elapsed, it will be sent the
"Alarm" signal
Two signals can be used to stop a process:
and SIGKILL
is the polite way to kill a process
as the process can read the signal, close any log files it may
have open, and attempt to finish what it is doing before
shutting down. In some cases, a process may ignore
if it is in the middle of some task
that can not be interrupted.
can not be ignored by a
process. Sending a SIGKILL
to a
process will usually stop that process there and then.
Other commonly used signals are SIGHUP
, and SIGUSR2
Since these are general purpose signals, different
applications will respond differently.
For example, after changing a web server's configuration
file, the web server needs to be told to re-read its
configuration. Restarting httpd
result in a brief outage period on the web server. Instead,
send the daemon the SIGHUP
signal. Be
aware that different daemons will have different behavior, so
refer to the documentation for the daemon to determine if
will achieve the desired
This example shows how to send a signal to
inetd(8). The inetd(8) configuration file is
, and inetd(8) will
re-read this configuration file when it is sent a
Find the PID of the process to send the signal to using pgrep(1). In this example, the PID for inetd(8) is 198:
Use kill(1) to send the signal. Because
inetd(8) is owned by
, use
su(1) to become
Like most UNIX® commands, kill(1) will not print
any output if it is successful. If a signal is sent to a
process not owned by that user, the message
kill: PID
: Operation
not permitted will be displayed. Mistyping
the PID will either send the signal to
the wrong process, which could have negative results, or
will send the signal to a PID that is
not currently in use, resulting in the error
kill: PID
: No such
?: Many shells provide kill
as a
built in command, meaning that the shell will send the
signal directly, rather than running
. Be aware that different
shells have a different syntax for specifying the name
of the signal to send. Rather than try to learn all of
them, it can be simpler to specify
When sending other signals, substitute
or KILL
with the
name of the signal.
A shell provides a command line
interface for interacting with the operating system. A shell
receives commands from the input channel and executes them.
Many shells provide built in functions to help with everyday
tasks such as file management, file globbing, command line
editing, command macros, and environment variables. FreeBSD comes
with several shells, including the Bourne shell (sh(1)) and
the extended C shell (tcsh(1)). Other shells are available
from the FreeBSD Ports Collection, such as
and bash
The shell that is used is really a matter of taste. A C
programmer might feel more comfortable with a C-like shell such
as tcsh(1). A Linux® user might prefer
. Each shell has unique properties that
may or may not work with a user's preferred working environment,
which is why there is a choice of which shell to use.
One common shell feature is filename completion. After a
user types the first few letters of a command or filename and
presses Tab, the shell completes the rest of
the command or filename. Consider two files called
and football
To delete foobar
, the user might type
rm foo
and press Tab to
complete the filename.
But the shell only shows rm foo
. It was
unable to complete the filename because both
and football
start with foo
. Some shells sound a beep or
show all the choices if more than one name matches. The user
must then type more characters to identify the desired filename.
Typing a t
and pressing Tab
again is enough to let the shell determine which filename is
desired and fill in the rest.
Another feature of the shell is the use of environment variables. Environment variables are a variable/key pair stored in the shell's environment. This environment can be read by any program invoked by the shell, and thus contains a lot of program configuration. Table 4.4, "Common Environment Variables" provides a list of common environment variables and their meanings. Note that the names of environment variables are always in uppercase.
Variable | Description |
USER | Current logged in user's name. |
PATH | Colon-separated list of directories to search for binaries. |
DISPLAY | Network name of the Xorg display to connect to, if available. |
SHELL | The current shell. |
TERM | The name of the user's type of terminal. Used to determine the capabilities of the terminal. |
TERMCAP | Database entry of the terminal escape codes to perform various terminal functions. |
OSTYPE | Type of operating system. |
MACHTYPE | The system's CPU architecture. |
EDITOR | The user's preferred text editor. |
PAGER | The user's preferred utility for viewing text one page at a time. |
MANPATH | Colon-separated list of directories to search for manual pages. |
How to set an environment variable differs between shells.
In tcsh(1) and csh(1), use
to set environment variables. In
sh(1) and bash
, use
to set the current environment
variables. This example sets the default EDITOR
to /usr/local/bin/emacs
for the
tcsh(1) shell:
The equivalent command for bash
would be:
To expand an environment variable in order to see its
current setting, type a $
character in front
of its name on the command line. For example,
echo $TERM
displays the current
Shells treat special characters, known as meta-characters,
as special representations of data. The most common
meta-character is *
, which represents any
number of characters in a filename. Meta-characters can be used
to perform filename globbing. For example, echo
is equivalent to ls
the shell takes all the files that match *
and echo
lists them on the command
To prevent the shell from interpreting a special character,
escape it from the shell by starting it with a backslash
). For example, echo
prints the terminal setting whereas
echo \$TERM
literally prints the string
The easiest way to permanently change the default shell is
to use chsh
. Running this command will
open the editor that is configured in the
environment variable, which by default
is set to vi(1). Change the Shell:
line to the full path of the new shell.
Alternately, use chsh -s
which will set
the specified shell without opening an editor. For example,
to change the shell to bash
The new shell must be present in
. If the shell was
installed from the FreeBSD Ports Collection as described in
Chapter 5, Installing Applications: Packages and Ports, it should be automatically added
to this file. If it is missing, add it using this command,
replacing the path with the path of the shell:
Then, rerun chsh(1).
The UNIX® shell is not just a command interpreter, it acts as a powerful tool which allows users to execute commands, redirect their output, redirect their input and chain commands together to improve the final command output. When this functionality is mixed with built in commands, the user is provided with an environment that can maximize efficiency.
Shell redirection is the action of sending the output or the input of a command into another command or into a file. To capture the output of the ls(1) command, for example, into a file, simply redirect the output:
The directory_listing.txt
file will
now contain the directory contents. Some commands allow you
to read input in a similar one, such as sort(1). To sort
this listing, redirect the input:
The input will be sorted and placed on the screen. To redirect that input into another file, one could redirect the output of sort(1) by mixing the direction:
In all of the previous examples, the commands are performing redirection using file descriptors. Every unix system has file descriptors; however, here we will focus on three, so named as Standard Input, Standard Output, and Standard Error. Each one has a purpose, where input could be a keyboard or a mouse, something that provides input. Output could be a screen or paper in a printer for example. And error would be anything that is used for diagnostic or error messages. All three are considered I/O based file descriptors and sometimes considered streams.
Through the use of these descriptors, short named stdin, stdout, and stderr, the shell allows output and input to be passed around through various commands and redirected to or from a file. Another method of redirection is the pipe operator.
The UNIX® pipe operator, "|" allows the output of one command to be directly passed, or directed to another program. Basically a pipe will allow the standard output of a command to be passed as standard input to another command, for example:
In that example, the contents of
will be sorted and
the output passed to less(1). This allows the user
to scroll through the output at their own pace and prevent
it from scrolling off the screen.
Most FreeBSD configuration is done by editing text files. Because of this, it is a good idea to become familiar with a text editor. FreeBSD comes with a few as part of the base system, and many more are available in the Ports Collection.
A simple editor to learn is ee(1), which stands for
easy editor. To start this editor, type ee
is the name of the file to
be edited. Once inside the editor, all of the commands for
manipulating the editor's functions are listed at the top of the
display. The caret (^
) represents
Ctrl, so ^e
expands to
Ctrl+e. To leave ee(1), press Esc,
then choose the "leave editor" option from the main
menu. The editor will prompt to save any changes if the file
has been modified.
FreeBSD also comes with more powerful text editors, such as vi(1), as part of the base system. Other editors, like editors/emacs and editors/vim, are part of the FreeBSD Ports Collection. These editors offer more functionality at the expense of being more complicated to learn. Learning a more powerful editor such as vim or Emacs can save more time in the long run.
Many applications which modify files or require typed input
will automatically open a text editor. To change the default
editor, set the EDITOR
variable as described in Section 4.9, "Shells".
A device is a term used mostly for hardware-related
activities in a system, including disks, printers, graphics
cards, and keyboards. When FreeBSD boots, the majority of the boot
messages refer to devices being detected. A copy of the boot
messages are saved to
Each device has a device name and number. For example,
is the first IDE CD-ROM drive,
while kbd0
represents the
Most devices in a FreeBSD must be accessed through special
files called device nodes, which are located in
The most comprehensive documentation on FreeBSD is in the form
of manual pages. Nearly every program on the system comes with
a short reference manual explaining the basic operation and
available arguments. These manuals can be viewed using
where command
is the name of the
command to learn about. For example, to learn more about
ls(1), type:
Manual pages are divided into sections which represent the type of topic. In FreeBSD, the following sections are available:
User commands.
System calls and error numbers.
Functions in the C libraries.
Device drivers.
File formats.
Games and other diversions.
Miscellaneous information.
System maintenance and operation commands.
System kernel interfaces.
In some cases, the same topic may appear in more than one
section of the online manual. For example, there is a
user command and a
system call. To tell man(1)
which section to display, specify the section number:
This will display the manual page for the user command chmod(1). References to a particular section of the online manual are traditionally placed in parenthesis in written documentation, so chmod(1) refers to the user command and chmod(2) refers to the system call.
If the name of the manual page is unknown, use man
to search for keywords in the manual page
This command displays a list of commands that have the keyword "mail" in their descriptions. This is equivalent to using apropos(1).
To read the descriptions for the commands in
, type:
FreeBSD includes many applications and utilities produced by
the Free Software Foundation (FSF). In addition to manual
pages, these programs may include hypertext documents called
files. These can be viewed using
info(1) or, if editors/emacs is
installed, the info mode of
To use info(1), type:
For a brief introduction, type h
. For
a quick command reference, type ?
[1] There are a few tasks that can not be interrupted. For example, if the process is trying to read from a file that is on another computer on the network, and the other computer is unavailable, the process is said to be "uninterruptible". Eventually the process will time out, typically after two minutes. As soon as this time out occurs the process will be killed.
FreeBSD is bundled with a rich collection of system tools as part of the base system. In addition, FreeBSD provides two complementary technologies for installing third-party software: the FreeBSD Ports Collection, for installing from source, and packages, for installing from pre-built binaries. Either method may be used to install software from local media or from the network.
After reading this chapter, you will know:
The difference between binary packages and ports.
How to find third-party software that has been ported to FreeBSD.
How to manage binary packages using pkgng.
How to build third-party software from source using the Ports Collection.
How to find the files installed with the application for post-installation configuration.
What to do if a software installation fails.
The typical steps for installing third-party software on a UNIX® system include:
Find and download the software, which might be distributed in source code format or as a binary.
Unpack the software from its distribution format. This is typically a tarball compressed with compress(1), gzip(1), or bzip2(1).
Locate the documentation in
or some file in a doc/
subdirectory and
read up on how to install the software.
If the software was distributed in source format,
compile it. This may involve editing a
or running a
Test and install the software.
If the software package was not deliberately ported, or tested to work, on FreeBSD, the source code may need editing in order for it to install and run properly. At the time of this writing, over 24,000 third-party applications have been ported to FreeBSD.
A FreeBSD package contains pre-compiled copies of all the
commands for an application, as well as any configuration files
and documentation. A package can be manipulated with the
pkgng commands, such as
pkg install
A FreeBSD port is a collection of files designed to automate the process of compiling an application from source code. The files that comprise a port contain all the necessary information to automatically download, extract, patch, compile, and install the application.
The ports system can also be used to generate packages which can be manipulated with the FreeBSD package management commands.
Both packages and ports understand dependencies. If a package or port is used to install an application and a dependent library is not already installed, the library will automatically be installed first.
While the two technologies are similar, packages and ports each have their own strengths. Select the technology that meets your requirements for installing a particular application.
A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application.
Packages do not require compilation time. For large applications, such as Mozilla, KDE, or GNOME, this can be important on a slow system.
Packages do not require any understanding of the process involved in compiling software on FreeBSD.
Packages are normally compiled with conservative options because they have to run on the maximum number of systems. By compiling from the port, one can change the compilation options.
Some applications have compile-time options relating to which features are installed. For example, Apache can be configured with a wide variety of different built-in options.
In some cases, multiple packages will exist for the same
application to specify certain settings. For example,
Ghostscript is available as a
package and a
package, depending on
whether or not Xorg is installed.
Creating multiple packages rapidly becomes impossible if an
application has more than one or two different compile-time
The licensing conditions of some software forbid binary distribution. Such software must be distributed as source code which must be compiled by the end-user.
Some people do not trust binary distributions or prefer to read through source code in order to look for potential problems.
Source code is needed in order to apply custom patches.
To keep track of updated ports, subscribe to the FreeBSD ports mailing list and the FreeBSD ports bugs mailing list.
Before installing any application, check http://vuxml.freebsd.org/
for security issues related to the application or install
ports-mgmt/portaudit. Once installed, type
portaudit -F -a
to check all installed
applications for known vulnerabilities.
The remainder of this chapter explains how to use packages and ports to install and manage third-party software on FreeBSD.
FreeBSD's list of available applications is growing all the time. There are a number of ways to find software to install:
The FreeBSD web site maintains an up-to-date searchable list of all the available applications, at http://www.FreeBSD.org/ports/. The ports can be searched by application name or by software category.
Dan Langille maintains FreshPorts.org which provides a comprehensive search utility and also tracks changes to the applications in the Ports Collection. Registered users can create a customized watch list in order to receive an automated email when their watched ports are updated.
If you do not know the name of an application, try using a site like Freecode.com to find an application, then check back at the FreeBSD site to see if the application has been ported yet.
If the Ports Collection is already installed, there are
several methods to query the local version of the ports
tree. To find out which category a port is in, type
whereis file
where file
is the program to be
Alternately, an echo(1) statement can be used:
Note that this will also return any matched files
downloaded into the
Another way to find software is by using the Ports
Collection's built-in search mechanism. To use the search
feature, cd to
then run make
search name=program-name
is the name of the
software. For example, to search for
The built-in search mechanism uses a file
of index information. If a message indicates that the
is required, run
make fetchindex
to download the current
index file. With the INDEX
make search
will be able to perform the
requested search.
The "Path:" line indicates where to find the port.
To receive less information, use the
For more in-depth searching, use
make search
make quicksearch
, where
is some text to search
for. The text can be in comments, descriptions, or
dependencies in order to find ports which relate to a
particular subject when the name of the program is
When using search
, the search string
is case-insensitive. Searching for "LSOF" will
yield the same results as searching for
pkgng is the next generation replacement for the traditional FreeBSD package management tools, offering many features that make dealing with binary packages faster and easier.
pkgng is not a replacement for port management tools like ports-mgmt/portmaster or ports-mgmt/portupgrade. These tools can be used to install third-party software from both binary packages and the Ports Collection, while pkgng installs only binary packages.
FreeBSD 8.4 and later includes a bootstrap utility which can be used to download and install pkgng, along with its manual pages.
To bootstrap the system, run:
For earlier FreeBSD versions, pkgng must instead be installed from the Ports Collection or as a binary package.
To install the port, run:
To install the binary package, run:
Once pkgng is installed, the package database must be converted from the traditional format to the new format by running this command:
This step is not required for new installations that do not yet have any third-party software installed.
This step is not reversible. Once the package database
has been converted to the pkgng
format, the traditional pkg_*
should not be used.
The package database conversion may emit errors as the
contents are converted to the new version. Generally, these
errors can be safely ignored. However, a list of
third-party software that was not successfully converted
will be listed after pkg2ng
has finished
and these applications must be manually reinstalled.
To ensure that the FreeBSD Ports Collection registers
new software with pkgng, and not
the traditional packages format, FreeBSD versions earlier than
require this line in
The pkgng package management
system uses a package repository for most operations. The
default package repository location is defined in
or by the
environment variable, which
overrides the configuration file.
Additional pkgng configuration options are described in pkg.conf(5).
Usage information for pkgng is
available in pkg(8) or by running
without additional arguments.
Each pkgng command argument is
documented in a command-specific manual page. To read the
manual page for pkg install
, for example,
run either of these commands:
The rest of this section demonstrates common binary package management tasks which can be performed using pkgng. Each demonstrated command provides many switches to customize its use. Refer to a command's help or man page for details and more examples.
Information about the packages installed on a system
can be viewed by running pkg info
when run without any switches, will list the package version
for either all installed packages or the specified
For example, to see which version of pkgng is installed, run:
To install a binary package use the following command,
where packagename
is the name of
the package to install:
This command uses repository data to determine which version of the software to install and if it has any uninstalled dependencies. For example, to install curl:
The new package and any additional packages that were installed as dependencies can be seen in the installed packages list:
Packages that are no longer needed can be removed with
pkg delete
. For example:
Packages that are outdated can be found with
pkg version
. If a local ports tree
does not exist, pkg-version(8) will use the remote
repository catalogue. Otherwise, the local ports tree will
be used to identify package versions.
Installed packages can be upgraded to their latest
versions by typing pkg upgrade
. This
command will compare the installed versions with those
available in the repository catalogue. When finished, it
will list the applications that have newer versions. Type
to proceed with the upgrade or
to cancel the upgrade.
Occasionally, software vulnerabilities may be discovered in third-party applications. To address this, pkgng includes a built-in auditing mechanism. To determine if there are any known vulnerabilities for the software installed on the system, run:
Removing a package may leave behind dependencies which are no longer required. Unneeded packages that were installed as dependencies can be automatically detected and removed using:
Unlike the traditional package management system,
pkgng includes its own package
database backup mechanism. To manually back up the contents
of the package database, run the following command, replacing
with a suitable file
Additionally, pkgng includes
a periodic(8) script to automatically perform a daily
back up of the package database. This functionality is
enabled if daily_backup_pkgng_enable
set to YES
in periodic.conf(5).
To disable the periodic script from backing up the
package database, set daily_backup_pkgdb_
to NO
To restore the contents of a previous package database backup, run:
By default, pkgng stores
binary packages in a cache directory defined by
in pkg.conf(5). When upgrading
packages with pkg upgrade
, old versions
of the upgraded packages are not automatically removed.
To remove these outdated binary packages, run:
Software within the FreeBSD Ports Collection can
undergo major version number changes. To address this,
pkgng has a built-in command to
update package origins. This can be useful, for example, if
lang/php5 is renamed to
lang/php53 so that
lang/php5 can now
represent version 5.4
To change the package origin for the above example, run:
As another example, to update lang/ruby18 to lang/ruby19, run:
As a final example, to change the origin of the
shared libraries from
graphics/libglut to
graphics/freeglut, run:
When changing package origins, it is important to reinstall packages that are dependent on the package with the modified origin. To force a reinstallation of dependent packages, run:
The Ports Collection is a set of
, patches, and description files
stored in /usr/ports
This set of files is used to compile and install applications
on FreeBSD. Before an application can be compiled using a port,
the Ports Collection must first be installed. If it was not
installed during the installation of FreeBSD, use one of the
following methods to install it:
The base system of FreeBSD includes Portsnap. This is a fast and user-friendly tool for retrieving the Ports Collection and is the recommended choice for most users. This utility connects to a FreeBSD site, verifies the secure key, and downloads a new copy of the Ports Collection. The key is used to verify the integrity of all downloaded files.
To download a compressed snapshot of the Ports
Collection into
When running Portsnap for
the first time, extract the snapshot into
After the first use of
Portsnap has been completed as
shown above, /usr/ports
can be updated
as needed by running:
When using fetch
, the
or the update
operation may be run consecutively, like so:
If more control over the ports tree is needed or if local changes need to be maintained, Subversion can be used to obtain the Ports Collection. Refer to the Subversion Primer for a detailed description of Subversion.
Subversion must be installed before it can be used to check out the ports tree. If a copy of the ports tree is already present, install Subversion like this:
If the ports tree is not available, or pkgng is being used to manage packages, Subversion can be installed as a package:
Check out a copy of the ports tree. For better
performance, replace
with a
mirror close to your geographic location:
As needed, update /usr/ports
the initial Subversion
The Ports Collection installs a series of directories representing software categories with each category having a subdirectory for each application. Each subdirectory, also referred to as a ports skeleton, contains a set of files that tell FreeBSD how to compile and install that program. Each port skeleton includes these files and directories:
: contains statements that
specify how the application should be compiled and where
its components should be installed.
: contains the names
and checksums of the files that must be downloaded to
build the port.
: this directory contains
any patches needed for the program to compile and install
on FreeBSD. This directory may also contain other files used
to build the port.
: provides a more detailed
description of the program.
: a list of all the
files that will be installed by the port. It also tells
the ports system which files to remove upon
Some ports include pkg-message
other files to handle special situations. For more details
on these files, and on ports in general, refer to the FreeBSD
Porter's Handbook.
The port does not include the actual source code, also
known as a distfile
. The extract portion
of building a port will automatically save the downloaded
source to /usr/ports/distfiles
This section provides basic instructions on using the
Ports Collection to install or remove software. The detailed
description of available make
targets and
environment variables is available in ports(7).
Before compiling any port, be sure to update the Ports
Collection as described in the previous section. Since
the installation of any third-party software can introduce
security vulnerabilities, it is recommended to first check
for known security issues related to the port. Alternately,
if ports-mgmt/portaudit is installed, run
portaudit -F
before installing a new
port. This command can be configured to automatically
perform a security audit and an update of the vulnerability
database during the daily security system check. For more
information, refer to the manual page for
portaudit and
Using the Ports Collection assumes a working Internet connection. It also requires superuser privilege.
Some third-party DVD products such as the FreeBSD Toolkit
from freebsdmall.com
contain distfiles which can be used to install ports without
an Internet connection. Mount the DVD on
. If you use a different mount
point, set the CD_MOUNTPTS
make variable.
The needed distfiles will be automatically used if they are
present on the disk. However, the licenses of a few ports do
not allow their inclusion on the DVD. This could be because a
registration form needs to be filled out before downloading or
redistribution is not allowed. In order to install a port not
included on the DVD, a connection to the Internet will still
be required.
To compile and install the port, change to the directory
of the port to be installed, then type make
at the prompt. Messages will indicate
the progress:
Since lsof
is a program that runs
with increased privileges, a security warning is displayed
as it is installed. Once the installation is complete, the
prompt will be returned.
Some shells keep a cache of the commands that are
available in the directories listed in the
environment variable, to speed up lookup
operations for the executable file of these commands. Users
of the tcsh
shell should type
so that a newly installed command
can be used without specifying its full path. Use
hash -r
instead for the
shell. Refer to the documentation
for the shell for more information.
During installation, a working subdirectory is created which contains all the temporary files used during compilation. Removing this directory saves disk space and minimizes the chance of problems later when upgrading to the newer version of the port:
To save this extra step, instead use make
install clean
compiling the port.
Some ports provide build options which can be used to
enable or disable application components, provide security
options, or allow for other customizations. Examples
include www/firefox,
security/gpgme, and
If the port depends upon other ports which have configurable
options, it may pause several times for user interaction
as the default behavior is to prompt the user to select
options from a menu. To avoid this, run make
within the port skeleton to do this configuration in one
batch. Then, run make
install [clean]
compile and install the port.
When using
, the list of
ports to configure are gathered by the
target. It is
recommended to run make
until all dependent ports options have been defined, and
ports options screens no longer appear, to be certain
that all dependency options have been configured.
There are several ways to revisit a port's build options
menu in order to add, remove, or change these options after
a port has been built. One method is to
into the directory containing the
port and type make config
. Another
option is to use make showconfig
Another option is to execute make
which will
remove all selected options and allow you to start over.
All of these options, and others, are explained in great
detail in ports(7).
The ports system uses fetch(1) to download the
source files, which supports various environment variables.
The FTP_PASSIVE_MODE
, and FTP_PASSWORD
variables may need to be set if the FreeBSD system is behind
a firewall or FTP/HTTP proxy. See fetch(3) for the
complete list of supported variables.
For users who cannot be connected to the Internet all
the time, make fetch
can be run
within /usr/ports
, to fetch all
distfiles, or within a category, such as
, or within the specific
port skeleton. Note that if a port has any dependencies,
running this command in a category or ports skeleton will
not fetch the distfiles of ports from
another category. Instead, use make
also fetch the distfiles for all the dependencies of a
In rare cases, such as when an organization has a local
distfiles repository, the MASTER_SITES
variable can be used to override the download locations
specified in the Makefile
. When using,
specify the alternate location:
The WRKDIRPREFIX
variables can override the default
working and target directories. For example:
will compile the port in
and install
everything under /usr/local
will compile the port in /usr/ports
and install it in
. And:
will combine the two.
These can also be set as environmental variables. Refer to the manual page for your shell for instructions on how to set an environmental variable.
Installed ports can be uninstalled using pkg
. Examples for using this command can be
found in Section 5.4, "Using pkgng for Binary Package
Alternately, make deinstall
can be
run in the port's directory:
It is recommended to read the messages as the port is uninstalled. If the port has any applications that depend upon it, this information will be displayed but the uninstallation will proceed. In such cases, it may be better to reinstall the application in order to prevent broken dependencies.
Over time, newer versions of software become available in the Ports Collection. This section describes how to determine which software can be upgraded and how to perform the upgrade.
To determine if newer versions of installed ports are available, ensure that the latest version of the ports tree is installed, using the updating command described in either Procedure 5.1 or Procedure 5.2. Then, run this command to get a listing of the ports which are older than the currently available version:
attempting an upgrade, read
from the top of
the file to the date closest to the last time ports were
upgraded or the system was installed. This file
describes various issues and additional steps users may
encounter and need to perform when updating a port,
including such things as file format changes, changes in
locations of configuration files, or any
incompatibilities with previous versions. Make note of
any instructions which match any of the ports that need
upgrading and follow these instructions when performing
the upgrade.
To perform the actual upgrade, use either Portmaster or Portupgrade.
The ports-mgmt/portmaster package or
port is the recommended tool for upgrading installed ports
as it is designed to use the tools installed with FreeBSD
without depending upon other ports. It uses the
information in /var/db/pkg/
determine which ports to upgrade. To install this utility
as a port:
Portmaster defines four categories of ports:
Root port: has no dependencies and is not a dependency of any other ports.
Trunk port: has no dependencies, but other ports depend upon it.
Branch port: has dependencies and other ports depend upon it.
Leaf port: has dependencies but no other ports depend upon it.
To list these categories and search for updates:
This command is used to upgrade all outdated ports:
By default, Portmaster will
make a backup package before deleting the existing port.
If the installation of the new version is successful,
Portmaster will delete the
backup. Using -b
will instruct
Portmaster not to automatically
delete the backup. Adding -i
will start
Portmaster in interactive mode,
prompting for confirmation before upgrading each port.
Many other options are available. Read through the
manual page for portmaster(8) for details regarding
their usage.
If errors are encountered during the upgrade process,
add -f
to upgrade and rebuild all
Portmaster can also be used to install new ports on the system, upgrading all dependencies before building and installing the new port. To use this function, specify the location of the port in the Ports Collection:
Another utility that can be used to upgrade ports is Portupgrade, which is available as the ports-mgmt/portupgrade package or port. This utility installs a suite of applications which can be used to manage ports. However, it is dependent upon Ruby. To install the port:
Before performing an upgrade using this utility, it is
recommended to scan the list of installed ports using
pkgdb -F
and to fix all the
inconsistencies it reports.
To upgrade all the outdated ports installed on the
system, use portupgrade -a
. Alternately,
include -i
to be asked for confirmation
of every individual upgrade:
To upgrade only a specified application instead of all
available ports, use portupgrade
. It is very important to include
to first upgrade all the ports required
by the given application:
is included,
Portupgrade searches for
available packages in the local directories listed in
. If none are available locally,
it then fetches packages from a remote site. If
packages can not be found locally or fetched remotely,
Portupgrade will use ports. To
avoid using ports entirely, specify -PP
This last set of options tells
Portupgrade to abort if no
packages are available:
To just fetch the port distfiles, or packages, if
is specified, without building or
installing anything, use -F
. For further
information on all of the available switches, refer to the
manual page for portupgrade
Using the Ports Collection will use up disk space over
time. After building and installing a port, running
make clean
within the ports skeleton will
clean up the temporary work
If Portmaster is used to install a
port, it will automatically remove this directory unless
is specified. If
Portupgrade is installed, this
command will remove all work
found within the local copy of the Ports Collection:
In addition, a lot of out-dated source distribution files
will collect in /usr/ports/distfiles
time. If Portupgrade is installed,
this command will delete all the distfiles that are no longer
referenced by any ports:
To use Portupgrade to remove all distfiles not referenced by any port currently installed on the system:
If Portmaster is installed, use:
By default, this command is interactive and will prompt the user to confirm if a distfile should be deleted.
In addition to these commands, the ports-mgmt/pkg_cutleaves package or port automates the task of removing installed ports that are no longer needed.
Poudriere uses FreeBSD jails to set up isolated compilation environments. Inside, ports are compiled and packaged using standard make(1) targets and pkg(8).
Install Poudriere from the Ports Collection (ports-mgmt/poudriere).
Configuration files are
. Example
settings are shown in
Using ZFS is not required,
but beneficial. When ZFS is used, the
Poudriere's datasets must be
specified. Set FREEBSD_HOST
to a nearby
mirror. Defaults for the other values are adequate. Defining
enables the use of
devel/ccache to cache
compilation. This will reduce build times for
frequently-compiled code. It is convenient to put
Poudriere datasets in an isolated
tree mounted at
. That is
not a functional modification, but a matter of taste.
The number of processor cores detected is used to define how many builds should run in parallel. Supply enough virtual memory, either with RAM or swap space. If virtual memory runs out, compiling jails will stop and be torn down, resulting in weird error messages.
Initially, it is sufficient to install a FreeBSD tree and a
ports tree. Creating a simple setup only requires supplying a
name with -j
and a version with
. On systems running FreeBSD/amd64,
the architecture can be set with -a
either i386
or amd64
The default is the architecture shown by
On a single computer, Poudriere can build ports with multiple configurations, in multiple jails, and from different port trees. Custom configurations for these combinations are called sets. See the CUSTOMIZATION section of poudriere(8) for detail.
The basic configuration shown here puts a single jail-,
port-, and set-specific make.conf
The filename in this example is created by combining the jail
name, port name, and set name:
The system 10amd64-local-workstation
and this new file
are combined at build time to create the
used by the build jail.
Packages to be built are entered in
Options and dependencies for the specified ports are configured:
Finally, packages are built and a pkg(8) repository is created:
displays the current state.
Poudriere also builds files in
that can be used with a web server to display build
Packages are now available for installation from the Poudriere repository.
For more information on Poudriere, see poudriere(8) and the main web site, https://fossil.etoilebsd.net/poudriere/doc/trunk/doc/index.wiki.
Regardless of whether the software was installed from a binary package or port, most third-party applications require some level of configuration after installation. The following commands and locations can be used to help determine what was installed with the application.
Most applications install at least one default
configuration file in /usr/local/etc
The configuration files should be reviewed and possibly
edited to meet the system's needs.
Applications which provide documentation will install
it into /usr/local/share/doc
and many
applications also install manual pages. This documentation
should be consulted before continuing.
Some applications run services which must be added
to /etc/rc.conf
before starting the
application. These applications usually install a startup
script in /usr/local/etc/rc.d
. See
Services for more information.
Users of csh(1) should run
to rebuild the known binary list
in the shells PATH
use pkg info
to determine which files,
man pages, and binaries were installed with the
When a port does not build or install, try the following:
Search to see if there is a fix pending for the port in the Problem Report database. If so, implementing the proposed fix may fix the issue.
Ask the maintainer of the port for help. Type
make maintainer
in the ports skeleton or read the port's
to find the maintainer's
email address. Remember to include the
line from the port's
and the output leading up to
the error in the email to the maintainer.
Some ports are not maintained by an individual but
instead by a mailing
list. Many, but not all, of these addresses look
like <email@example.com>
Take this into account when sending an email.
In particular, ports shown as maintained by <email@example.com>
are not
maintained by a specific individual. Instead, any fixes
and support come from the general community who subscribe
to that mailing list. More volunteers are always
If there is no response to the email, use send-pr(1) to submit a bug report using the instructions in Writing FreeBSD Problem Reports.
Fix it! The Porter's Handbook includes detailed information on the ports infrastructure so that you can fix the occasional broken port or even submit your own!
Install the package instead of the port using the instructions in Section 5.4, "Using pkgng for Binary Package Management".
An installation of FreeBSD using bsdinstall does not automatically install a graphical user interface. This chapter describes how to install and configure Xorg, which provides the open source X Window System used to provide a graphical environment. It then describes how to find and install a desktop environment or window manager.
Users who prefer an installation method that automatically configures the Xorg and offers a choice of window managers during installation should refer to the pcbsd.org website.
For more information on the video hardware that Xorg supports, refer to the x.org website.
After reading this chapter, you will know:
The various components of the X Window System, and how they interoperate.
How to install and configure Xorg.
How to install and configure several window managers and desktop environments.
How to use TrueType® fonts in Xorg.
How to set up your system for graphical logins (XDM).
Before reading this chapter, you should:
Know how to install additional third-party software as described in Chapter 5, Installing Applications: Packages and Ports.
While it is not necessary to understand all of the details of the various components in the X Window System and how they interact, some basic knowledge of these components can be useful:
X was designed from the beginning to be network-centric, and adopts a "client-server" model. In this model, the "X server" runs on the computer that has the keyboard, monitor, and mouse attached. The server's responsibility includes tasks such as managing the display, handling input from the keyboard and mouse, and handling input or output from other devices such as a tablet or a video projector. This confuses some people, because the X terminology is exactly backward to what they expect. They expect the "X server" to be the big powerful machine down the hall, and the "X client" to be the machine on their desk.
Each X application, such as XTerm or Firefox, is a "client". A client sends messages to the server such as "Please draw a window at these coordinates", and the server sends back messages such as "The user just clicked on the OK button".
In a home or small office environment, the X server and the X clients commonly run on the same computer. It is also possible to run the X server on a less powerful computer and to run the X applications on a more powerful system. In this scenario, the communication between the X client and server takes place over the network.
X does not dictate what windows should look like on
screen, how to move them around with the mouse, which
keystrokes should be used to move between windows, what
the title bars on each window should look like, whether
or not they have close buttons on them, and so on.
Instead, X delegates this responsibility to a separate
window manager application. There are dozens of window
managers available. Each window manager
provides a different look and feel: some support virtual
desktops, some allow customized keystrokes to manage the
desktop, some have a "Start" button, and
some are themeable, allowing a complete change of the
desktop's look-and-feel. Window managers are available
in the x11-wm
category of the
Ports Collection.
Each window manager uses a different configuration mechanism. Some expect configuration file written by hand while others provide graphical tools for most configuration tasks.
KDE and GNOME are considered to be desktop environments as they include an entire suite of applications for performing common desktop tasks. These may include office suites, web browsers, and games.
The window manager is responsible for the mouse focus policy. This policy provides some means for choosing which window is actively receiving keystrokes and it should also visibly indicate which window is currently active.
One focus policy is called "click-to-focus". In this model, a window becomes active upon receiving a mouse click. In the "focus-follows-mouse" policy, the window that is under the mouse pointer has focus and the focus is changed by pointing at another window. If the mouse is over the root window, then this window is focused. In the "sloppy-focus" model, if the mouse is moved over the root window, the most recently used window still has the focus. With sloppy-focus, focus is only changed when the cursor enters a new window, and not when exiting the current window. In the "click-to-focus" policy, the active window is selected by mouse click. The window may then be raised and appear in front of all other windows. All keystrokes will now be directed to this window, even if the cursor is moved to another window.
Different window managers support different focus models. All of them support click-to-focus, and the majority of them also support other policies. Consult the documentation for the window manager to determine which focus models are available.
Widget is a term for all of the items in the user interface that can be clicked or manipulated in some way. This includes buttons, check boxes, radio buttons, icons, and lists. A widget toolkit is a set of widgets used to create graphical applications. There are several popular widget toolkits, including Qt, used by KDE, and GTK+, used by GNOME. As a result, applications will have a different look and feel, depending upon which widget toolkit was used to create the application.
Xorg is the implementation of the open source X Window System released by the X.Org Foundation. In FreeBSD, it can be installed as a package or port. The meta-port for the complete distribution which includes X servers, clients, libraries, and fonts is located in x11/xorg. A minimal distribution is located in x11/xorg-minimal, with separate ports available for docs, libraries, and apps. The examples in this section install the complete Xorg distribution.
To build and install Xorg from the Ports Collection:
To build Xorg in its entirety, be sure to have at least 4 GB of free disk space available.
Alternatively, Xorg can be installed directly from packages with this command:
In most cases, Xorg is self-configuring. Those with older or unusual equipment may find it helpful to gather some hardware information before beginning configuration.
Monitor sync frequencies
Video card chipset
Video card memory
Screen resolution and refresh rate are determined by the monitor's horizontal and vertical sync frequencies. Almost all monitors support electronic autodetection of these values. A few monitors do not provide these values, and the specifications must be determined from the printed manual or manufacturer web site.
The video card chipset is also autodetected, and used to select the proper video driver. It is beneficial for the user to be aware of which chipset is installed for when autodetection does not provide the desired result.
Video card memory determines the maximum resolution and color depth which can be displayed.
The ability to configure optimal resolution is dependent upon the video hardware and the support provided by its driver. At this time, driver support is as follows:
NVIDIA: several NVIDIA drivers are available in the x11 category of the FreeBSD Ports Collection. Install the driver that matches the model of the NVIDIA hardware.
Intel: as of FreeBSD 9.1, 3D acceleration on most Intel graphics, including IronLake, SandyBridge, and IvyBridge, is supported. Due to the current KMS implementation, it is not possible to switch between the graphical console and a virtual console using Crtl+Alt+F#.
ATI/Radeon: 3D acceleration will not work on ATI or Radeon cards until FreeBSD completes its TTM work. These cards will need to be configured with the 2D driver, and if that does not work, with the Vesa driver.
Optimus: currently there is no switching support between the two graphics adapters provided by Optimus. Optimus implementations vary, so FreeBSD may or may not be able to successfully load a graphics driver on all hardware. If you get a blank screen, check if the BIOS has an option to disable one of the graphics adapters or to set "discrete" mode.
Xorg uses
HAL to autodetect keyboards and mice. The
sysutils/hal and
devel/dbus ports are automatically
installed as dependencies of x11/xorg, but
must be enabled by adding the following entries to
Start these services before configuring Xorg:
Once these services are started, check if Xorg auto-configures itself by typing:
This will generate a file named
which attempts to
load the proper drivers for the detected hardware. Next,
test that the automatically generated configuration file
works with the graphics hardware by typing:
If a black and grey grid and an X mouse cursor appear,
the configuration was successful. To exit the test, switch
to the virtual console used to start it by pressing
(F1 for the first virtual
console) and press
The Ctrl+Alt+Backspace key combination may also be used to break out of Xorg. To enable it, you can either type the following command from any X terminal emulator:
or create a keyboard configuration file for
hald called
and saved in the
directory. This file should contain the following
You will have to reboot your machine to force hald to read this file.
The following line will also have to be added to
, in the
If the test is unsuccessful, skip ahead to Section 6.8, "Troubleshooting". Once the test is successful,
copy the configuration file to
Desktop environments like GNOME, KDE or Xfce provide graphical tools to set parameters such as video resolution. If the default configuration works, skip to Section 6.7, "Desktop Environments" for examples on how to install a desktop environment.
The default fonts that ship with Xorg are less than ideal for typical desktop publishing applications. Large presentation fonts show up jagged and unprofessional looking, and small fonts are almost completely unintelligible. However, there are several free, high quality Type1 (PostScript®) fonts available which can be readily used with Xorg. For instance, the URW font collection (x11-fonts/urwfonts) includes high quality versions of standard type1 fonts (Times Roman®, Helvetica®, Palatino® and others). The Freefonts collection (x11-fonts/freefonts) includes many more fonts, but most of them are intended for use in graphics software such as the Gimp, and are not complete enough to serve as screen fonts. In addition, Xorg can be configured to use TrueType® fonts with a minimum of effort. For more details on this, see the X(7) manual page or the section on TrueType® fonts.
To install the above Type1 font collections from the Ports Collection, run the following commands:
And likewise with the freefont or other collections. To
have the X server detect these fonts, add an appropriate line
to the X server configuration file
), which reads:
Alternatively, at the command line in the X session run:
This will work but will be lost when the X session is
closed, unless it is added to the startup file
for a normal
session, or
when logging in through a
graphical login manager like XDM).
A third way is to use the new
file: see
the section on
Xorg has built in support for
rendering TrueType® fonts. There are two different modules
that can enable this functionality. The freetype module is
used in this example because it is more consistent with the
other font rendering back-ends. To enable the freetype module
just add the following line to the "Module"
section of the /etc/X11/xorg.conf
Now make a directory for the TrueType® fonts (for
) and
copy all of the TrueType® fonts into this directory. Keep in
mind that TrueType® fonts cannot be directly taken from a
Macintosh®; they must be in UNIX®/MS-DOS®/Windows® format
for use by Xorg. Once the
files have been copied into this directory, use
ttmkfdir to create a
file, so that the X font
renderer knows that these new files have been installed.
is available from the FreeBSD
Ports Collection as
Now add the TrueType® directory to the font path. This is just the same as described above for Type1 fonts, that is, use
or add a FontPath
line to the
That's it. Now Gimp, Apache OpenOffice, and all of the other X applications should now recognize the installed TrueType® fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within StarOffice™) will look much better now.
All fonts in Xorg that are
found in /usr/local/lib/X11/fonts/
are automatically made
available for anti-aliasing to Xft-aware applications. Most
recent applications are Xft-aware, including
GNOME, and
In order to control which fonts are anti-aliased, or to
configure anti-aliasing properties, create (or edit, if it
already exists) the file
. Several
advanced features of the Xft font system can be tuned using
this file; this section describes only some simple
possibilities. For more details, please see
This file must be in XML format. Pay careful attention to
case, and make sure all tags are properly closed. The file
begins with the usual XML header followed by a DOCTYPE
definition, and then the <fontconfig>
As previously stated, all fonts in
as well as
are already made available to
Xft-aware applications. If you wish to add another directory
outside of these two directory trees, add a line similar to
the following to
After adding new fonts, and especially new font directories, you should run the following command to rebuild the font caches:
Anti-aliasing makes borders slightly fuzzy, which makes very small text more readable and removes "staircases" from large text, but can cause eyestrain if applied to normal text. To exclude font sizes smaller than 14 point from anti-aliasing, include these lines:
Spacing for some monospaced fonts may also be inappropriate with anti-aliasing. This seems to be an issue with KDE, in particular. One possible fix for this is to force the spacing for such fonts to be 100. Add the following lines:
(this aliases the other common names for fixed fonts as
), and then add:
Certain fonts, such as Helvetica, may have a problem when
anti-aliased. Usually this manifests itself as a font that
seems cut in half vertically. At worst, it may cause
applications to crash. To avoid this, consider adding the
following to local.conf
Once you have finished editing
make sure you end the file
with the </fontconfig>
tag. Not
doing this will cause your changes to be ignored.
Finally, users can add their own settings via their
personal .fonts.conf
files. To do this,
each user should simply create a
. This file must also be in
XML format.
One last point: with an LCD screen, sub-pixel sampling may
be desired. This basically treats the (horizontally
separated) red, green and blue components separately to
improve the horizontal resolution; the results can be
dramatic. To enable this, add the line somewhere in the
Depending on the sort of display,
may need to be changed to
, vrgb
: experiment and see which works
The X Display Manager (XDM) is an optional part of the X Window System that is used for login session management. This is useful for several types of situations, including minimal "X Terminals", desktops, and large network display servers. Since the X Window System is network and protocol independent, there are a wide variety of possible configurations for running X clients and servers on different machines connected by a network. XDM provides a graphical interface for choosing which display server to connect to, and entering authorization information such as a login and password combination.
Think of XDM as providing the same functionality to the user as the getty(8) utility (see Section 25.3.1, "Configuration" for details). That is, it performs system logins to the display being connected to and then runs a session manager on behalf of the user (usually an X window manager). XDM then waits for this program to exit, signaling that the user is done and should be logged out of the display. At this point, XDM can display the login and display chooser screens for the next user to login.
To start using XDM, install
the x11/xdm port (it is not installed by
default in recent versions of
Xorg). The
XDM daemon program may then be
found in /usr/local/bin/xdm
. This
program can be run at any time as root
and it will start
managing the X display on the local machine. If
XDM is to be run every time the
machine boots up, a convenient way to do this is by adding an
entry to /etc/ttys
. For more information
about the format and usage of this file, see Section 22.214.171.124, "Adding an Entry to
". There is a line in the default
file for running the
XDM daemon on a virtual
By default this entry is disabled; in order to enable it
change field 5 from off
and restart init(8) using the
directions in Section 22.214.171.124, "Force init
to Reread
". The first field,
the name of the terminal this program will manage, is
. This means that
XDM will start running on the 9th
virtual terminal.
The XDM configuration directory
is located in /usr/local/lib/X11/xdm
. In
this directory there are several files used to change the
behavior and appearance of XDM.
Typically these files will be found:
File | Description |
Xaccess | Client authorization ruleset. |
Xresources | Default X resource values. |
Xservers | List of remote and local displays to manage. |
Xsession | Default session script for logins. |
Xsetup_ * | Script to launch applications before the login interface. |
xdm-config | Global configuration for all displays running on this machine. |
xdm-errors | Errors generated by the server program. |
xdm-pid | The process ID of the currently running XDM. |
Also in this directory are a few scripts and programs used to set up the desktop when XDM is running. The purpose of each of these files will be briefly described. The exact syntax and usage of all of these files is described in xdm(1).
The default configuration is a simple rectangular login window with the hostname of the machine displayed at the top in a large font and "Login:" and "Password:" prompts below. This is a good starting point for changing the look and feel of XDM screens.
The protocol for connecting to
XDM-controlled displays is
called the X Display Manager Connection Protocol (XDMCP).
This file is a ruleset for controlling XDMCP connections
from remote machines. It is ignored unless the
is changed to listen for
remote connections. By default, it does not allow any
clients to connect.
This is an application-defaults file for the display chooser and login screens. In it, the appearance of the login program can be modified. The format is identical to the app-defaults file described in the Xorg documentation.
This is the default session script for
XDM to run after a user has
logged in. Normally each user will have a customized
session script in ~/.xsession
overrides this script.
These will be run automatically before displaying the
chooser or login interfaces. There is a script for each
display being used, named Xsetup_
followed by the local display number (for instance
). Typically these scripts
will run one or two programs in the background such as
This contains settings in the form of app-defaults that are applicable to every display that this installation manages.
In order for other clients to connect to the display
server, you must edit the access control rules and enable
the connection listener. By default these are set to
conservative values. To make XDM
listen for connections, first comment out a line in the
and then restart XDM.
Remember that comments in app-defaults files begin with a
"!" character, not the usual "#".
More strict access controls may be desired — look at the
example entries in Xaccess
, and refer to
the xdm(1) manual page for further information.
Several replacements for the default XDM program exist. One of them, KDM (bundled with KDE) is described later in this chapter. The KDM display manager offers many visual improvements and cosmetic frills, as well as the functionality to allow users to choose their window manager of choice at login time.
This section describes the different desktop environments available for X on FreeBSD. A "desktop environment" can mean anything ranging from a simple window manager to a complete suite of desktop applications, such as KDE or GNOME.
GNOME is a user-friendly desktop environment that enables users to easily use and configure their computers. GNOME includes a panel (for starting applications and displaying status), a desktop (where data and applications can be placed), a set of standard desktop tools and applications, anda set of conventions that make it easy for applications to cooperate and be consistent with each other. Users of other operating systems or environments should feel right at home using the powerful graphics-driven environment that GNOME provides. More information regarding GNOME on FreeBSD can be found on the FreeBSD GNOME Project's web site. The web site also contains fairly comprehensive FAQs about installing, configuring, and managing GNOME.
The software can be easily installed from a package or the Ports Collection:
To install the GNOME package, type:
To build GNOME from source, use the ports tree:
For proper operation, GNOME
requires the /proc
filesystem to be
mounted. Add
to /etc/fstab
to mount
procfs(5) automatically during
Once GNOME is installed, the X server must be told to start GNOME instead of a default window manager.
The easiest way to start
GNOME is with
GDM, the GNOME Display Manager.
GDM is installed as part
of the GNOME desktop, although
it is disabled by default. It can be enabled by adding this
line to /etc/rc.conf
Once you have rebooted, GDM will start automatically.
It is often desirable to start all
GNOME services together with
GDM. To achieve this, add the
following line to /etc/rc.conf
GNOME may also be started
from the command-line by properly configuring a file named
. If a custom
is already in place, simply
replace the line that starts the current window manager with
one that starts
instead. If nothing special has been done to the
configuration file, then it is enough simply to type:
Next, type startx
, and the
GNOME desktop environment will
be started.
If an older display manager, like
XDM, is being used, this will
not work. Instead, create an executable
file with the same command
in it. To do this, edit the file and replace the existing
window manager command with
Yet another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE details explains how to do this for KDM, the display manager of KDE.
KDE is an easy to use contemporary desktop environment. Some of the things that KDE brings to the user are:
A beautiful contemporary desktop
A desktop exhibiting complete network transparency
An integrated help system allowing for convenient, consistent access to help on the use of the KDE desktop and its applications
Consistent look and feel of all KDE applications
Standardized menu and toolbars, keybindings, color-schemes, etc.
Internationalization: KDE is available in more than 55 languages
Centralized, consistent, dialog-driven desktop configuration
A great number of useful KDE applications
KDE comes with a web browser called Konqueror, which is a solid competitor to other existing web browsers on UNIX® systems. More information on KDE can be found on the KDE website. For FreeBSD specific information and resources on KDE, consult the KDE/FreeBSD initiative's website.
Just as with GNOME or any other desktop environment, the software can be easily installed from a package or the Ports Collection:
To install the KDE4 package, type:
To build KDE from source, use the ports tree:
The first time the port is installed, a menu will be shown for selecting options. Accepting the defaults is recommended.
KDE 4 is a large application, and will take quite some time to compile even on a fast computer.
After KDE has been installed,
the X server must be told to launch this application
instead of the default window manager. This is accomplished
by editing the .xinitrc
Now, whenever the X Window System is invoked with
will be the desktop.
If a display manager such as
XDM is being used, the
configuration is slightly different. Edit the
file instead. Instructions
for KDM are described later in
this chapter.
Now that KDE is installed on the system, most things can be discovered through the help pages, or just by pointing and clicking at various menus. Windows® or Mac® users will feel quite at home.
The best reference for KDE is the on-line documentation. KDE comes with its own web browser, Konqueror, dozens of useful applications, and extensive documentation. The remainder of this section discusses the technical items that are difficult to learn by random exploration.
An administrator of a multi-user system may wish to have a graphical login screen to welcome users. XDM can be used, as described earlier. However, KDE includes an alternative, KDM, which is designed to look more attractive and include more login-time options. In particular, users can easily choose (via a menu) which desktop environment (KDE, GNOME, or something else) to run after logging on.
KDE 4 requires that
procfs(5) be mounted, and this line must be added to
Xfce is a desktop environment based on the GTK+ toolkit used by GNOME, but is much more lightweight and meant for those who want a simple, efficient desktop which is nevertheless easy to use and configure. Visually, it looks very much like CDE, found on commercial UNIX® systems. Some of Xfce's features are:
A simple, easy-to-handle desktop
Fully configurable via mouse, with drag and drop, etc.
Main panel similar to CDE, with menus, applets and applications launchers
Integrated window manager, file manager, sound manager, GNOME compliance module, and more
Themeable (since it uses GTK+)
Fast, light and efficient: ideal for older/slower machines or machines with memory limitations
More information on Xfce can be found on the Xfce website.
To install Xfce, type:
Alternatively, to build from source, use the Ports Collection:
Now, tell the X server to launch Xfce the next time X is started. Simply type this:
The next time X is started,
Xfce will be the desktop. As
before, if a display manager like
XDM is being used, create an
, as described in the section
on GNOME, but with the
command; or,
configure the display manager to allow choosing a desktop at
login time, as explained in the section on
If the mouse does not work, you will need to first
configure it before proceeding. See Section 3.10.9, "Mouse Settings"
in the FreeBSD install chapter. In recent
Xorg versions, the
sections in
are ignored in favor of the
autodetected devices. To restore the old behavior, add the
following line to the ServerLayout
section of this file:
Input devices may then be configured as in previous versions, along with any other options needed (e.g., keyboard layout switching).
As previously explained the hald daemon will, by default, automatically detect your keyboard. There are chances that your keyboard layout or model will not be correct, desktop environments like GNOME, KDE or Xfce provide tools to configure the keyboard. However, it is possible to set the keyboard properties directly either with the help of the setxkbmap(1) utility or with a hald's configuration rule.
For example if, one wants to use a PC 102 keys keyboard
coming with a french layout, we have to create a keyboard
configuration file for hald
called x11-input.fdi
and saved in the
directory. This file should contain the following
If this file already exists, just copy and add to your file the lines regarding the keyboard configuration.
You will have to reboot your machine to force hald to read this file.
It is possible to do the same configuration from an X terminal or a script with this command line:
file lists the various keyboard, layouts and options
The xorg.conf.new
configuration file
may now be tuned to taste. Open the file in a text editor
such as emacs(1) or ee(1). If the monitor is an
older or unusual model that does not support autodetection of
sync frequencies, those settings can be added to
under the
Most monitors support sync frequency autodetection, making manual entry of these values unnecessary. For the few monitors that do not support autodetection, avoid potential damage by only entering values provided by the manufacturer.
X allows DPMS (Energy Star) features to be used with capable monitors. The xset(1) program controls the time-outs and can force standby, suspend, or off modes. If you wish to enable DPMS features for your monitor, you must add the following line to the monitor section:
While the xorg.conf.new
configuration file is still open in an editor, select the
default resolution and color depth desired. This is defined
in the "Screen"
The DefaultDepth
keyword describes the
color depth to run at by default. This can be overridden with
the -depth
command line switch to
Xorg(1). The Modes
keyword describes
the resolution to run at for the given color depth. Note that
only VESA standard modes are supported as defined by the
target system's graphics hardware. In the example above, the
default color depth is twenty-four bits per pixel. At this
color depth, the accepted resolution is 1024 by 768
Finally, write the configuration file and test it using the test mode given above.
One of the tools available to assist you during
troubleshooting process are the
Xorg log files, which contain
information on each device that the
Xorg server attaches to.
Xorg log file names are in the
format of /var/log/Xorg.0.log
. The
exact name of the log can vary from
and so forth.
If all is well, the configuration file needs to be
installed in a common location where Xorg(1) can find it.
This is typically /etc/X11/xorg.conf
The Xorg configuration process is now complete. Xorg may be now started with the startx(1) utility. The Xorg server may also be started with the use of xdm(1).
Configuration with Intel® i810 integrated chipsets
requires the agpgart
programming interface for Xorg
to drive the card. See the agp(4) driver manual page
for more information.
This will allow configuration of the hardware as any
other graphics board. Note on systems without the
agp(4) driver compiled in the kernel, trying to load
the module with kldload(8) will not work. This driver
has to be in the kernel at boot time through being compiled
in or using /boot/loader.conf
This section assumes a bit of advanced configuration knowledge. If attempts to use the standard configuration tools above have not resulted in a working configuration, there is information enough in the log files to be of use in getting the setup working. Use of a text editor will be necessary.
Current widescreen (WSXGA, WSXGA+, WUXGA, WXGA, WXGA+, et.al.) formats support 16:10 and 10:9 formats or aspect ratios that can be problematic. Examples of some common screen resolutions for 16:10 aspect ratios are:
At some point, it will be as easy as adding one of these
resolutions as a possible Mode
in the
Section "Screen"
as such:
Xorg is smart enough to pull the resolution information from the widescreen via I2C/DDC information so it knows what the monitor can handle as far as frequencies and resolutions.
If those ModeLines
do not exist in
the drivers, one might need to give
Xorg a little hint. Using
one can extract
enough information to manually create a
that will work. Simply look for
information resembling this:
This information is called EDID information. Creating a
from this is just a matter of
putting the numbers in the correct order:
So that the ModeLine
Section "Monitor"
for this example would
look like this:
Now having completed these simple editing steps, X should start on your new widescreen monitor.
Now that the basics have been covered, this part of the FreeBSD Handbook will discuss some frequently used features of FreeBSD. These chapters:
Introduce you to popular and useful desktop applications: browsers, productivity tools, document viewers, etc.
Introduce you to a number of multimedia tools available for FreeBSD.
Explain the process of building a customized FreeBSD kernel, to enable extra functionality on your system.
Describe the print system in detail, both for desktop and network-connected printer setups.
Show you how to run Linux applications on your FreeBSD system.
Some of these chapters recommend that you do some prior reading, and this is noted in the synopsis at the beginning of each chapter.
While FreeBSD is popular as a server for its performance and stability, it is also suited for day-to-day use as a desktop. With over 24,000 applications available as FreeBSD packages or ports, it is easy to build a customized desktop that runs a wide variety of desktop applications. This chapter demonstrates how to install some popular desktop applications using packages or the FreeBSD Ports Collection.
Users who prefer to install a pre-built desktop version of FreeBSD rather than configuring one from scratch should refer to the pcbsd.org website.
As FreeBSD features Linux® binary compatibility, many applications developed for Linux® can be installed on a FreeBSD desktop. Many of the ports using Linux® binary compatibility start with "linux-". This chapter assumes that Linux® binary compatibility has been enabled before any Linux® applications are installed.
This chapter demonstrates how to install the following desktop applications:
Type of Application | Application Name | Package Name | Ports Name |
Browser | Firefox | firefox | www/firefox |
Browser | Opera | opera | www/opera |
Browser | Konqueror | kde4-baseapps | x11/kde4-baseapps |
Browser | Chromium | chromium | www/chromium |
Productivity | Calligra | calligra | editors/calligra |
Productivity | AbiWord | abiword | editors/abiword |
Productivity | The GIMP | gimp | graphics/gimp |
Productivity | Apache OpenOffice | openoffice | editors/openoffice-4 |
Productivity | LibreOffice | libreoffice | editors/libreoffice |
Document Viewer | Acrobat Reader® | no package due to
license restriction | print/acroread9 |
Document Viewer | gv | gv | print/gv |
Document Viewer | Xpdf | xpdf | graphics/xpdf |
Document Viewer | GQview | gqview | graphics/gqview |
Finance | GnuCash | gnucash | finance/gnucash |
Finance | Gnumeric | gnumeric | math/gnumeric |
Finance | KMyMoney | kmymoney-kde4 | finance/kmymoney-kde4 |
Before reading this chapter, you should know how to:
Install additional software using packages or ports as described in Chapter 5, Installing Applications: Packages and Ports.
Install X and a window manager as described in Chapter 6, The X Window System.
Enable Linux® binary compatibility as described in Chapter 11, Linux® Binary Compatibility.
For information on how to configure a multimedia environment, refer to Chapter 8, Multimedia.
FreeBSD does not come with a pre-installed web browser. Instead, the www category of the Ports Collection contains many browsers which can be installed as a package or compiled from the Ports Collection.
The KDE and GNOME desktop environments include their own HTML browser. Refer to Section 6.7, "Desktop Environments" for more information on how to set up these complete desktops.
Some light-weight browsers include www/dillo2, www/links, and www/w3m.
This section demonstrates how to install the following popular web browsers and indicates if the application is resource-heavy, takes time to compile from ports, or has any major dependencies.
Application Name | Resources Needed | Installation from Ports | Notes |
Firefox | medium | heavy | FreeBSD, Linux®, and localized versions are available |
Opera | light | light | FreeBSD and Linux® versions are available |
Konqueror | medium | heavy | Requires KDE libraries |
Chromium | medium | heavy | Requires Gtk+ |
Firefox is an open source browser that is fully ported to FreeBSD. It features a standards-compliant HTML display engine, tabbed browsing, popup blocking, extensions, improved security, and more. Firefox is based on the Mozilla codebase.
To install the package of the latest release version of Firefox, type:
To instead install Firefox Extended Support Release (ESR) version, use:
Localized versions are available in www/firefox-i18n and www/firefox-esr-i18n.
The Ports Collection can instead be used to compile the
desired version of Firefox from
source code. This example builds
www/firefox, where
can be replaced with the ESR or
localized version to install.
The installation of Firefox does not include Java™ support. However, java/icedtea-web provides a free software web browser plugin for running Java applets. It can be installed as a package. To alternately compile the port:
Keep the default configuration options when compiling the port.
Once installed, start firefox,
enter about:plugins
in the location bar and
press Enter. A page listing the installed
plugins will be displayed. The
Java™ plugin should be
If the browser is unable to find the plugin, each user will have to run the following command and relaunch the browser:
A native Adobe® Flash® plugin is not available for FreeBSD. However, a software wrapper for running the Linux® version of the plugin is available. This wrapper also provides support for other browser plugins such as RealPlayer®.
To install and enable this plugin, perform these steps:
Install the www/nspluginwrapper port. Due to licensing restrictions, a package is not available. This port requires emulators/linux_base-f10 which is a large port.
Install the www/linux-f10-flashplugin11 port. Due to licensing restrictions, a package is not available.
Create the
directory if it is not already present.
Before the plugin is first used, each user must run:
When the plugin port has been updated and reinstalled, each user must run:
Start the browser, enter
in the location bar and
press Enter. A list of all the currently
available plugins will be shown.
Swfdec is a decoder and renderer for Flash® animations. Swfdec-Mozilla is a plugin for Firefox browsers that uses the Swfdec library for playing SWF files.
To install the package:
If the package is not available, compile and install it from the Ports Collection:
Restart the browser to activate this plugin.
Opera is a full-featured and standards-compliant browser which is still lightweight and fast. It comes with a built-in mail and news reader, an IRC client, an RSS/Atom feeds reader, and more. It is available as a native FreeBSD version and as a version that runs under Linux® emulation.
This command installs the package of the FreeBSD version of
Opera. Replace
with linux-opera
to instead install the Linux® version.
Alternately, install either version through the Ports Collection. This example compiles the native version:
To install the Linux® version, substitute
in place of
To install Adobe® Flash® plugin support, first compile the www/linux-f10-flashplugin11 port, as a package is not available due to licensing restrictions. Then install either the www/opera-linuxplugins port or package. This example compiles both applications from ports:
Once installed, check the presence of the plugin by
starting the browser, entering
in the location bar and
pressing Enter. A list should appear with
all the currently available plugins.
To add the Java™ plugin, follow the instructions in Section 220.127.116.11, "Firefox and Java™ Plugin".
Konqueror is more than a web browser as it is also a file manager and a multimedia viewer. It is included in the x11/kde4-baseapps package or port.
Konqueror supports WebKit as well as its own KHTML. WebKit is a rendering engine used by many modern browsers including Chromium. To use WebKit with Konqueror on FreeBSD, install the www/kwebkitpart package or port. This example compiles the port:
To enable WebKit within Konqueror, click "Settings", "Configure Konqueror". In the "General" settings page, click the drop-down menu next to "Default web browser engine" and change "KHTML" to "WebKit".
Konqueror also supports
Flash®. A "How To"
guide for getting Flash® support
on Konqueror is available at http://freebsd.kde.org/howtos/konqueror-flash.php
Chromium is an open source browser project that aims to build a safer, faster, and more stable web browsing experience. Chromium features tabbed browsing, popup blocking, extensions, and much more. Chromium is the open source project upon which the Google Chrome web browser is based.
Chromium can be installed as a package by typing:
Alternatively, Chromium can be compiled from source using the Ports Collection:
The executable for Chromium
is /usr/local/bin/chrome
, not
The installation of Chromium does not include Java™ support. To install Java™ plugin support, follow the instructions in Section 126.96.36.199, "Firefox and Java™ Plugin".
Once Java™ support is installed, start
Chromium and enter
in the address bar.
IcedTea-Web should be listed as one of the installed
If Chromium does not display the IcedTea-Web plugin, run the following commands and restart the web browser:
Configuring Chromium and Adobe® Flash® is similar to the instructions in Section 18.104.22.168, "Firefox and Adobe® Flash® Plugin". No additional configuration should be necessary, since Chromium is able to use some plugins from other browsers.
When it comes to productivity, new users often look for an office suite or an easy-to-use word processor. While some desktop environments like KDE provide an office suite, there is no default productivity package. Several office suites and graphical word processors are available for FreeBSD, regardless of the installed window manager.
This section demonstrates how to install the following popular productivity software and indicates if the application is resource-heavy, takes time to compile from ports, or has any major dependencies.
Application Name | Resources Needed | Installation from Ports | Major Dependencies |
Calligra | light | heavy | KDE |
AbiWord | light | light | Gtk+ or GNOME |
The Gimp | light | heavy | Gtk+ |
Apache OpenOffice | heavy | huge | JDK™ and Mozilla |
LibreOffice | somewhat heavy | huge | Gtk+, or KDE/ GNOME, or JDK™ |
The KDE desktop environment includes an office suite which can be installed separately from KDE. Calligra includes standard components that can be found in other office suites. Words is the word processor, Sheets is the spreadsheet program, Stage manages slide presentations, and Karbon is used to draw graphical documents.
In FreeBSD, editors/calligra can be installed as a package or a port. To install the package:
If the package is not available, use the Ports Collection instead:
AbiWord is a free word processing program similar in look and feel to Microsoft® Word. It is fast, contains many features, and is user-friendly.
AbiWord can import or export
many file formats, including some proprietary ones like
Microsoft® .rtf
To install the AbiWord package:
If the package is not available, it can be compiled from the Ports Collection:
For image authoring or picture retouching, The GIMP provides a sophisticated image manipulation program. It can be used as a simple paint program or as a quality photo retouching suite. It supports a large number of plugins and features a scripting interface. The GIMP can read and write a wide range of file formats and supports interfaces with scanners and tablets.
To install the package:
Alternately, use the Ports Collection:
The graphics category (freebsd.org/ports/graphics.html) of the Ports Collection contains several GIMP-related plugins, help files, and user manuals.
Apache OpenOffice is an open source office suite which is developed under the wing of the Apache Software Foundation's Incubator. It includes all of the applications found in a complete office productivity suite: a word processor, spreadsheet, presentation manager, and drawing program. Its user interface is similar to other office suites, and it can import and export in various popular file formats. It is available in a number of different languages and internationalization has been extended to interfaces, spell checkers, and dictionaries.
The word processor of Apache OpenOffice uses a native XML file format for increased portability and flexibility. The spreadsheet program features a macro language which can be interfaced with external databases. Apache OpenOffice is stable and runs natively on Windows®, Solaris™, Linux®, FreeBSD, and Mac OS® X. More information about Apache OpenOffice can be found at openoffice.org. For FreeBSD specific information refer to porting.openoffice.org/freebsd/.
To install the Apache OpenOffice package:
Once the package is installed, type the following command to launch Apache OpenOffice:
where X.Y.Z
is the version
number of the installed version of Apache
OpenOffice. The first time
Apache OpenOffice launches, some
questions will be asked and a
folder will be created in
the user's home directory.
If the desired Apache OpenOffice package is not available, compiling the port is still an option. However, this requires a lot of disk space and a fairly long time to compile:
To build a localized version, replace the previous command with:
with the correct
language ISO-code. A list of supported language codes is
available in
, located in
the port's directory.
LibreOffice is a free software office suite developed by documentfoundation.org. It is compatible with other major office suites and available on a variety of platforms. It is a rebranded fork of OpenOffice.org and includes applications found in a complete office productivity suite: a word processor, spreadsheet, presentation manager, drawing program, database management program, and a tool for creating and editing mathematical formulæ. It is available in a number of different languages and internationalization has been extended to interfaces, spell checkers, and dictionaries.
The word processor of LibreOffice uses a native XML file format for increased portability and flexibility. The spreadsheet program features a macro language which can be interfaced with external databases. LibreOffice is stable and runs natively on Windows®, Linux®, FreeBSD, and Mac OS® X. More information about LibreOffice can be found at libreoffice.org.
To install the English version of the LibreOffice package:
The editors category (freebsd.org/ports/editors.html)
of the Ports Collection contains several localizations for
LibreOffice. When installing a
localized package, replace libreoffice
with the name of the localized package.
Once the package is installed, type the following command to run LibreOffice:
During the first launch, some questions will be asked
and a .libreoffice
folder will be created
in the user's home directory.
If the desired LibreOffice package is not available, compiling the port is still an option. However, this requires a lot of disk space and a fairly long time to compile. This example compiles the English version:
To build a localized version, cd into the port directory of the desired language. Supported languages can be found in the editors category (freebsd.org/ports/editors.html) of the Ports Collection.
Some new document formats have gained popularity since the advent of UNIX® and the viewers they require may not be available in the base system. This section demonstrates how to install the following document viewers:
Application Name | Resources Needed | Installation from Ports | Major Dependencies |
Acrobat Reader® | light | light | Linux® binary compatibility |
gv | light | light | Xaw3d |
Xpdf | light | light | FreeType |
GQview | light | light | Gtk+ or GNOME |
Many documents are now distributed as Portable Document Format (PDF) files. One popular PDF viewer is Acrobat Reader®, released by Adobe® for Linux®. As FreeBSD can run Linux® binaries, it is also available for FreeBSD. Due to licensing restrictions, a package is not available, meaning that this application must be compiled from ports. Several localizations are available from the print category (freebsd.org/ports/print.html) of the Ports Collection.
This command installs the English version of Acrobat Reader® 9 from the Ports Collection. To instead install a localized version, cd into the desired port's directory.
gv is a PostScript® and PDF viewer. It is based on ghostview, but has a nicer look as it is based on the Xaw3d widget toolkit. gv has many configurable features, such as orientation, paper size, scale, and anti-aliasing. Almost any operation can be performed with either the keyboard or the mouse.
To install gv as a package:
If a package is unavailable, use the Ports Collection:
For users that prefer a small FreeBSD PDF viewer, Xpdf provides a light-weight and efficient viewer which requires few resources. It uses the standard X fonts and does not require any additional toolkits.
To install the Xpdf package:
If the package is not available, use the Ports Collection:
Once the installation is complete, launch
and use the right mouse button to
activate the menu.
GQview is an image manager which supports viewing a file with a single click, launching an external editor, and thumbnail previews. It also features a slideshow mode and some basic file operations, making it easy to manage image collections and to find duplicate files. GQview supports full screen viewing and internationalization.
To install the GQview package:
If the package is not available, use the Ports Collection:
For managing personal finances on a FreeBSD desktop, some powerful and easy-to-use applications can be installed. Some are compatible with widespread file formats, such as the formats used by Quicken and Excel.
This section covers these programs:
Application Name | Resources Needed | Installation from Ports | Major Dependencies |
GnuCash | light | heavy | GNOME |
Gnumeric | light | heavy | GNOME |
KMyMoney | light | heavy | KDE |
GnuCash is part of the GNOME effort to provide user-friendly, yet powerful, applications to end-users. GnuCash can be used to keep track of income and expenses, bank accounts, and stocks. It features an intuitive interface while remaining professional.
GnuCash provides a smart register, a hierarchical system of accounts, and many keyboard accelerators and auto-completion methods. It can split a single transaction into several more detailed pieces. GnuCash can import and merge Quicken QIF files. It also handles most international date and currency formats.
To install the GnuCash package:
If the package is not available, use the Ports Collection:
Gnumeric is a spreadsheet program developed by the GNOME community. It features convenient automatic guessing of user input according to the cell format with an autofill system for many sequences. It can import files in a number of popular formats, including Excel, Lotus 1-2-3, and Quattro Pro. It has a large number of built-in functions and allows all of the usual cell formats such as number, currency, date, time, and much more.
To install Gnumeric as a package:
If the package is not available, use the Ports Collection:
KMyMoney is a personal finance application created by the KDE community. KMyMoney aims to provide the important features found in commercial personal finance manager applications. It also highlights ease-of-use and proper double-entry accounting among its features. KMyMoney imports from standard Quicken QIF files, tracks investments, handles multiple currencies, and provides a wealth of reports.
To install KMyMoney as a package:
If the package is not available, use the Ports Collection:
FreeBSD supports a wide variety of sound cards, allowing users to enjoy high fidelity output from a FreeBSD system. This includes the ability to record and playback audio in the MPEG Audio Layer 3 (MP3), Waveform Audio File (WAV), Ogg Vorbis, and other formats. The FreeBSD Ports Collection contains many applications for editing recorded audio, adding sound effects, and controlling attached MIDI devices.
FreeBSD also supports the playback of video files and DVDs. The FreeBSD Ports Collection contains applications to encode, convert, and playback various video media.
This chapter describes how to configure sound cards, video playback, TV tuner cards, and scanners on FreeBSD. It also describes some of the applications which are available for using these devices.
After reading this chapter, you will know how to:
Configure a sound card on FreeBSD.
Troubleshoot the sound setup.
Playback and encode MP3s and other audio.
Prepare a FreeBSD system for video playback.
Play DVDs, .mpg
and .avi
Rip CD and DVD content into files.
Configure a TV card.
Install and setup MythTV on FreeBSD
Configure an image scanner.
Before reading this chapter, you should:
Know how to install applications as described in Chapter 5, Installing Applications: Packages and Ports.
Before beginning the configuration, determine the model of the sound card and the chip it uses. FreeBSD supports a wide variety of sound cards. Check the supported audio devices list of the Hardware Notes to see if the card is supported and which FreeBSD driver it uses.
In order to use the sound device, its device driver must be loaded. The easiest way is to load a kernel module for the sound card with kldload(8). This example loads the driver for a built-in audio chipset based on the Intel specification:
To automate the loading of this driver at boot time, add the
driver to /boot/loader.conf
. The line for
this driver is:
Other available sound modules are listed in
. When unsure
which driver to use, load the snd_driver
This is a metadriver which loads all of the most common
sound drivers and can be used to speed up the search for the
correct driver. It is also possible to load all sound drivers
by adding the metadriver to
To determine which driver was selected for the sound card
after loading the snd_driver
type cat /dev/sndstat
This section is for users who prefer to statically compile in support for the sound card in a custom kernel. For more information about recompiling a kernel, refer to Chapter 9, Configuring the FreeBSD Kernel.
When using a custom kernel to provide sound support, make sure that the audio framework driver exists in the custom kernel configuration file:
Next, add support for the sound card. To continue the example of the built-in audio chipset based on the Intel specification from the previous section, use the following line in the custom kernel configuration file:
Be sure to read the manual page of the driver for the device name to use for the driver.
Non-PnP ISA sound cards may require the IRQ and I/O port
settings of the card to be added to
. During the boot
process, loader(8) reads this file and passes the
settings to the kernel. For example, an old Creative
SoundBlaster® 16 ISA non-PnP card will use the
snd_sbc(4) driver in conjunction with
. For this card, the following
lines must be added to the kernel configuration file:
If the card uses the 0x220
I/O port and
, these lines must also be added to
In this case, the card uses the 0x220
I/O port and the IRQ 5
The syntax used in
is described in
sound(4) and the manual page for the driver of the sound
The settings shown above are the defaults. In some cases, the IRQ or other settings may need to be changed to match the card. Refer to snd_sbc(4) for more information about this card.
After loading the required module or rebooting into the
custom kernel, the sound card should be detected. To confirm,
run dmesg | grep pcm
. This example is
from a system with a built-in Conexant CX20590 chipset:
The status of the sound card may also be checked using this command:
The output will vary depending upon the sound card. If no
devices are listed, double-check
that the correct device driver was loaded or compiled into the
kernel. The next section lists some common problems and their
If all goes well, the sound card should now work in os;. If the CD or DVD drive is properly connected to the sound card, one can insert an audio CD in the drive and play it with cdcontrol(1):
Audio CDs have specialized encodings which means that they should not be mounted using mount(8).
Various applications, such as audio/workman, provide a friendlier interface. The audio/mpg123 port can be installed to listen to MP3 audio files.
Another quick way to test the card is to send data to
be any type of file. This command should produce some noise,
confirming that the sound card is working.
The /dev/dsp*
device nodes will
be created automatically as needed. When not in use, they
do not exist and will not appear in the output of
Table 8.1 lists some common error messages and their solutions:
Error | Solution |
sb_dspwr(XX) timed out | The I/O port is not set correctly. |
bad irq XX | The IRQ is set incorrectly. Make sure that the set IRQ and the sound IRQ are the same. |
xxx: gus pcm not attached, out of memory | There is not enough available memory to use the device. |
xxx: can't open /dev/dsp! | Type |
Modern graphics cards often come with their own sound
driver for use with HDMI. This sound
device is sometimes enumerated before the sound card meaning
that the sound card will not be used as the default playback
device. To check if this is the case, run
dmesg and look for
. The output looks something like
In this example, the graphics card
) has been enumerated before the
sound card (Realtek ALC889
). To use the
sound card as the default playback device, change
to the unit that should
be used for playback:
where n
is the number of the sound
device to use. In this example, it should be
. Make this change permanent by adding
the following line to
It is often desirable to have multiple sources of sound that are able to play simultaneously. FreeBSD uses "Virtual Sound Channels" to multiplex the sound card's playback by mixing sound in the kernel.
Three sysctl(8) knobs are available for configuring virtual channels:
This example allocates four virtual channels, which is a
practical number for everyday use. Both
are configurable after
a device has been attached and represent the number of virtual
channels pcm0
has for playback and
recording. Since the pcm
module can be
loaded independently of the hardware drivers,
indicates how many
virtual channels will be given to an audio device when it is
attached. Refer to pcm(4) for more information.
The number of virtual channels for a device cannot be changed while it is in use. First, close any programs using the device, such as music players or sound daemons.
The correct pcm
device will
automatically be allocated transparently to a program that
requests /dev/dsp0
The default values for the different mixer channels are
hardcoded in the source code of the pcm(4) driver. While
sound card mixer levels can be changed using mixer(8) or
third-party applications and daemons, this is not a permanent
solution. To instead set default mixer values at the driver
level, define the appropriate values in
, as seen in this
This will set the volume channel to a default value of
when the pcm(4) module is
This section describes some MP3 players available for FreeBSD, how to rip audio CD tracks, and how to encode and decode MP3s.
A popular graphical MP3 player is XMMS. Winamp skins can be used with XMMS since the interface is almost identical to that of Nullsoft's Winamp. XMMS also has native plug-in support.
XMMS can be installed from the multimedia/xmms port or package.
XMMS's interface is intuitive, with a playlist, graphic equalizer, and more. Those familiar with Winamp will find XMMS simple to use.
The audio/mpg123 port provides an alternative, command-line MP3 player.
mpg123 can be run by specifying
the sound device and the MP3 file on the
command line. Assuming the audio device is
and the
MP3 file is
, enter the
following to play the file:
Before encoding a CD or CD track to MP3, the audio data on the CD must be ripped to the hard drive. This is done by copying the raw CD Digital Audio (CDDA) data to WAV files.
The cdda2wav
tool, which is installed
with the sysutils/cdrtools
suite, is used for ripping audio information from CDs and the
information associated with them.
With the audio CD in the drive, the following command can
be issued as root
to rip an entire CD
into individual (per track) WAV
The -D
indicates the SCSI device 0,1,0
which corresponds to the output of cdrecord
cdda2wav will support ATAPI (IDE) CDROM drives. To rip from an IDE drive, specify the device name in place of the SCSI unit numbers. For example, to rip track 7 from an IDE drive:
To rip individual tracks, make use of the
as shown:
This example rips track seven of the audio CDROM. To rip a range of tracks, such as track one to seven, specify a range:
dd(1) can also be used to extract audio tracks on ATAPI drives, as described in Section 18.6.5, "Duplicating Audio CDs".
Lame is a popular MP3 encoder which can be installed from the audio/lame port. Due to licensing restrictions, a package is not available.
The following command will convert the ripped
WAV files
128 kbits is a standard MP3
bitrate. The 160 and 192 bitrates provide higher quality.
The higher the bitrate, the larger the size of the resulting
MP3. -h
turns on the
"higher quality but a little slower" mode. The
options beginning with --t
indicate ID3 tags,
which usually contain song information, to be embedded within
the MP3 file. Additional encoding options
can be found in the lame manual
In order to burn an audio CD from MP3s, they must first be converted to a non-compressed WAV format. Both XMMS and mpg123 support the output of MP3 to an uncompressed file format.
Writing to Disk in XMMS:
Launch XMMS.
Right-click the window to bring up the XMMS menu.
Select Preferences
Change the Output Plugin to "Disk Writer Plugin".
Press Configure
Enter or browse to a directory to write the uncompressed files to.
Load the MP3 file into XMMS as usual, with volume at 100% and EQ settings turned off.
Press Play
. The
XMMS will appear as if it is
playing the MP3, but no music will be
heard. It is actually playing the MP3
to a file.
When finished, be sure to set the default Output Plugin back to what it was before in order to listen to MP3s again.
Writing to stdout in mpg123:
Run mpg123 -s
audio01.mp3 >
XMMS writes a file in the WAV format, while mpg123 converts the MP3 into raw PCM audio data. Both of these formats can be used with cdrecord to create audio CDs, whereas burncd(8) requires a raw Pulse-Code Modulation (PCM). When using WAV files, there will be a small tick sound at the beginning of each track. This sound is the header of the WAV file. One can remove the header with SoX, which can be installed from the audio/sox port or package:
Refer to Section 18.6, "Creating and Using CD Media" for more information on using a CD burner in FreeBSD.
Before configuring video playback, determine the model and
chipset of the video card. While
Xorg supports a wide variety of
video cards, not all provide good playback performance. To
obtain a list of extensions supported by the
Xorg server using the card, run
Xorg is running.
It is a good idea to have a short MPEG test file for
evaluating various players and options. Since some
DVD applications look for
DVD media in /dev/dvd
by default, or have this
device name hardcoded in them, it might be useful to make a
symbolic links to the proper device:
Due to the nature of devfs(5), manually created links
will not persist after a system reboot. In order to recreate
the symbolic link automatically when the system boots, add the
following line to /etc/devfs.conf
DVD decryption invokes certain functions that require write permission to the DVD device.
To enhance the shared memory Xorg interface, it is recommended to increase the values of these sysctl(8) variables:
There are several possible ways to display video under Xorg and what works is largely hardware dependent. Each method described below will have varying quality across different hardware.
Common video interfaces include:
Xorg: normal output using shared memory.
XVideo: an extension to the Xorg interface which allows video to be directly displayed in drawable objects through a special acceleration. This extension provides good quality playback even on low-end machines. The next section describes how to determine if this extension is running.
SDL: the Simple Directmedia Layer is a porting layer for many operating systems, allowing cross-platform applications to be developed which make efficient use of sound and graphics. SDL provides a low-level abstraction to the hardware which can sometimes be more efficient than the Xorg interface. On FreeBSD, SDL can be installed using the devel/sdl20 package or port.
DGA: the Direct Graphics Access is an
Xorg extension which allows a
program to bypass the Xorg
server and directly alter the framebuffer. Because it
relies on a low level memory mapping, programs using it must
be run as root
. The
DGA extension can be tested and
benchmarked using dga(1). When dga
is running, it changes the colors of the display whenever a
key is pressed. To quit, press q.
SVGAlib: a low level console graphics layer.
To check whether this extension is running, use
XVideo is supported for the card if the result is similar to:
The formats listed, such as YUV2 and YUV12, are not present with every implementation of XVideo and their absence may hinder some players.
If the result instead looks like:
XVideo is probably not supported for the card. This means that it will be more difficult for the display to meet the computational demands of rendering video, depending on the video card and processor.
This section introduces some of the software available from the FreeBSD Ports Collection which can be used for video playback.
MPlayer is a command-line video player with an optional graphical interface which aims to provide speed and flexibility. Other graphical front-ends to MPlayer are available from the FreeBSD Ports Collection.
MPlayer can be installed using the multimedia/mplayer package or port. Several compile options are available and a variety of hardware checks occur during the build process. For these reasons, some users prefer to build the port rather than install the package.
When compiling the port, the menu options should be reviewed to determine the type of support to compile into the port. If an option is not selected, MPlayer will not be able to display that type of video format. Use the arrow keys and spacebar to select the required formats. When finished, press Enter to continue the port compile and installation.
By default, the package or port will build the
command line utility and the
graphical utility. To encode
videos, compile the multimedia/mencoder port. Due to
licensing restrictions, a package is not available for
The first time MPlayer is run,
it will create ~/.mplayer
in the user's home
directory. This subdirectory contains default versions of
the user-specific configuration files.
This section describes only a few common uses. Refer to mplayer(1) for a complete description of its numerous options.
To play the file
specify the video interfaces with -vo
, as
seen in the following examples:
It is worth trying all of these options, as their relative performance depends on many factors and will vary significantly with hardware.
To play a DVD, replace
with dvd://
, where
is the title number to play and
is the device node for the
DVD. For example, to play title 3 from
The default DVD device can be defined
during the build of the MPlayer
port by including the
option. By default, the device is
. More details can be found in
the port's Makefile.options
To stop, pause, advance, and so on, use a keybinding. To
see the list of keybindings, run mplayer
or read mplayer(1).
Additional playback options include -fs
, which engages fullscreen mode, and
, which helps performance.
Each user can add commonly used options to their
like so:
can be used to rip a
DVD title to a .vob
To dump the second title from a DVD:
The output file, out.vob
, will be in
MPEG format.
Anyone wishing to obtain a high level of expertise with UNIX® video should consult mplayerhq.hu/DOCS as it is technically informative. This documentation should be considered as required reading before submitting any bug reports.
Before using mencoder
, it is a good
idea to become familiar with the options described at
There are innumerable ways to improve quality, lower bitrate,
and change formats, and some of these options may make the
difference between good or bad performance. Improper
combinations of command line options can yield output files
that are unplayable even by mplayer
Here is an example of a simple copy:
To rip to a file, use -dumpfile
To convert
the MPEG4 codec with MPEG3 audio encoding, first install the
audio/lame port. Due to
licensing restrictions, a package is not available. Once
installed, type:
This will produce output playable by applications such as
and xine
can be replaced with dvd://1 -dvd-device
and run as root
re-encode a DVD title directly. Since it
may take a few tries to get the desired result, it is
recommended to instead dump the title to a file and to work on
the file.
xine is a video player with a reusable base library and a modular executable which can be extended with plugins. It can be installed using the multimedia/xine package or port.
In practice, xine requires either a fast CPU with a fast video card, or support for the XVideo extension. The xine video player performs best on XVideo interfaces.
By default, the xine player starts a graphical user interface. The menus can then be used to open a specific file.
Alternatively, xine may be invoked from the command line by specifying the name of the file to play:
Refer to xine-project.org/faq for more information and troubleshooting tips.
Transcode provides a suite of tools for re-encoding video and audio files. Transcode can be used to merge video files or repair broken files using command line tools with stdin/stdout stream interfaces.
In FreeBSD, Transcode can be installed using the multimedia/transcode package or port. Many users prefer to compile the port as it provides a menu of compile options for specifying the support and codecs to compile in. If an option is not selected, Transcode will not be able to encode that format. Use the arrow keys and spacebar to select the required formats. When finished, press Enter to continue the port compile and installation.
This example demonstrates how to convert a DivX file into a PAL MPEG-1 file (PAL VCD):
The resulting MPEG file,
is ready to be played with MPlayer.
The file can be burned on a CD media to
create a video CD using a utility such as
multimedia/vcdimager or sysutils/cdrdao.
In addition to the manual page for
, refer to transcoding.org/cgi-bin/transcode
for further information and examples.
TV cards can be used to watch broadcast or cable TV on a computer. Most cards accept composite video via an RCA or S-video input and some cards include a FM radio tuner.
FreeBSD provides support for PCI-based TV cards using a Brooktree Bt848/849/878/879 video capture chip with the bktr(4) driver. This driver supports most Pinnacle PCTV video cards. Before purchasing a TV card, consult bktr(4) for a list of supported tuners.
In order to use the card, the bktr(4) driver must be
loaded. To automate this at boot time, add the following line
to /boot/loader.conf
Alternatively, one can statically compile support for the TV card into a custom kernel. In that case, add the following lines to the custom kernel configuration file:
These additional devices are necessary as the card components are interconnected via an I2C bus. Then, build and install a new kernel.
To test that the tuner is correctly detected, reboot the system. The TV card should appear in the boot messages, as seen in this example:
The messages will differ according to the hardware. If necessary, it is possible to override some of the detected parameters using sysctl(8) or custom kernel configuration options. For example, to force the tuner to a Philips SECAM tuner, add the following line to a custom kernel configuration file:
or, use sysctl(8):
Refer to bktr(4) for a description of the available sysctl(8) parameters and kernel options.
To use the TV card, install one of the following applications:
multimedia/fxtv provides TV-in-a-window and image/audio/video capture capabilities.
multimedia/xawtv is another TV application with similar features.
audio/xmradio provides an application for using the FM radio tuner of a TV card.
More applications are available in the FreeBSD Ports Collection.
If any problems are encountered with the TV card, check that the video capture chip and the tuner are supported by bktr(4) and that the right configuration options were used. For more support or to ask questions about supported TV cards, refer to the freebsd-multimedia mailing list.
MythTV is a popular, open source Personal Video Recorder (PVR) application. This section demonstrates how to install and setup MythTV on FreeBSD. Refer to mythtv.org/wiki for more information on how to use MythTV.
MythTV requires a frontend and a backend. These components can either be installed on the same system or on different machines.
The frontend can be installed on FreeBSD using the multimedia/mythtv-frontend package or port. Xorg must also be installed and configured as described in Chapter 6, The X Window System. Ideally, this system has a video card that supports X-Video Motion Compensation (XvMC) and, optionally, a Linux Infrared Remote Control (LIRC)-compatible remote.
To install both the backend and the frontend on FreeBSD, use the multimedia/mythtv package or port. A MySQL™ database server is also required and should automatically be installed as a dependency. Optionally, this system should have a tuner card and sufficient storage to hold recorded data.
MythTV uses Video for Linux (V4L) to access video input devices such as encoders and tuners. In FreeBSD, MythTV works best with USB DVB-S/C/T cards as they are well supported by the multimedia/webcamd package or port which provides a V4L userland application. Any Digital Video Broadcasting (DVB) card supported by webcamd should work with MythTV. A list of known working cards can be found at wiki.freebsd.org/WebcamCompat. Drivers are also available for Hauppauge cards in the multimedia/pvr250 and multimedia/pvrxxx ports, but they provide a non-standard driver interface that does not work with versions of MythTV greater than 0.23. Due to licensing restrictions, no packages are available and these two ports must be compiled.
The wiki.freebsd.org/HTPC page contains a list of all available DVB drivers.
To install MythTV using the port:
Once installed, set up the MythTV database:
Then, configure the backend:
Finally, start the backend:
In FreeBSD, access to image scanners is provided by the SANE (Scanner Access Now Easy) API available through the FreeBSD Ports Collection. SANE will also use some FreeBSD device drivers to provide access to the scanner hardware.
FreeBSD supports both SCSI and USB scanners. Be sure the scanner is supported by SANE prior to performing any configuration. Refer to the supported devices list for more information about supported scanners.
Both SCSI and USB interfaces are supported. Depending upon the scanner interface, different device drivers are required.
The GENERIC
kernel by default
includes the device drivers needed to support USB scanners.
Users with a custom kernel should ensure that the following
lines are present in the custom kernel configuration
Plug in the USB scanner. Use dmesg(8) to determine whether the scanner appears in the system message buffer:
These messages indicate that the scanner is using
either /dev/ugen0.2
, depending on the FreeBSD
version. For this example, a
Perfection® 1650 USB scanner was used.
If the scanner uses a SCSI interface, it is important to
know which SCSI controller board it will use. Depending
upon the SCSI chipset, a custom kernel configuration file
may be needed. The GENERIC
supports the most common SCSI controllers. Refer to
to determine
the correct line to add to a custom kernel configuration
file. In addition to the SCSI adapter driver, the following
lines are needed in the kernel configuration file:
Verify that the device is displayed in the system message buffer:
If the scanner was not powered-on at system boot, it is still possible to manually force the detection by performing a SCSI bus scan with the camcontrol(8) command:
The scanner should now appear in the SCSI devices list:
Refer to scsi(4) and camcontrol(8) for more details about SCSI devices on FreeBSD.
The SANE system is split in two parts: the backends (graphics/sane-backends) and the frontends (graphics/sane-frontends). The backends provide access to the scanner. The SANE's supported devices list specifies which backend will support the image scanner. The correct backend is needed in order to use the scanner. The frontends provide the graphical scanning interface, xscanimage.
After installing the graphics/sane-backends port or
package, use sane-find-scanner
to check the
scanner detection by the
SANE system:
The output should show the interface type of the scanner and the device node used to attach the scanner to the system. The vendor and the product model may or may not appear.
Some USB scanners require firmware to be loaded. Refer to sane-find-scanner(1) and sane(7) for details.
Next, check if the scanner will be identified by a
scanning frontend. By default, the
SANE backends come with a command
line tool called scanimage(1). This command can be used
to list the devices and perform an image acquisition. Use
to list the scanner devices:
Here is the output for the USB scanner used in Section 184.108.40.206, "USB Interface":
In this output,
the backend name (epson2
) and the device
node (/dev/ugen0.2
) used by the
No output or a message saying that no scanners were
identified indicates that scanimage(1) is unable to
identify the scanner. If this happens, edit the backend
configuration file in /usr/local/etc/sane.d/
and define the scanner device used.
In the above example, the USB scanner is perfectly detected and working.
To determine if the scanner is correctly identified:
Since the scanner is not identified, edit
. In
this example, the scanner model is
Perfection® 1650 and it uses the
backend. When editing, read the
help comments in the backend configuration file. Line
changes are simple: comment out all lines that have the
wrong interface for the scanner. In this example, comment
out all lines starting with the word scsi
as the scanner uses the USB interface. Then, at the end
of the file, add a line specifying the interface and the
device node used. In this case, add the following
Save the edits and verify that the scanner is identified:
The `epson:/dev/uscanner0'
field now
gives the right backend name and the device node.
Once scanimage -L
sees the scanner, the
configuration is complete and the device is now ready to
While scanimage(1) can be used to perform an image acquisition from the command line, it is often preferable to use a graphical interface to perform image scanning. The graphics/sane-frontends package or port installs a simple but efficient graphical interface, xscanimage.
Xsane, which is installed with the graphics/xsane package or port, is another popular graphical scanning frontend. It offers advanced features such as various scanning modes, color correction, and batch scans. Both of these applications are usable as a GIMP plugin.
In order to have access to the scanner, a user needs
read and write permissions to the device node used by the
scanner. In the previous example, the USB scanner uses the
device node /dev/ugen0.2
which is really a
symlink to the real device node
. The symlink and the device
node are owned, respectively, by the
groups. Adding the user to
these groups will allow access to the scanner. However, for
security reasons, always think twice before adding a user
to any group, especially wheel
. A better
solution is to create a group to make the scanner device
accessible to members of this group.
This example creates a group called
Then, make the /dev/ugen0.2
and the /dev/usb/0.2.0
device node
accessible to the usb
group with write
permissions of (0660
. All of this is done by adding the
following lines to
Finally, add the users to
in order
to allow access to the scanner:usb
For more details refer to pw(8).
The kernel is the core of the FreeBSD operating system. It is responsible for managing memory, enforcing security controls, networking, disk access, and much more. While much of FreeBSD is dynamically configurable, it is still occasionally necessary to configure and compile a custom kernel.
After reading this chapter, you will know:
When to build a custom kernel.
How to take a hardware inventory.
How to customize a kernel configuration file.
How to use the kernel configuration file to create and build a new kernel.
How to install the new kernel.
How to troubleshoot if things go wrong.
All of the commands listed in the examples in this chapter
should be executed as root
Traditionally, FreeBSD used a monolithic kernel. The kernel was one large program, supported a fixed list of devices, and in order to change the kernel's behavior, one had to compile and then reboot into a new kernel.
Today, most of the functionality in the FreeBSD kernel is contained in modules which can be dynamically loaded and unloaded from the kernel as necessary. This allows the running kernel to adapt immediately to new hardware or for new functionality to be brought into the kernel. This is known as a modular kernel.
Occasionally, it is still necessary to perform static kernel configuration. Sometimes the needed functionality is so tied to the kernel that it can not be made dynamically loadable. Some security environments prevent the loading and unloading of kernel modules and require that only needed functionality is statically compiled into the kernel.
Building a custom kernel is often a rite of passage for
advanced BSD users. This process, while time consuming, can
provide benefits to the FreeBSD system. Unlike the
kernel, which must support a wide
range of hardware, a custom kernel can be stripped down to only
provide support for that computer's hardware. This has a number
of benefits, such as:
Faster boot time. Since the kernel will only probe the hardware on the system, the time it takes the system to boot can decrease.
Lower memory usage. A custom kernel often uses less
memory than the GENERIC
kernel by
omitting unused features and device drivers. This is
important because the kernel code remains resident in
physical memory at all times, preventing that memory from
being used by applications. For this reason, a custom
kernel is useful on a system with a small amount of
Additional hardware support. A custom kernel can add
support for devices which are not present in the
Before building a custom kernel, consider the reason for doing so. If there is a need for specific hardware support, it may already exist as a module.
Kernel modules exist in /boot/kernel
and may be
dynamically loaded into the running kernel using
kldload(8). Most kernel drivers have a
loadable module and manual page. For example, the ath(4)
wireless Ethernet driver has the following information in its
manual page:
Adding if_ath_load="YES"
will load this
module dynamically at boot time.
In some cases, there is no associated module in /boot/kernel
. This is
mostly true for certain subsystems.
Before editing the kernel configuration file, it is recommended to perform an inventory of the machine's hardware. On a dual-boot system, the inventory can be created from the other operating system. For example, Microsoft®'s Device Manager contains information about installed devices.
Some versions of Microsoft® Windows® have a System icon which can be used to access Device Manager.
If FreeBSD is the only installed operating system, use dmesg(8) to determine the hardware that was found and listed during the boot probe. Most device drivers on FreeBSD have a manual page which lists the hardware supported by that driver. For example, the following lines indicate that the psm(4) driver found a mouse:
Since this hardware exists, this driver should not be removed from a custom kernel configuration file.
If the output of dmesg
does not display
the results of the boot probe output, instead read the contents of
Another tool for finding hardware is pciconf(8), which provides more verbose output. For example:
This output shows that the
driver located a wireless Ethernet
The -k
flag of man(1)
can be used to provide useful information. For example, to
display a list of manual pages which contain the specified
Once the hardware inventory list is created, refer to it to ensure that drivers for installed hardware are not removed as the custom kernel configuration is edited.
In order to create a custom kernel configuration file and build a custom kernel, the full FreeBSD source tree must first be installed.
If /usr/src/
does not exist or it is
empty, source has not been installed. Source can be installed
using Subversion, which is described
in Section A.4, "Using Subversion".
Once source is installed, review the contents of
. This directory contains a
number of subdirectories, including those which represent the following
supported architectures: amd64
, i386
, ia64
, pc98
, powerpc
, and sparc64
. Everything inside a
particular architecture's directory deals with that architecture
only and the rest of the code is machine independent code common
to all platforms. Each supported architecture has a conf
which contains the GENERIC
configuration file for that architecture.
Do not make edits to GENERIC
. Instead,
copy the file to a different name and make edits to the copy.
The convention is to use a name with all capital letters. When
maintaining multiple FreeBSD machines with different hardware, it
is a good idea to name it after the machine's hostname. This
example creates a custom configuration file for the
When finished customizing the kernel configuration file,
save a backup copy to a location outside of /usr/src
Alternately, keep the kernel configuration file elsewhere and create a symbolic link to the file:
The configuration file
can now be customized
with any ASCII text editor. The default editor is
vi, though an easier editor
for beginners, called ee, is also
installed with FreeBSD.
The format of the kernel configuration file is simple.
Each line contains a keyword that represents a device or
subsystem, an argument, and a brief description. Any text
after a #
is considered a comment and
ignored. To remove kernel support for a device or subsystem,
put a #
at the beginning of the line
representing that device or subsystem. Do not add or remove a
for any line that you do not understand.
In addition to the brief descriptions provided in this file, additional
descriptions are contained in
, which can be found in the same
directory as GENERIC
for that architecture.
For architecture independent options, refer to
An include
directive is available for use
in configuration files. This allows another configuration file
to be included in the current one, making it easy to maintain
small changes relative to an existing file. For example, if
only a small number of additional options or drivers are
required, this allows a delta to be maintained with respect
to GENERIC:
Using this method, the local configuration file expresses
local differences from a GENERIC
kernel. As upgrades are performed, new features added to
will also be added to the local
kernel unless they are specifically prevented using
or nodevice
A comprehensive list of configuration directives and their
descriptions may be found in config(5).
To build a file which contains all available options,
run the following command as root
This is the identification of the kernel. Change
this to the new kernel name, such as
The value in the ident
string will
print when the kernel boots.
This option enables debugging information when passed to gcc(1).
The default system scheduler for FreeBSD. Keep this.
Networking support. This is mandatory as most programs require at least loopback networking.
This enables the IPv6 communication protocols.
This is the basic hard drive file system. Leave it in if the system boots from the hard disk.
This option enables Soft Updates in the kernel which helps
to speed up write access on the disks. Even when this
functionality is provided by the kernel, it must be turned on
for specific disks. Review the output of mount(8) to
determine if Soft Updates is enabled. If the
option is not in the output, it
can be activated using tunefs(8) for existing file systems
or newfs(8) for new file systems.
This option enables kernel support for access control lists (ACLs). This relies on the use of extended attributes and UFS2, and the feature is described in detail in Section 14.9, "Filesystem Access Control Lists (ACL)s". ACLs are enabled by default and should not be disabled in the kernel if they have been used previously on a file system, as this will remove the ACLs, changing the way files are protected in unpredictable ways.
This option includes functionality to speed up disk operations on large directories, at the expense of using additional memory. Keep this for a large server or interactive workstation, and remove it from smaller systems where memory is at a premium and disk access speed is less important, such as a firewall.
This option enables support for a memory backed virtual disk used as a root device.
The network file system (NFS). These lines can be commented unless the system needs to mount partitions from a NFS file server over TCP/IP.
The MS-DOS® file system. Unless the system needs to mount
a DOS formatted hard drive partition at boot time, comment this
out. It will be automatically loaded the first time a DOS
partition is mounted. The emulators/mtools package allows
access to DOS floppies without having to mount and unmount
them and does not require MSDOSFS
The ISO 9660 file system for CDROMs. Comment it out if the system does not have a CDROM drive or only mounts data CDs occasionally since it will be dynamically loaded the first time a data CD is mounted. Audio CDs do not need this file system.
The process file system. This is a "pretend"
file system mounted on /proc
which allows some programs
to provide more information on what processes are running. Use
of PROCFS
is not required under most
circumstances, as most debugging and monitoring tools have been
adapted to run without PROCFS
. The default
installation will not mount this file system by default.
Kernels making use of PROCFS
also include support for PSEUDOFS
Adds support for GUID Partition Tables (GPT). GPT provides the ability to have a large number of partitions per disk, 128 in the standard configuration.
Compatibility with 4.3BSD. Leave this in as some programs will act strangely if this is commented out.
This option is required to support applications compiled on older versions of FreeBSD that use older system call interfaces. It is recommended that this option be used on all i386™ systems that may run older applications. Platforms that gained support after FreeBSD 4.X, such as ia64 and SPARC64®, do not require this option.
This option is required to support applications compiled on FreeBSD 5.X versions that use FreeBSD 5.X system call interfaces.
This option is required to support applications compiled on FreeBSD 6.X versions that use FreeBSD 6.X system call interfaces.
This option is required on FreeBSD 8 and above to support applications compiled on FreeBSD 7.X versions that use FreeBSD 7.X system call interfaces.
This causes the kernel to pause for 5 seconds before probing each SCSI device in the system. If SCSI drives are not recognized, increase the number. If the system does not have any SCSI drives, this value can be ignored or decreased to speed up booting.
This enables kernel process tracing, which is useful in debugging.
This option provides for System V shared memory. The most common use of this is the XSHM extension in X, which many graphics-intensive programs will automatically take advantage of for extra speed. If Xorg is installed, include this.
Support for System V messages. This option only adds a few hundred bytes to the kernel.
Support for System V semaphores. Less commonly used, but only adds a few hundred bytes to the kernel.
Using -p
with ipcs(1) will list any
processes using each of these System V facilities.
Real-time extensions added in the 1993 POSIX®. Certain applications in the Ports Collection use these.
This option is required to allow the creation of keyboard
device nodes in /dev
This device enables the use of the I/O APIC for interrupt
delivery. It can be used in both uni-processor and SMP kernels,
but is required for SMP kernels. Add options
to include support for multiple
This device exists only on the i386™ architecture and this configuration line should not be used on other architectures.
Include this for systems with an EISA motherboard. This enables auto-detection and configuration support for all devices on the EISA bus.
Include this for systems with a PCI motherboard. This enables auto-detection of PCI cards and gatewaying from the PCI to ISA bus.
This is the floppy drive controller.
This driver supports all ATA and ATAPI devices. Only
one device ata
line is needed for the kernel
to detect all PCI ATA/ATAPI devices on modern machines.
This is needed along with device ata
ATA disk drives.
This is needed along with device ata
for ATA RAID drives.
This is needed along with device ata
for ATAPI CDROM drives.
This is needed along with device ata
ATAPI floppy drives.
This is needed along with device ata
ATAPI tape drives.
This makes the controller number static. Without this, the device numbers are dynamically allocated.
In this section, comment out any SCSI controllers not on
the system. For an IDE only system, these lines can be removed.
The *_REG_PRETTY_PRINT
lines are
debugging options for their respective drivers.
Comment out any SCSI peripherals not on the system. If the system only has IDE hardware, these lines can be removed completely.
The USB umass(4) driver and a few other drivers use the SCSI subsystem even though they are not real SCSI devices. Do not remove SCSI support if any such drivers are included in the kernel configuration.
Supported RAID controllers. If the system does not have any of these, comment them out or remove them.
The atkbdc
keyboard controller provides
I/O services for the AT keyboard and PS/2 style pointing
devices. This controller is required by atkbd(4) and
The atkbd(4) driver, together with the atkbdc(4) controller, provides access to the AT 84 keyboard or the AT enhanced keyboard which is connected to the AT keyboard controller.
Use this device if the mouse plugs into the PS/2 mouse port.
Basic support for keyboard multiplexing. If the system does not use more than one keyboard, this line can be safely removed.
The vga(4) video card driver.
Required by the boot splash screen and screen savers.
sc(4) is the default console driver and resembles a SCO
console. Since most full-screen programs access the console
through a terminal database library like
, it should not matter whether
this or vt
, the
compatible console driver, is used.
When a user logs in, the TERM
variable can be set
to scoansi
if full-screen programs have
trouble running under this console.
This is a VT220-compatible console driver, backward
compatible to VT100/102. It works well on some laptops which
have hardware incompatibilities with sc
Users may need to set TERM
or vt220
login. This driver is useful when connecting to a large number
of different machines over the network, where
or terminfo
entries for the sc
device are not
available as vt100
should be available
on virtually any platform.
Include this if the system has an AGP card. This will enable support for AGP and AGP GART for boards which have these features.
Timer device driver for power management events, such as APM and ACPI.
PCMCIA support. Keep this on laptop systems.
These are the serial ports referred to as
ports in Windows®.
If the system has an internal modem on
and a serial port at
, change the IRQ of the modem to
2. For a multiport serial card, refer to sio(4) for more
information on the proper values to add to
. Some video cards,
notably those based on S3 chips, use I/O addresses in the
form of 0x*2e8
. Since many cheap serial
cards do not fully decode the 16-bit I/O address space, they
clash with these cards, making the
port practically
Each serial port is required to have a unique IRQ and the
default IRQs for COM3
cannot be used. The exception
is multiport cards where shared interrupts are
This is the ISA bus parallel port interface.
Provides support for the parallel port bus.
Adds support for parallel port printers.
All three of the above are required to enable parallel printer support.
The general-purpose I/O ("geek port") + IEEE1284 I/O.
This is for an Iomega Zip drive. It requires
and da
Best performance is achieved with ports in EPP 1.9 mode.
Uncomment this device if the system has a "dumb" serial or parallel PCI card that is supported by the puc(4) glue driver.
Various PCI network card drivers. Comment out or remove any of these which are not present in the system.
MII bus support is required for some PCI 10/100 Ethernet
NICs, namely those which use MII-compliant transceivers or
implement transceiver control interfaces that operate like an
MII. Adding device miibus
to the kernel
config pulls in support for the generic miibus API and all of
the PHY drivers, including a generic one for PHYs that are not
specifically handled by an individual driver.
Drivers that use the MII bus controller code.
ISA Ethernet drivers. See
for details of which cards are supported by which driver.arch
Generic 802.11 support. This line is required for wireless networking.
Crypto support for 802.11 devices. These lines are needed on systems which use encryption and 802.11i security protocols.
Support for various wireless cards.
This is the generic loopback device for TCP/IP. This is mandatory.
Cryptographically secure random number generator.
is only needed if the system has
an Ethernet card. It includes generic Ethernet protocol
provides SLIP support. This has been
almost entirely supplanted by PPP, which is easier to set up,
better suited for modem-to-modem connection, and more
This is for kernel PPP support for dial-up connections.
There is also a version of PPP implemented as a userland
application that uses tun
and offers more
flexibility and features such as demand dialing.
This is used by the userland PPP software. See the PPP section of the Handbook for more information.
This is a "pseudo-terminal" or simulated
login port. It is used by incoming telnet
and rlogin
xterm, and some other applications
such as Emacs.
Memory disk pseudo-devices.
This implements IPv6 over IPv4 tunneling, IPv4 over IPv6
tunneling, IPv4 over IPv4 tunneling, and IPv6 over IPv6
tunneling. The gif
device is
"auto-cloning", and will create device nodes as
This pseudo-device captures packets that are sent to it and diverts them to the IPv4/IPv6 translation daemon.
The Berkeley Packet Filter pseudo-device allows network interfaces to be placed in promiscuous mode, capturing every packet on a broadcast network such as an Ethernet network. These packets can be captured to disk and or examined using tcpdump(1).
The bpf(4) device is also used by dhclient(8). If DHCP is used, leave this uncommented.
Support for various USB devices.
Support for various Firewire devices.
For more information and additional devices supported by
FreeBSD, see
Large memory configuration machines require access to more than the 4 gigabyte limit on User+Kernel Virtual Address (KVA) space. Due to this limitation, Intel added support for 36-bit physical address space access in the Pentium® Pro and later line of CPUs.
The Physical Address Extension (PAE)
capability of the Intel® Pentium® Pro and later CPUs allows
memory configurations of up to 64 gigabytes. FreeBSD provides
support for this capability via the PAE
kernel configuration option, available in all current release
versions of FreeBSD. Due to the limitations of the Intel memory
architecture, no distinction is made for memory above or below
4 gigabytes. Memory allocated above 4 gigabytes is simply
added to the pool of available memory.
To enable PAE support in the kernel, add the following line to the kernel configuration file:
The PAE support in FreeBSD is only available for Intel® IA-32 processors. It should also be noted that the PAE support in FreeBSD has not received wide testing, and should be considered beta quality compared to other stable features of FreeBSD.
PAE support in FreeBSD has a few limitations:
A process is not able to access more than 4 gigabytes of virtual memory space.
Device drivers that do not use the bus_dma(9)
interface will cause data corruption in a
PAE enabled kernel and are not
recommended for use. For this reason, a
kernel configuration file is
provided in FreeBSD which excludes all drivers not known to
work in a PAE enabled kernel.
Some system tunables determine memory resource usage
by the amount of available physical memory. Such
tunables can unnecessarily over-allocate due to the
large memory nature of a PAE system.
One such example is the
sysctl, which controls
the maximum number of vnodes allowed in the kernel. It
is advised to adjust this and other such tunables to a
reasonable value.
It might be necessary to increase the kernel virtual
address (KVA) space or to reduce the
amount of specific kernel resource that is heavily used
in order to avoid KVA exhaustion.
The KVA_PAGES
kernel option can be used
for increasing the KVA space.
For performance and stability concerns, it is advised to consult tuning(7). pae(4) contains up-to-date information on FreeBSD's PAE support.
After saving the edits, compile the source code for the kernel.
After syncing the source tree
with the latest sources, always read
before performing any update steps. This file describes any
important issues or areas requiring special attention within
the updated source code.
always matches
the version of the FreeBSD source and contains more up-to-date
information than this Handbook.
It is easy to remove support for a device or option and end up with a broken kernel. For example, if the ata(4) driver is removed from the kernel configuration file, a system using ATA disk drivers may not boot. When in doubt, just leave support in the kernel.
It is required to have the full FreeBSD source tree installed to build the kernel.
to /usr/src
Compile the new kernel by specifying the name of the custom kernel configuration file:
Install the new kernel:
By default, when a custom kernel is compiled,
all kernel modules are rebuilt as well.
To update a kernel faster or to build only custom modules,
edit /etc/make.conf
before starting to
build the kernel:
This variable specifies the list of modules to build instead the default of building of all of them.
This variable sets up a list of top level modules to exclude from the build process. For other available variables, refer to make.conf(5).
The new kernel will be copied to /boot/kernel
and the old kernel
will be moved to /boot/kernel.old/kernel
Now, shutdown the system and reboot into the new kernel.
If something goes wrong, refer to the troubleshooting
instructions and the section which explains how to
recover when the new kernel does not boot.
Other files relating to the boot process, such as the boot
loader(8) and configuration, are stored in /boot
. Third party or
custom modules can be placed in /boot/kernel
, although users
should be aware that keeping modules in sync with the compiled
kernel is very important. Modules not intended to run with
the compiled kernel may result in instability.
There are four categories of trouble that can occur when building a custom kernel. They are:
fails:If config(8) fails, it is probably a simple error. Fortunately, config(8) will print the line number that it had trouble with. For example, for this message:
Make sure the keyword on line 17 is typed correctly by
comparing it to the
kernel or another
fails:If make
fails, it usually signals
an error in the kernel description which is not severe
enough for config(8) to catch. Review the
configuration, and if you still cannot resolve the
problem, send an email to the FreeBSD general questions mailing list with the
kernel configuration.
If the new kernel does not boot, or fails to recognize
devices, do not panic! Fortunately, FreeBSD has an excellent
mechanism for recovering from incompatible kernels.
Simply choose the kernel to boot from at the FreeBSD boot
loader. This can be accessed when the system boot menu
appears by selecting the "Escape to a loader
prompt" option. At the prompt, type
, or
the name of any other kernel that will boot properly.
When reconfiguring a kernel, it is always a good idea to
keep a kernel that is known to work on hand.
After booting with a good kernel, check over the
configuration file and try to build it again. One helpful
resource is /var/log/messages
records the kernel messages from every successful boot.
Also, dmesg(8) will print the kernel messages from
the current boot.
When troubleshooting a kernel, make sure to keep
, or some other kernel that
is known to work, on hand as a different name that will
not get erased on the next build. Do not rely on
because when installing
a new kernel, kernel.old
overwritten with the last installed kernel which may
be non-functional. As soon as possible, move the
working kernel to the proper /boot/kernel
location or commands such as ps(1) may not work
properly. To do this, simply rename the directory
containing the good kernel:
If the kernel version differs from the one that the system utilities have been built with, for example, a -CURRENT kernel on a -RELEASE, many system status commands like ps(1) and vmstat(8) will not work. To fix this, recompile and install a world built with the same version of the source tree as the kernel. This is one reason why it is not a good idea to use a different version of the kernel than the rest of the operating system.
FreeBSD can be used to print with a wide variety of printers, from the oldest impact printer to the latest laser printers, and everything in between, allowing you to produce high-quality printed output from the applications you run.
FreeBSD can also be configured to act as a print server on a network; in this capacity FreeBSD can receive print jobs from a variety of other computers, including other FreeBSD computers, Windows® and Mac OS® hosts. FreeBSD will ensure that one job at a time is printed, and can keep statistics on which users and machines are doing the most printing, produce "banner" pages showing whose printout is whose, and more.
After reading this chapter, you will know:
How to configure the FreeBSD print spooler.
How to install print filters, to handle special print jobs differently, including converting incoming documents to print formats that your printers understand.
How to enable header, or banner pages on your printout.
How to print with printers connected to other computers.
How to print with printers connected directly to the network.
How to control printer restrictions, including limiting the size of print jobs, and preventing certain users from printing.
How to keep printer statistics, and account for printer usage.
How to troubleshoot printing problems.
Before reading this chapter, you should:
Know how to configure and install a new kernel (Chapter 9, Configuring the FreeBSD Kernel).
In order to use printers with FreeBSD you may set them up to work with the Berkeley line printer spooling system, also known as the LPD spooling system, or just LPD. It is the standard printer control system in FreeBSD. This chapter introduces LPD and will guide you through its configuration.
If you are already familiar with LPD or another printer spooling system, you may wish to skip to section Basic Setup.
LPD controls everything about a host's printers. It is responsible for a number of things:
It controls access to attached printers and printers attached to other hosts on the network.
It enables users to submit files to be printed; these submissions are known as jobs.
It prevents multiple users from accessing a printer at the same time by maintaining a queue for each printer.
It can print header pages (also known as banner or burst pages) so users can easily find jobs they have printed in a stack of printouts.
It takes care of communications parameters for printers connected on serial ports.
It can send jobs over the network to a LPD spooler on another host.
It can run special filters to format jobs to be printed for various printer languages or printer capabilities.
It can account for printer usage.
Through a configuration file
), and by providing the
special filter programs, you can enable the
LPD system to do all or some subset
of the above for a great variety of printer hardware.
The spooler still provides benefit on a single-user system and should be used because:
LPD prints jobs in the background; you do not have to wait for data to be copied to the printer.
LPD can conveniently run a job to be printed through filters to add date/time headers or convert a special file format (such as a TeX DVI file) into a format the printer will understand. You will not have to do these steps manually.
Many free and commercial programs that provide a print feature usually expect to talk to the spooler on your system. By setting up the spooling system, you will more easily support other software you may later add or already have.
To use printers with the LPD spooling system, you will need to set up both your printer hardware and the LPD software. This document describes two levels of setup:
See section Simple Printer Setup to learn how to connect a printer, tell LPD how to communicate with it, and print plain text files to the printer.
See section Advanced Printer Setup to learn how to print a variety of special file formats, to print header pages, to print across a network, to control access to printers, and to do printer accounting.
This section tells how to configure printer hardware and the LPD software to use the printer. It teaches the basics:
Section Hardware Setup gives some hints on connecting the printer to a port on your computer.
Section Software
Setup shows how to set up the
LPD spooler configuration
file (/etc/printcap
If you are setting up a printer that uses a network protocol to accept data to print instead of a computer's local interfaces, see Printers With Networked Data Stream Interfaces.
Although this section is called "Simple Printer Setup", it is actually fairly complex. Getting the printer to work with your computer and the LPD spooler is the hardest part. The advanced options like header pages and accounting are fairly easy once you get the printer working.
This section tells about the various ways you can connect a printer to your PC. It talks about the kinds of ports and cables, and also the kernel configuration you may need to enable FreeBSD to speak to the printer.
If you have already connected your printer and have successfully printed with it under another operating system, you can probably skip to section Software Setup.
Printers sold for use on PC's today generally come with one or more of the following three interfaces:
Serial interfaces, also known as RS-232 or COM ports, use a serial port on your computer to send data to the printer. Serial interfaces are common in the computer industry and cables are readily available and also easy to construct. Serial interfaces sometimes need special cables and might require you to configure somewhat complex communications options. Most PC serial ports have a maximum transmission rate of 115200 bps, which makes printing large graphic print jobs with them impractical.
Parallel interfaces use a parallel port on your computer to send data to the printer. Parallel interfaces are common in the PC market and are faster than RS-232 serial. Cables are readily available but more difficult to construct by hand. There are usually no communications options with parallel interfaces, making their configuration exceedingly simple.
Parallel interfaces are sometimes known as "Centronics" interfaces, named after the connector type on the printer.
USB interfaces, named for the Universal Serial Bus, can run at even faster speeds than parallel or RS-232 serial interfaces. Cables are simple and cheap. USB is superior to RS-232 Serial and to Parallel for printing, but it is not as well supported under UNIX® systems. A way to avoid this problem is to purchase a printer that has both a USB interface and a Parallel interface, as many printers do.
In general, Parallel interfaces usually offer just one-way communication (computer to printer) while serial and USB gives you two-way. Newer parallel ports (EPP and ECP) and printers can communicate in both directions under FreeBSD when a IEEE-1284-compliant cable is used.
Two-way communication to the printer over a parallel port is generally done in one of two ways. The first method uses a custom-built printer driver for FreeBSD that speaks the proprietary language used by the printer. This is common with inkjet printers and can be used for reporting ink levels and other status information. The second method is used when the printer supports PostScript®.
PostScript® jobs are actually programs sent to the printer; they need not produce paper at all and may return results directly to the computer. PostScript® also uses two-way communication to tell the computer about problems, such as errors in the PostScript® program or paper jams. Your users may be appreciative of such information. Furthermore, the best way to do effective accounting with a PostScript® printer requires two-way communication: you ask the printer for its page count (how many pages it has printed in its lifetime), then send the user's job, then ask again for its page count. Subtract the two values and you know how much paper to charge to the user.
To hook up a printer using a parallel interface, connect the Centronics cable between the printer and the computer. The instructions that came with the printer, the computer, or both should give you complete guidance.
Remember which parallel port you used on the computer.
The first parallel port is
to FreeBSD;
the second is ppc1
, and so on. The
printer device name uses the same scheme:
the printer on the first parallel ports etc.
To hook up a printer using a serial interface, connect the proper serial cable between the printer and the computer. The instructions that came with the printer, the computer, or both should give you complete guidance.
If you are unsure what the "proper serial cable" is, you may wish to try one of the following alternatives:
A modem cable connects each pin of the connector on one end of the cable straight through to its corresponding pin of the connector on the other end. This type of cable is also known as a "DTE-to-DCE" cable.
A null-modem cable connects some pins straight through, swaps others (send data to receive data, for example), and shorts some internally in each connector hood. This type of cable is also known as a "DTE-to-DTE" cable.
A serial printer cable, required for some unusual printers, is like the null-modem cable, but sends some signals to their counterparts instead of being internally shorted.
You should also set up the communications parameters
for the printer, usually through front-panel controls or
DIP switches on the printer. Choose the highest
(bits per second, sometimes
baud rate) that both your computer
and the printer can support. Choose 7 or 8 data bits;
none, even, or odd parity; and 1 or 2 stop bits. Also
choose a flow control protocol: either none, or XON/XOFF
(also known as "in-band" or
"software") flow control. Remember these
settings for the software configuration that
This section describes the software setup necessary to print with the LPD spooling system in FreeBSD.
Here is an outline of the steps involved:
Configure your kernel, if necessary, for the port you are using for the printer; section Kernel Configuration tells you what you need to do.
Set the communications mode for the parallel port, if you are using a parallel port; section Setting the Communication Mode for the Parallel Port gives details.
Test if the operating system can send data to the printer. Section Checking Printer Communications gives some suggestions on how to do this.
Set up LPD for the
printer by modifying the file
. You will find out
how to do this later in this chapter.
The operating system kernel is compiled to work with a specific set of devices. The serial or parallel interface for your printer is a part of that set. Therefore, it might be necessary to add support for an additional serial or parallel port if your kernel is not already configured for one.
To find out if the kernel you are currently using supports a serial interface, type:
Where N
is the number of
the serial port, starting from zero. If you see output
similar to the following:
then the kernel supports the port.
To find out if the kernel supports a parallel interface, type:
Where N
is the number of
the parallel port, starting from zero. If you see output
similar to the following:
then the kernel supports the port.
You might have to reconfigure your kernel in order for the operating system to recognize and use the parallel or serial port you are using for the printer.
To add support for a serial port, see the section on kernel configuration. To add support for a parallel port, see that section and the section that follows.
When you are using the parallel interface, you can choose whether FreeBSD should use interrupt-driven or polled communication with the printer. The generic printer device driver (lpt(4)) on FreeBSD uses the ppbus(4) system, which controls the port chipset with the ppc(4) driver.
The interrupt-driven method is the default with the GENERIC kernel. With this method, the operating system uses an IRQ line to determine when the printer is ready for data.
The polled method directs the operating system to repeatedly ask the printer if it is ready for more data. When it responds ready, the kernel sends more data.
The interrupt-driven method is usually somewhat faster but uses up a precious IRQ line. Some newer HP printers are claimed not to work correctly in interrupt mode, apparently due to some (not yet exactly understood) timing problem. These printers need polled mode. You should use whichever one works. Some printers will work in both modes, but are painfully slow in interrupt mode.
You can set the communications mode in two ways: by configuring the kernel or by using the lptcontrol(8) program.
To set the communications mode by configuring the kernel:
Edit your kernel configuration file. Look for
an ppc0
entry. If you are setting up
the second parallel port, use ppc1
instead. Use ppc2
for the third
port, and so on.
If you want interrupt-driven mode, edit the following line:
in the /boot/device.hints
file and replace N
the right IRQ number. The kernel configuration file
must also contain the ppc(4) driver:
If you want polled mode, remove in your
file, the
following line:
In some cases, this is not enough to put the port in polled mode under FreeBSD. Most of time it comes from acpi(4) driver, this latter is able to probe and attach devices, and therefore, control the access mode to the printer port. You should check your acpi(4) configuration to correct this problem.
Save the file. Then configure, build, and install the kernel, then reboot. See kernel configuration for more details.
To set the communications mode with lptcontrol(8):
to set interrupt-driven mode for
to set polled-mode for
You could put these commands in your
file to set the mode each
time your system boots. See lptcontrol(8) for more
Before proceeding to configure the spooling system, you should make sure the operating system can successfully send data to your printer. It is a lot easier to debug printer communication and the spooling system separately.
To test the printer, we will send some text to it. For printers that can immediately print characters sent to them, the program lptest(1) is perfect: it generates all 96 printable ASCII characters in 96 lines.
For a PostScript® (or other language-based) printer, we will need a more sophisticated test. A small PostScript® program, such as the following, will suffice:
The above PostScript® code can be placed into a file and used as shown in the examples appearing in the following sections.
When this document refers to a printer language, it is assuming a language like PostScript®, and not Hewlett Packard's PCL. Although PCL has great functionality, you can intermingle plain text with its escape sequences. PostScript® cannot directly print plain text, and that is the kind of printer language for which we must make special accommodations.
This section tells you how to check if FreeBSD can communicate with a printer connected to a parallel port.
To test a printer on a parallel port:
Become root
Send data to the printer.
If the printer can print plain text, then use lptest(1). Type:
Where N
is the
number of the parallel port, starting from
If the printer understands PostScript® or other printer language, then send a small program to the printer. Type:
Then, line by line, type the program
carefully as you cannot edit
a line once you have pressed
. When you have finished
entering the program, press
, or whatever your
end of file key is.
Alternatively, you can put the program in a file and type:
Where file
is the
name of the file containing the program you want
to send to the printer.
You should see something print. Do not worry if the text does not look right; we will fix such things later.
This section tells you how to check if FreeBSD can communicate with a printer on a serial port.
To test a printer on a serial port:
Become root
Edit the file /etc/remote
Add the following entry:
Where port
is the
device entry for the serial port
, ttyu1
etc.), bps-rate
is the
bits-per-second rate at which the printer
communicates, and parity
is the parity required by the printer (either
, odd
, or
Here is a sample entry for a printer connected via a serial line to the third serial port at 19200 bps with no parity:
Connect to the printer with tip(1). Type:
If this step does not work, edit the file
again and try using
instead of
Send data to the printer.
If the printer can print plain text, then use lptest(1). Type:
If the printer understands PostScript® or
other printer language, then send a small program
to the printer. Type the program, line by line,
very carefully as backspacing
or other editing keys may be significant to the
printer. You may also need to type a special
end-of-file key for the printer so it knows it
received the whole program. For PostScript®
printers, press
Alternatively, you can put the program in a file and type:
Where file
is the
name of the file containing the program. After
tip(1) sends the file, press any required
end-of-file key.
You should see something print. Do not worry if the text does not look right; we will fix that later.
At this point, your printer should be hooked up, your kernel configured to communicate with it (if necessary), and you have been able to send some simple data to the printer. Now, we are ready to configure LPD to control access to your printer.
You configure LPD by editing
the file /etc/printcap
. The
LPD spooling system reads this
file each time the spooler is used, so updates to the
file take immediate effect.
The format of the printcap(5) file is
straightforward. Use your favorite text editor to make
changes to /etc/printcap
. The format
is identical to other capability files like
. For complete information
about the format, see the cgetent(3).
The simple spooler configuration consists of the following steps:
Pick a name (and a few convenient aliases) for the
printer, and put them in the
file; see the
Naming the
Printer section for more information on
Turn off header pages (which are on by default) by
inserting the sh
capability; see the
Header Pages section for more
Make a spooling directory, and specify its location
with the sd
capability; see the Making the Spooling
Directory section for more information.
Set the /dev
entry to use for the printer, and note it in
with the
capability; see the Identifying the Printer
Device for more information. Also, if the
printer is on a serial port, set up the communication
parameters with the ms#
which is discussed in the Configuring Spooler
Communications Parameters section.
Install a plain text input filter; see the Installing the Text Filter section for details.
Test the setup by printing something with the lpr(1) command. More details are available in the Trying It Out and Troubleshooting sections.
Language-based printers, such as PostScript® printers, cannot directly print plain text. The simple setup outlined above and described in the following sections assumes that if you are installing such a printer you will print only files that the printer can understand.
Users often expect that they can print plain text to any of the printers installed on your system. Programs that interface to LPD to do their printing usually make the same assumption. If you are installing such a printer and want to be able to print jobs in the printer language and print plain text jobs, you are strongly urged to add an additional step to the simple setup outlined above: install an automatic plain-text-to-PostScript® (or other printer language) conversion program. The section entitled Accommodating Plain Text Jobs on PostScript® Printers tells how to do this.
The first (easy) step is to pick a name for your printer. It really does not matter whether you choose functional or whimsical names since you can also provide a number of aliases for the printer.
At least one of the printers specified in the
should have the alias
. This is the default printer's
name. If users do not have the PRINTER
environment variable nor specify a printer name on the
command line of any of the LPD
commands, then lp
will be the default
printer they get to use.
Also, it is common practice to make the last alias for a printer be a full description of the printer, including make and model.
Once you have picked a name and some common aliases,
put them in the /etc/printcap
The name of the printer should start in the leftmost
column. Separate each alias with a vertical bar and put
a colon after the last alias.
In the following example, we start with a skeletal
that defines two
printers (a Diablo 630 line printer and a Panasonic
KX-P4455 PostScript® laser printer):
In this example, the first printer is named
and has as aliases
, diablo
, and Diablo 630 Line
. Since it has the alias
, it is also the default printer.
The second is named bamboo
, and has
as aliases ps
, panasonic
, and
Panasonic KX-P4455 PostScript
The LPD spooling system will by default print a header page for each job. The header page contains the user name who requested the job, the host from which the job came, and the name of the job, in nice large letters. Unfortunately, all this extra text gets in the way of debugging the simple printer setup, so we will suppress header pages.
To suppress header pages, add the
capability to the entry for the
printer in /etc/printcap
. Here is
an example /etc/printcap
Note how we used the correct format: the first line starts in the leftmost column, and subsequent lines are indented. Every line in an entry except the last ends in a backslash character.
The next step in the simple spooler setup is to make a spooling directory, a directory where print jobs reside until they are printed, and where a number of other spooler support files live.
Because of the variable nature of spooling
directories, it is customary to put these directories
under /var/spool
It is not necessary to backup the contents of spooling
directories, either. Recreating them is as simple as
running mkdir(1).
It is also customary to make the directory with a name that is identical to the name of the printer, as shown below:
However, if you have a lot of printers on your
network, you might want to put the spooling directories
under a single directory that you reserve just for
printing with LPD. We
will do this for our two example printers
If you are concerned about the privacy of jobs that
users print, you might want to protect the spooling
directory so it is not publicly accessible. Spooling
directories should be owned and be readable, writable,
and searchable by user daemon
group daemon
, and no one else.
We will do this for our example printers:
Finally, you need to tell
LPD about these directories
using the /etc/printcap
file. You
specify the pathname of the spooling directory with the
Note that the name of the printer starts in the first column but all other entries describing the printer should be indented and each line end escaped with a backslash.
If you do not specify a spooling directory with
, the spooling system will use
a default.
In the Hardware
Setup section, we identified the port and the
relevant /dev
directory entry that FreeBSD will use to communicate with
the printer. Now, we tell LPD
that information. When the spooling system has a job to
print, it will open the specified device on behalf of the
filter program (which is responsible for passing data to
the printer).
List the /dev
entry pathname in the /etc/printcap
file usin