≡ Menu

How To Upgrade FreeBSD To New Release

Q. I've custom compile kernel and I'd like to upgrade my system to latest stable release. How do I upgrade FreeBSD to new release without using freebsd-update binary tool?

A. If you have custom kernel installed freebsd-update will not work. The procedure for doing a source code based update is described below.

Step # 1: Grab latest source code

You need to use csup, which is a software package for updating collections of files across a network. First, copy config a file to /root, type:
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile
Open /root/supfile, type:
# vi /root/supfile
Find the line that read as follows:
host=CHANGE_THIS.FreeBSD.org
Change to (you can find cvsup mirror list here) :
host=cvsup4.us.FreeBSD.org
Make sure tag is set to tag=RELENG_7_1 (for latest FreeBSD 7.1 release)
*default release=cvs tag=RELENG_7_1
Here is my sample /root/supfile file:

*default host=cvsup4.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_7_1
*default delete use-rel-suffix
*default compress

To grab update, enter:
# cvsup /root/supfile

Step #2: 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
Once you are aware of all issues, first build base system, enter:
# cd /usr/src
# make buildworld

Step #3: Build the FreeBSD kernel

Next, build and install the FreeBSD kernel using the following syntax:
# make buildkernel
# make installkernel

To build and install custom kernel named foo, enter:
# make buildkernel KERNCONF=foo
# make installkernel KERNCONF=foo

Finally, reboot the server, enter:
# reboot

Boot into a single user mode

You need to boot FreeBSD into a single user mode type boot -s at the loader prompt:
boot -s
Mount file system and run mergemaster, enter:
# mount -a -t ufs
# mergemaster -p

Accept the changes as promoted as per your configuration.

Step # 4: Install base system and libraries

Type the following command, enter:
# 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

Verify everything is working

See system log files and make sure everything is working properly, enter:
# uname -a
# tail -f /var/log/messages
# tail -f /path/to/other/log/files
# sockstat

Step # 5: Update FreeBSD Applications

Finally, update all installed applications such as Apache, postfix and others, enter:
# portsnap fetch update
To upgrade all installed FreeBSD ports / applications, enter:
# portversion -l '<' # portupgrade -a

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 4 comments… add one }

  • Roland January 16, 2009, 10:32 pm

    You might wanna call that second #2 as it is supposed to: #3 and fix kernel:
    Step #2: Build the FreeBSD kerenl
    I noticed that when I added it to my kb, author is still mentioned tho ;)

    Thanks, this helped me out bigtime !

  • nixCraft January 16, 2009, 11:21 pm

    Thanks for the heads up. The FAQ has been updated.

  • Johan Kuuse April 13, 2009, 3:48 pm

    A note on cvsup and csup:
    As indicated at

    http://www.freebsd.org/doc/en/books/handbook/cvsup.html

    csup is now the default command for updating source trees on FreeBSD.
    So to grab the update, change
    cvsup /root/supfile
    to
    csup /root/supfile
    (or install /usr/ports/net/cvsup)

    Regards,
    Johan

  • mahmud March 10, 2011, 2:04 pm

    thanks very much, good tutor
    it’s very very help me

Leave a Comment