Sunday, April 29, 2012

FreeBSD Update All Installed Ports / Applications

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

No comments:

Post a Comment