This is going to be a quick lesson on how to update all FreeBSD kernel and packages. FreeBSD comes with two updateable elements, namely the Core OS and the third-party software. The Kernel or the Core OS is updated via FreeBSD-update command, whereas to update third-party software, we’d either need to use the package manager or using the ports system. Both the kernel and the packages are updated quite frequently, so it is advised not to miss out on any one of them to create security risks and reinforce vulnerabilities.
Updating the Core OS in FreeBSD
Run a quick search for updates. Use the command below:
Once the search finishes, type in the following and press enter:
The command above should set any available updates to be installed on the system. If it is a bigger update, you might be prompted to reboot the system to let the changes apply.
Updating FreeBSD software with pkg
Any packages installed via pkg should be updated with the same to avoid issues with the installation.
Check the updates with pkg upgrade first:
Then look up software updates with the pkg command.
Updating FreeBSD software with the Ports system
Like the packages installed with the package manager, those installed with the ports system should be updated with the same. To freeze the pkg on a particular package, use the command syntax below:
To install packages with the ports system, you have two ways:
To use portsnap, type in the command below to update the local iteration of the ports tree:
Once you’re done updating the packages, you’ll be asked if you want to remove the older versions’ backups. These backups shouldn’t be of any use to us if the update were successful.
Wrapping things up
Today, we explained how to update the core OS and software packages in FreeBSD. To update the Core OS, you’d need to use the freebsd-update fetch and install commands, whereas the packages can be updated via either the ports tree or the pkg command. The packages should be updated with the same method they were installed with, as updating a ports tree installed software with pkg can lead to problems with the compilation and can severely offset the software’s code, essentially rendering it broken.