How To Upgrade Packages In FreeBSD?

How To Upgrade Packages In FreeBSD?

 

This post was last updated on August 1st, 2020 at 12:06 pm

FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution. It is used to power modern servers, desktops, and embedded platforms.

In FreeBSD, there are two ways to install a package: Using pkg and from the ports collection. Over time, newer versions of the software package become available for installation.

This article describes how to upgrade packages to a newer version in FreeBSD.

How to determine the packages available for upgrade

Before you check and start upgrading packages, ensure that the latest version of the ports tree is installed. To upgrade ports tree execute the following command –

portsnap fetch update

To list the outdated packages in FreeBSD 10 and later use –

pkg version -l "<"

In FreeBSD 9.x and prior versions use –

pkg_version -l "<"

How to upgrade packages

There are various ways to upgrade ports or packages, we will discuss here a few of them.

Upgrading ports using portmaster

Portmaster is a utility categorized under ports-mgmt in the ports tree. To use it for upgrading packages first you need to install it in your system. Use the following command to install it –

cd /usr/ports/ports-mgmt/portmaster
make install clean

Portmaster defines four categories of ports –

  • Root port – has no dependencies and is not a dependency of any other port
  • Trunk port –  has no dependencies but other ports depend upon it
  • Branch port – has dependencies and other ports depend upon it
  • Leaf port – has dependencies but no other ports depend upon it

To list all installed ports by category and search for updates use the following command in your terminal –

portmaster -L

Now use the following command to upgrade all the packages –

portmaster -a

Once this command gets executed, it will start upgrading the outdated applications into newer versions meanwhile it can prompt you to select or deselect programs as you can see in the image below. Select or deselect a program using the space button and then press enter for ok.

Use the following command if errors are encountered during the upgrade process, add -f to upgrade and rebuild all the ports.

portmaster -af

Upgrading ports using portupgrade

Portupgrade is another utility that can be used to upgrade ports. It also categorized under ports-mgmt in the ports tree. It depends upon ruby, to start using it first you need to install it in your system. Use the following command to install it –

cd /usr/ports/ports-mgmt/portupgrade
make install clean

Now once this utility gets installed, use the following command to upgrade all the outdated ports –

portupgrade -a

To upgrade a specified application use the following command in your terminal –

portupgrade -R nano

If you use option -P with the above command, portupgrade will first search for available packages locally, if not found locally it will start fetching packages from the remote location.

portupgrade -PP xfce

Conclusion

There are other tools such as synth that can also be used for upgrading outdated packages in FreeBSD.

Ok, that’s all for now. If you have a query on this topic then write it to us in the comments below.

Previous How To Install PyCharm in Ubuntu 20.04 LTS?
Next How To Install And Configure Fish Shell In Ubuntu 20.04 LTS?
 

About author

You might also like

Linux Topics 0 Comments

How To Remove/Uninstall Software Packages From Debian, Ubuntu, Linux Mint?

This post was last updated on August 1st, 2020 at 12:21 pmDifferent Linux distribution comes with different tools to manage software packages on it. Debian and its derivative use the

System Admin 0 Comments

How To Download Docker Images From Docker Hub In Linux?

This post was last updated on August 1st, 2020 at 08:53 amDocker image is an immutable file that is essentially a snapshot of a container. Images are created with build command, and

How To 0 Comments

Using pump in Linux

This post was last updated on June 3rd, 2020 at 04:47 pmPump requests an ip address from a DHCP server. Here are several pump commands for managing dhcp ip addresses.

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply