How to Update Ports in FreeBSD


Please shareShare on Facebook0Share on Google+3Tweet about this on Twitter7Share on LinkedIn0Share on Reddit0Digg thisShare on StumbleUpon0Share on VKBuffer this page

Normally we are writing  more  about Linux here at Unixmen. But today, I will give you some tips about the FreeBSD upgrade system and packages.


How to update ports in FreeBSD?


Let me give you some information about my BSD system.

root@:/root # uname -a
FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 amd64

Portsnap is  the best recommendation to upgrade your Ports /usr/ports and extract all new ports on /usr/ports

# portsnap fetch
Looking up mirrors... 6 mirrors found.
Fetching public key from done.
Fetching snapshot tag from done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Sun Apr 14 02:03:58 CEST 2013:
1709e7af6e3a645345b0cad6387bb8cd95e3aa0e90f377100% of   68 MB 2688 kBps 00m00s
Extracting snapshot... done.
Verifying snapshot integrity... 

# portsnap extract

If you already have a populated /usr/ports and you are just updating, run the following command instead:

# portsnap fetch update
Applying patches... done.
Fetching 0 new ports or files... done.
Removing old files and directories... done.
Extracting new files:
Building new INDEX files... done.

Now you can check which ports are outdated:

# pkg_version -v | grep need

mariadb-client-5.3.8                <   needs updating (port has 5.3.12)
root@:/usr/ports/ # 

Next, install portupgrade utility to easily upgrade installed ports:

root@:/usr/ports/ports-mgmt/portupgrade # make install clean
===> Building/installing dialog4ports as it is required for the config dialog
===>  Cleaning for dialog4ports-0.1.3
=> dialog4ports-0.1.3.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch
dialog4ports-0.1.3.tar.gz                     100% of 9743  B   10 kBps
===> Fetching all distfiles required by dialog4ports-0.1.3 for building
===>  Extracting for dialog4ports-0.1.3
=> SHA256 Checksum OK for dialog4ports-0.1.3.tar.gz.

Scan the list of installed ports and fixes:

# pkgdb -F

If you want to upgrade all outdated ports, then run:

# portupgrade -a

If you want to upgrade only certain applications, use portupgrade pkgname. Include the -R flag.

# portupgrade -R apache

After the installation software, now you have to clean up the temporary work directories using the make clean command:

# portsclean -C