BSD Guides :: Doing Stuff With FreeBSD, NetBSD, OpenBSD, & Mac OS X

Upgrading Ports/Packages
Updated: 10/21/2003


General Information

So, you install stuff from ports and then updates are released.  How do you upgrade your software without having to uninstall and reinstall?  This guide will show you how to use portupgrade.

Requirements

  1. Local root access on the box or be able to su to root.
  2. A SSH client such as puTTy or SecureCRT (if you are setting it up remotely).
  3. Portsnap or cvsup-without-gui
  4. Ports!  If you don't have ports installed, you can install it with /stand/sysinstall

Installation

In order for us to use the upgrade utility, we need to install it first.  So, logon to the machine as root or su to root.
#
#
cd /usr/ports/sysutils/portupgrade
make install clean

Configuration

Now we need to know what packages are out of date and update them.  You can either use the portsnap method or the legacy cvsup method.  I already use portsnap.
# portsnap fetch update
Now that the ports tree is updated, let's see which of our ports are outdated.
# pkg_version
apache                              =
cups-base                           <
cvsup-without-gui                   =
daemontools                         =
lynx                                =
m4                                  =
mod_php4                            <
nano                                =
p5-DBI                              <
p5-Data-ShowTable                   =
p5-Mysql-modules                    =
p5-Net-Daemon                       =
p5-PlRPC                            =
perl                                <
portupgrade                         =
samba                               =
ucspi-tcp                           =
wget                                =
You can also limit the display to only outdated packages with:
# pkg_version -L =
cups-base                           <
mod_php4                            <
p5-DBI                              <
perl                                <
As you can see, there are a few packages that need to be updated.  The format of portupgrade is as follows:
# portupgrade -o /path/to/port port_name
We're going to upgrade cups-base.  So, we will run
# portupgrade -o /usr/ports/print/cups-base cups-base
If you don't know where the port is located at, run:
#
#
cd /usr/ports
whereis port_name
Once it does its thing, you're all updated.  You can run that for each port, or if you are daring, you can upgrade every port with:
# portupgrade -ra


Author: Jon LaBass
jon at bsdguides dot org

Find this guide useful?
Support the author: