The FreeBSD Ports collection is a package management system for FreeBSD which provides an easy way of installing software packages on the FreeBSD operating system.
1. Updating the ports collection
a.) Using CVSup method
This is a quick method of getting and keeping your ports collection up to date using cvsup protocol. Make sure /usr/ports is empty before you run cvsup for the first time.
If you never updated ports collection you have to install cvsup utility:
# pkg_add -r cvsup-without-gui
Update ports collection:
# cvsup -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/ports-supfile
Above step will take some time to fetch the files.
b.) Using portsnap method
Portsnap is an alternative system for distributing the ports collection.
Install portsnap with the following command:
# pkg_add -r portsnap
Download the snapshot of the ports collection with the following command:
# portsnap fetch
If you are running portsnap for the first time, extract the snapshots:
# portsnap extract
If you already have a populated /usr/ports and you are just updating, run the following command instead:
# portsnap update
2. Checking the installed ports for outdated versions
List outdated ports that have a newer version available in the ports collection:
# pkg_version -vl '<'
3. Upgrading installed ports
a.) Upgrading installed ports using portupgrade
The portupgrade utility is designed to easily upgrade installed ports.
Install it like any other port, using the make install clean command:
# cd /usr/ports/ports-mgmt/portupgrade
# make install clean
Scan the list of installed ports with the pkgdb -F command and fix all the inconsistencies it reports. It is a good idea to do this regularly, before every upgrade.
When you run portupgrade -a, portupgrade will begin to upgrade all the outdated ports installed on your system. Use the -i flag if you want to be asked for confirmation of every individual upgrade.
# portupgrade -ai
If you want to upgrade only a certain application, not all available ports, use portupgrade pkg-name. Include the -R flag if portupgrade should first upgrade all the ports required by the given application.
# portupgrade -R firefox
To use packages instead of ports for installation, provide -P flag. With this option portupgrade searches the local directories listed in PKG_PATH, or fetches packages from remote site if it is not found locally. If packages can not be found locally or fetched remotely, portupgrade will use ports. To avoid using ports, specify -PP.
# portupgrade -PP firefox
b.) Upgrading installed ports using portmanager
Portmanager is another utility for easy upgrading the installed ports. It is available from the ports-mgmt/portmanager port:
# cd /usr/ports/ports-mgmt/portmanager
# make install clean
All the installed ports can be upgraded using this simple command:
# portmanager -u
You can add the -ui flag to get asked for confirmation of every step Portmanager will perform. Portmanager can also be used to install new ports on the system. Unlike the usual make install clean command, it will upgrade all the dependencies prior to building and installing the selected port.
# portmanager www/apache22
If there are any problems regarding the dependencies for the selected port, you can use Portmanager to rebuild all of them in the correct order. Once finished, the problematic port will be rebuilt too.
# portmanager lang/php5Print This Post