It is recommended that to keep FreeBSD systems up to date with the latest application security patches installed via ports collection. The yum command line tool is used to install and update software packages under CentOS / RHEL / Fedora Linux. However, I've tons of apps installed under FreeBSD. How do I upgrade all packages under FreeBSD?
FreeBSD comes with various tools to to install and update software packages. The portmaster command line tool is used to install and update software packages. There are four steps here. Most of the actions listed in this FAQ are written with the assumption that they will be executed by the root user running the csh or bash shell.
Step # 1: Update FreeBSD Ports Tree
Type the following command. Only run this command to initialize your portsnap-maintained ports tree for the first time:
# portsnap fetch extract
Install portmaster to manage your ports without external databases or languages:
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
Step # 2: List All Outdated Packatges FreeBSD Ports Tree
Type the following command:
# pkg_version -l '<'
Sample Output:
apache < libiconv < libxml2 < mod_security < mysql-client < p5-Storable < portmaster < postfix < spawn-fcgi <
Step # 3: Read /usr/ports/UPDATING File
Open /usr/ports/UPDATING file using a text editor and read information regarding your applications. 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 other such incompatibilities with previous versions.
# vi /usr/ports/UPDATING
Step # 4: Upgrade All Packages / Ports / Apps
Type the following command:
# portmaster -Da
Sample Outputs:
===>>> Starting check of installed ports for available updates ===>>> Checking ports for recursive 'make config' ===>>> The devel/libltdl15 port moved to devel/libltdl22 ===>>> Reason: Update to libltdl22 ===>>> Launching child to update libltdl-1.5.26 ===>>> The devel/libltdl15 port moved to devel/libltdl22 ===>>> Reason: Update to libltdl22 ...... ......output terminated... ....
How Do I Repeat These Steps Again?
Simply use the following command sequence (note: portsnap update option):
# portsnap fetch update
# pkg_version -l '<'
# vi /usr/ports/UPDATING
# portmaster -Da
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 6 comments… read them below or add one }
1. portsnap fetch && portsnap update
2. portupgrade -rR *
i use:
portsnap fetch && portsnap update && portaudit -F && portupgrade -aR
all in one go :P
Good post btw, thanks.
Wonderful app portmaster is. :-)
I use it with with -ag switches bcause I have a pkg server :)
portupgrade sux (according to me :)
Can be:
Run as :
portupgrade needs ruby and db. portmaster directly work, it is a small and very fast tool. pkg_version is part of base system. Reading /usr/ports/UPDATING is mandatory.
HTH
Salamo Alikom
how can i update single port ?
it fails for me,it say that “no mirrors remaining,giving up” .
what should I do?