This is a repost of my old blog wanted to move the post over, since I used to use a lot of FreeBSD in my previous position, and still love the OS wanted to continue posting stuff about it.

In this little tutorial I will teach how to upgrade ports in FreeBSD

  1. Install and use cvsup to sync the ports collection
  2. Create / Copy the supfile and use portsdb to update the database INDEX.db
  3. Use portversion to find which all ports need upgrading
  4. Use portupgrade to upgrade those ports
  5. Use portaudit to find vulnerabilities
  6. Script and add to crontab to auto do things for you


1. First lets install cvsup-without-gui

2. Now that cvsup is installed we need to create/copy the supfiles

Now we need to edit the ports-supfile to get only the ports

Edit the lines

Since my ports are installed on /usr/ports therefore I change base to /usr

For host one can change it to the one that is nearest you. Here is a list of cvsup server

Remember to check if ports-all is listed since you wish to update all the ports

Next use this command to update the ports tree

Now that the port tree is updated, lets update the ports database (the following commands assume you have installed portupgrade form /usr/ports/ports-mgmt/portupgrade)

This creates an INDEX.db btree file on your server

3. Lets try to find out which ports needs upgrading

This will list out which ports need to be upgraded where the < sign means a new port exist.

Might show you something like

4. If we wish to upgrade php5 we would simply type

5. One may also like to install portaudit to check installed packages for known vulnerabilities.

This will list out all the ports that is installed and has vulnerabilities.


So you might want to upgrade that package.

Now that we have done all of this maybe it would be a good idea to actually script all of this into one script and put it in a cron job maybe even email yourself the result everyday (email left for yourself to script )

6. Here is a quick script that we can use.

Add it to crontab