How to Upgrade FreeBSD 14.0 from FreeBSD 13.0

Updated on October 11, 2024
How to Upgrade FreeBSD 14.0 from FreeBSD 13.0 header image

Introduction

FreeBSD is an open-source Unix-like operating system known for its reliability and performance. FreeBSD 14 introduces modern features, the latest applications, and enhanced security. With each release, you can upgrade FreeBSD 14 to benefit from improvements, including an upgraded pkg package manager for easy application installation and management.

This article explains how to upgrade FreeBSD 14.0 from FreeBSD 13.0 to benefit from the latest improvements, performance, and security upgrades.

Prerequisites

Before you begin:

Test the Compatibility of Installed Applications

Before upgrading your server to FreeBSD 14, test the compatibility of all installed applications to avoid any post-upgrade errors. Follow the recommendations below to test the compatibility of installed applications with FreeBSD 14 and verify that your server is ready for the upgrade.

  • Visit the FreeBSD release notes and verify any known vulnerabilities or unsupported packages.

  • Visit each application's documentation and verify it supports FreeBSD 14.0 to avoid post-upgrade runtime errors.

  • Stop any non-essential services to prevent upgrade interruptions.

  • Run the following df -h command and verify that your server has at least 2GB of free space to store the upgrade files.

    console
    $ df -h
    

    Output:

    Filesystem         Size    Used   Avail Capacity  Mounted on
    /dev/ufs/rootfs     53G    3.6G     45G     7%    /
    devfs              1.0K      0B    1.0K     0%    /dev

Upgrade FreeBSD 14.0 from FreeBSD 13.0

Follow the steps below to upgrade the FreeBSD 13 server to FreeBSD 14.

  1. Check the FreeBSD version on your server and verify that its FreeBSD 13.

    console
    $ freebsd-version
    

    Output:

    13.4-RELEASE
  2. Update the server's package information index.

    console
    $ sudo pkg update
    

    Output:

    Updating FreeBSD repository catalogue...
    FreeBSD repository is up to date.
  3. Install a sample application to test the upgrade process. For example, install the Nginx webserver package.

    console
    $ sudo pkg install nginx
    

    Output:

    The following 2 package(s) will be affected (of 0 checked):
    
    New packages to be INSTALLED:
     nginx: 1.26.1,3
     pcre2: 10.43
  4. Enable Nginx to automatically start at boot.

    console
    $ sudo sysrc nginx_enable="YES"
    

    Output:

    nginx_enable:  -> YES
  5. Start the Nginx service.

    console
    $ sudo service nginx start
    

    Output:

    Performing sanity check on nginx configuration:
    nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
  6. Fetch the latest FreeBSD 14.0 upgrade information.

    console
    $ sudo freebsd-update -r 14.0-RELEASE upgrade
    

    Output:

    Looking up update.FreeBSD.org mirrors... 3 mirrors found.
    Fetching metadata signature for 13.3-RELEASE from update1.freebsd.org... done.
    Fetching metadata index... done.
    Fetching 1 metadata patches. done.
    Applying metadata patches... done.
    Fetching 1 metadata files... done.
    Inspecting system... done.
    ..............

    You will receive multiple prompts similar to the ones below. Press Enter to edit each target file using the default vi editor.

    The following file could not be merged automatically: /etc/hosts
    Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
    manually...

    Enter :wq to save and close the file. Then, enter ACCEPT when prompted to apply the changes.

    Press Enter to return to editing this file, or type "ACCEPT" to carry on with
    these lines remaining in the file.
  7. Install the FreeBSD 14.0 updates information.

    console
    $ sudo freebsd-update install
    

    Output:

    Installing updates...
    Kernel updates have been installed.  Please reboot and run
    "/usr/sbin/freebsd-update install" again to finish installing updates.
  8. Reboot the server to apply the FreeBSD 14.0 changes.

    console
    $ sudo reboot
    
  9. Access the server again using SSH as a non-root user with sudo privileges.

    console
    $ ssh root@SERVER-IP
    
  10. Install the FreeBSD 14.0 update files again to upgrade the server.

    console
    $ sudo freebsd-update install
    

    Output:

    Installing updates...
    Restarting sshd after upgrade
    Performing sanity check on sshd configuration.
    Stopping sshd.
    Waiting for PIDS: 882.
    Performing sanity check on sshd configuration.
    Starting sshd.
    Scanning /usr/share/certs/untrusted for certificates...
    Scanning /usr/share/certs/trusted for certificates...
    Scanning /usr/local/share/certs for certificates...
        ...
  11. Check the FreeBSD version on your server and verify that it's FreeBSD 14.0.

    console
    $ freebsd-version
    

    Output:

    14.0-RELEASE-p10
  12. Re-install the pkg package manager with FreeBSD 14.0 information.

    console
    $ sudo pkg-static install -f pkg
    
  13. Rebuild all ports and packages with the latest FreeBSD 14.0 information.

    console
    $ pkg upgrade -f
    

    Managing applications efficiently on FreeBSD is made easy with the FreeBSD package manager.

Test the Upgraded FreeBSD 14 Server

Follow the steps below to test your upgraded FreeBSD 14.0 server and verify that the sample Nginx webserver application you installed earlier runs correctly.

  1. View all storage partitions on the server and verify that no unusual disk usage or paths exist.

    console
    $ df -h
    

    Output:

    Filesystem         Size    Used   Avail Capacity  Mounted on
    /dev/ufs/rootfs     48G    3.6G     41G     8%    /
    devfs              1.0K      0B    1.0K     0%    /dev
  2. View all running services on the server.

    console
    $ sudo service -l
    

    Output:

    DAEMON
    FILESYSTEMS
    LOGIN
    NETWORKING
    SERVERS
    accounting
    adjkerntz
    apm
    ....
  3. Test network connectivity and DNS propagation to a common site such as google.com using the Ping utility.

    console
    $ ping -c 4 google.com
    

    Output:

    PING6(56=40+8+8 bytes) 2002:18f0:7402:275:5300:5ff:fe29:ac68 --> 2a00:1250:4009:81d::200e
    16 bytes from 2a00:1550:4009:81d::200e, icmp_seq=0 hlim=118 time=0.710 ms
    16 bytes from 2a00:1550:4009:81d::200e, icmp_seq=1 hlim=118 time=0.588 ms
    16 bytes from 2a00:1550:4009:81d::200e, icmp_seq=2 hlim=118 time=0.632 ms
    16 bytes from 2a00:1550:4009:81d::200e, icmp_seq=3 hlim=118 time=0.623 ms
  4. View the system logs to check any system errors or warnings associated with the upgrade.

    console
    $ sudo tail -n 50 /var/log/messages
    

    Output:

    Sep 12 16:01:05 vultr ntpd[813]: switching logging to file /var/log/ntp.log
    Sep 12 16:10:07 vultr pkg[32138]: indexinfo reinstalled: 0.3.1 -> 0.3.1 
    Sep 12 16:10:07 vultr pkg[32138]: mpdecimal reinstalled: 4.0.0 -> 4.0.0 
    Sep 12 16:10:07 vultr pkg[32138]: libffi reinstalled: 3.4.6 -> 3.4.6 
    Sep 12 16:10:07 vultr pkg[32138]: readline reinstalled: 8.2.10 -> 8.2.10 
  5. Restart the Nginx service and view its status to verify it's running.

    console
    $ sudo service nginx restart &&  sudo service nginx status
    
  6. Access your server's public IP address using a web browser such as Chrome and verify that the default Nginx page displays.

    http://SERVER-IP

    Test the FreeBSD Nginx Webserver Application

    Access other applications installed on your FreeBSD server and verify that they run correctly without any errors.

Conclusion

You have successfully upgraded your server from FreeBSD 13 to FreeBSD 14 and tested access to the installed applications. FreeBSD 14.0 offers newer packages and security enhancements, improving server reliability and performance. For more details on how to upgrade FreeBSD, visit the FreeBSD Documentation.