Makefiles
, patches, and description files. Each set of these files is used to compile and install an individual application on FreeBSD, and is called a port.- 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.
- How to Install FreeBSD? FreeBSD is like a UNIX based operating system which can be installed on any new operating servers, laptops, desktops and embedded systems. It is a free operating system which is a direct descendant of BSD Unix. The first version of BSD was launched in 1993 and today it is among the top operating systems used widely.
- Jan 26, 2017 H ow do I install ports in FreeBSD operating systems using the command line options? The FreeBSD operating systems offers Ports Collection as a simple way to install various applications. Each port contains any patches necessary to make the original application source code compile and run on FreeBSD based system.
/usr/ports
.- To download a compressed snapshot of the Ports Collection into
/var/db/portsnap
: - When running Portsnap for the first time, extract the snapshot into
/usr/ports
: - After the first use of Portsnap has been completed as shown above,
/usr/ports
can be updated as needed by running:When usingfetch
, theextract
or theupdate
operation may be run consecutively, like so:
- 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 pkg is being used to manage packages, Subversion can be installed as a package:
- Check out a copy of the ports tree:
- As needed, update
/usr/ports
after the initial Subversion checkout:
Makefile
: contains statements that specify how the application should be compiled and where its components should be installed.distinfo
: contains the names and checksums of the files that must be downloaded to build the port.files/
: 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.pkg-descr
: provides a more detailed description of the program.pkg-plist
: a list of all the files that will be installed by the port. It also tells the ports system which files to remove upon deinstallation.
pkg-message
or other files to handle special situations. For more details on these files, and on ports in general, refer to the FreeBSD Porter's Handbook.distfile
. The extract portion of building a port will automatically save the downloaded source to /usr/ports/distfiles
.make
targets and environment variables is available in ports(7).Warning:
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 https://vuxml.freebsd.org/ for known security issues related to the port. Alternately, run pkg audit -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 pkg-audit(8) and periodic(8).
make install
at the prompt. Messages will indicate the progress: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.PATH
environment variable, to speed up lookup operations for the executable file of these commands. Users of the tcsh
shell should type rehash
so that a newly installed command can be used without specifying its full path. Use hash -r
instead for the sh
shell. Refer to the documentation for the shell for more information.Freebsd Install Ports Without Prompt
Note:
To save this extra step, instead use make install clean
when compiling the port.
make config-recursive
within the port skeleton. Then, run make install [clean]
to compile and install the port.Tip:
When using config-recursive
, the list of ports to configure are gathered by the all-depends-list
target. It is recommended to run make config-recursive
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.
cd
into the directory containing the port and type make config
. Another option is to use make showconfig
. Another option is to execute make rmconfig
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).FTP_PASSIVE_MODE
, FTP_PROXY
, 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.make fetch
can be run within /usr/ports
, to fetch all distfiles, or within a category, such as /usr/ports/net
, 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 fetch-recursive
to also fetch the distfiles for all the dependencies of a port.MASTER_SITES
variable can be used to override the download locations specified in the Makefile
. When using, specify the alternate location:WRKDIRPREFIX
and PREFIX
variables can override the default working and target directories. For example:/usr/home/example/ports
and install everything under /usr/local
./usr/ports
and install it in /usr/home/example/local
. And:pkg delete
. Examples for using this command can be found in the pkg-delete(8) manual page.make deinstall
can be run in the port's directory:Portmaster Freebsd
X
and lower, the following command will list the installed ports that are out of date:Important:
Before attempting an upgrade, read /usr/ports/UPDATING
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.
Note:
The choice of which tool is best for a particular system is up to the system administrator. It is recommended practice to back up your data before using any of these tools.
- 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.
Note:
By default, Portmaster makes a backup package before deleting the existing port. If the installation of the new version is successful, Portmaster deletes the backup. Using -b
instructs Portmaster not to automatically delete the backup. Adding -i
starts 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.
-f
to upgrade and rebuild all ports:pkg-descr
.pkgdb -F
and to fix all the inconsistencies it reports.portupgrade -a
. Alternately, include -i
to be asked for confirmation of every individual upgrade:portupgrade pkgname
. It is very important to include -R
to first upgrade all the ports required by the given application:-P
is included, Portupgrade searches for available packages in the local directories listed in PKG_PATH
. 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:-P
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
.pkg-descr
.make clean
within the ports skeleton will clean up the temporary work
directory. If Portmaster is used to install a port, it will automatically remove this directory unless -K
is specified. If Portupgrade is installed, this command will remove all work
directories found within the local copy of the Ports Collection:/usr/ports/distfiles
over time. To use Portupgrade to delete all the distfiles that are no longer referenced by any ports: