The very first thing we want to do is find out what version we are using. Run the following command:


# uname -a

And it should print out something on the next line. I am going to use this example to upgrade FreeBSD from 10.3 to 11.2

FreeBSD mail.domain.xxx 10.3-STABLE FreeBSD Fri Jul 13 25 00:53:24 CDT 2015 wolson@mail.domain.xxx:/usr/obj/usr/src/sys/GENERIC i386

There are a few things to note. The date after that indicates when the last build took place. Rather old system so we need to update it to 11.2 so lets get started!

We need to tell FreeBSD to download the latest sources for FreeBSD 11.2. Lets get rid of the current sources:


# cd /usr/src
# rm -dfr *

We need to make sure your ports are updated first then we need to sync sources so run the following:


# portsnap fetch && portsnap update

Now we need to checkout sources using the following command.


# cd /usr/src
# svnlite checkout https://svn.FreeBSD.org/base/stable/11 /usr/src

Please DO NOT continue until sources and ports and have synchronized.

Lets backup etc first:


# rm -dfr /backup/ (If this directory does not exist then please ignore this step)
# mkdir /backup/etc
# cp -Rp /etc/* /backup/etc

You will now need to tell your stable-supfile to use the RELENG_11 tree. The stable-file example file is located at:


# /usr/share/examples/cvsup/stable-supfile

It may be a good idea to look through /usr/ports/UPDATING so take a look:


# vi /usr/ports/UPDATING

Now to remove the old obj files.


# chflags -R noschg /usr/obj/*
# rm -fr /usr/obj/*

Now to build the world.This guide is meant to help you streamline the process of building and installing world. You can find a more direct resource located at

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html

If you have a multi-core processor, or multi-processor system, you can run the following command. Replace the X in the next command for the number of cores you have in your system. So if you have a quad core CPU you would replace the X with a 5:


# cd /usr/src
# make -jX buildworld

Otherwise run the following command:


# cd /usr/src
# make buildworld

And then build and install the kernel


# cd /usr/src
# make buildkernel KERNCONF=GENERIC
# cd /usr/src
# make installkernel KERNCONF=GENERIC

Booting into single-user mode
Reboot with your new kernel into single-user mode


# reboot

When your computer reboots, It will bring you to a menu of options. Choose Single-User mode and hit Enter.
Hit [Enter] to boot immediately, or any other key for command prompt.

Booting [kernel] in 9 seconds...

Hit any other key other than [ENTER] to enter single-user mode.

It asks for the location of the shell to be used

choose /bin/sh (just press Enter or Return as this is the default)

Now we need to mount the filesystems


# adjkerntz -i
# mount -a -t ufs

Now to Install world


# cd /usr/src
# mergemaster -p

This does some initial configuration file updates in preparation for the new world. For instance it may add new user groups to the system, or new user names to the password database. This is often necessary when new groups or special system-user accounts have been added since the last update, so that the installworld step will be able to use the newly installed system user or system group names without problems.

At the end you will get prompted Do you wish to delete what is left of /var/tmp/temproot? [no]. Hit Enter for No. It will spit out an output. Continue on.


# make installworld

Now to update /etc


# /usr/sbin/mergemaster

Update /stand


# cd /usr/src/release
# make all install

Reboot and enjoy your new -STABLE system


# fastboot

To summarize, the currently recommended way of upgrading FreeBSD from sources is:

# cd /usr/src
# make buildworld
# make buildkernel
# make installkernel
# shutdown -r now

Note: There are a few rare cases when an extra run of mergemaster -p is needed before the buildworld step. These are described in UPDATING. In general, though, you can safely omit this step if you are not updating across one or more major FreeBSD versions.

After installkernel finishes successfully, you should boot in single user mode (i.e. using boot -s from the loader prompt). Then run:

# adjkerntz -i
# mount -a -t ufs
# mergemaster -p
# cd /usr/src
# make installworld
# mergemaster
# reboot

Read Further Explanations: The sequence described above is only a short resume to help you getting started. You should however read the following sections to clearly understand each step, especially if you want to use a custom kernel configuration.