FreeBSD cvsup: Update The FreeBSD From Previous Releases Using Source Code

Q. How do I update my system using cvsup mirror? How do I upgrade from previous releases using FreeBSD 6.x or 7.x? How do I upgrade everything including kernel, userland utilities, and installed applications?

A. FreeBSD can be upgrades from a local / remote cvsup mirror. csup is a software package for updating collections of files across a network. It is a general-purpose network file updating package. It is extremely fast, even for collections of files.

Upgrading FreeBSD

You need to upgrade FreeBSD using two steps as follows:

  1. First, upgrade the base system
  2. Update all installed application programs or ports.

Naturally, the base system must be upgraded before the applications.

WARNING! These examples only works with FreeBSD 6.2 or above version only. Make a backup of your system / data / config files before you use following commands. The system will be offline for about 10-30 minutes due to reboot and single user mode upgrade operations, so update system during off-peak hours.

Step # 1: Upgrading the FreeBSD base system

First, copy csup configuration file to /etc or /root directory:
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile
Open /root/supfile using vi text editor, enter:
# vi /root/supfile
You need to make one change. Find the line that read as follows:
Change to:
host directive specifies the server host which will supply the file updates. You must change it to one of the CVSup mirror sites listed in the FreeBSD Handbook. Another option is to override this setting on the command line with cvsup’s “-h host” option. Save and close the file. Now update source tree, enter:
# cd /usr/src
# csup /root/supfile

Build the base system

Once you have synchronized your local source tree, you can then use the source tree to rebuild the base system. It is important that you always read /usr/src/UPDATING file to save time. This file carries important information regarding upgrade procedure including known issues, bugs and workaround.
# vi /usr/src/UPDATING
Type the following command to build base system:
# cd /usr/src
# make buildworld

This procedure going to take sometime as everything is going to compiled from scratch. Powerful system with tons of memory can build everything within 10-15 minutes time. Once done build the FreeBSD kernel:using following syntax:
# make buildkernel
# make installkernel

# make buildkernel KERNCONF={NAME}
For example, build and install GENERIC kernel, enter:
# make buildkernel KERNCONF=GENERIC
# make installkernel KERNCONF=GENERIC

Again depending on the capabilities of your machine and kernel configuration, it will take anywhere from 5-30 minutes to build kernel. Finally, you need to reboot system and boot into a single user mode using boot -s from the loader prompt:
# reboot

Install the base system

Now you need to use the mergemaster bourne shell script, which is designed to aid you in updating the various configuration and other files associated with FreeBSD. It is HIGHLY recommended that you back up your /etc directory. Mount the system:
# mount -a -t ufs
To install some system configuration files that are required by the new base system, enter:
# mergemaster -p
Accept the changes as promoted as per your configuration. Finally, install the base system:
# cd /usr/src
# make installworld

Finally, merge your configuration files, enter:
# mergemaster -i
You are now done with first stage, just reboot the system:
# reboot

Step # 2: Update FreeBSD Applications

Now you are running new FreeBSD environment. All you have to do is upgrade installed applications using portsnap, enter:
# portsnap fetch extract
To upgrade all installed FreeBSD ports / apps, enter:
# portversion
# portupgrade -a

You are now done with upgrading system. Now you have up to date patched kernel, base system and applications.

Further readings:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts