Using ports

This method relies on the Ports Collection, which is the system used to build and install software from source code (it basically consist of a collection of Makefiles arranged hierarchically in a directory structure that allows to fetch, build and install all the available software in FreeBSD)

Initialize the ports tree

To use ports, you have to initialize the ports collection in the server (this is only need to be done once):

# portsnap fetch extract

(The above basically copies the tree structure of the Ports Collection in /usr/ports)

Update the ports tree

This needs to be done from time to time in order to keep the latest updates available:

# portsnap fetch update

Search for a specific application

Go to the root of the Ports Collection
# cd /usr/ports

List the applications matching <app_name>
# make search name=<app_name>

More generic search (this command matches <text> in comments, descriptions, dependencies, etc)
# make search key=<text>

Install an application

1. Determine the port location of the app (the info is in the ‘Path’ field)

# make search name=<app_name>

2. Go to the port location and install

# cd /usr/ports/<origin>/<app_name>
# make install

Reconfigure an application

Use the following if you need to rebuild an app with different configuration options

# cd /usr/ports/<origin>/<app_name>
# make clean
# make config
# make
# make deinstall 
# make reinstall

Uninstall an application

# cd /usr/ports/<origin>/<app_name>
# make deinstall distclean

Updating installed ports

1. Read /usr/ports/UPDATING for any possible issues before updating

2. Install portmaster (if not already installed)

# cd /usr/ports/ports-mgmt/portmaster
# make install

3. List the applications that have available updates

# portmaster -L

4. To update all applications:

# portmaster -a

5. To update a single application using portmaster:

# portmaster <origin>/<app_name>

Contents