Introduction
This document explains how to upgrade a FreeBSD system to another release. We explains one particular way; there are others. You can learn more about them in the FreeBSD Handbook.
CVSup
We will use CVSup to perform the upgrade. Check to see if it is installed in your system by running the following command:
# pkg_info -xI cvsup
If cvsup is available on your system, the above command should produce a line similar to the following:
cvsup-16.1h_2 General network file distribution system optimized for CVS
If you don't have cvsup installed, you'll need to download it and install it. You can do this with the following command:
# pkg_add -r cvsup-without-gui
CVSup Setup
We're now going to setup our CVSup system. FreeBSD comes with many example configuration files in usr/share/examples/. We start by copying the files we need to /etc with the following command:
# cp /usr/share/examples/cvsup/standard-supfile /etc
At this point we edit the following lines in /etc/standard-supfile:
*default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr *default release=cvs tag=RELENG_5_3 *default delete use-rel-suffix
I'm using FreeBSD 5.3 Release and I'll upgrade it to the latest release (FreeBSD 5.4). I just changed the tag flag to RELENG_5_4. Choose the mirror we will download the sources from, *default host=cvsup.FreeBSD.org, check /usr/ports/sysutils/fastest_cvsup ;)
Rebuild World Setup
The make.conf configuration file allows you to override macro definitions of make without changing anything within the source tree. make.conf is located in /etc. If you don't have it, copy it from /usr/share/examples/etc/ to your /etc directory.
Now its time to edit it:
# vi /etc/make.conf
Find the lines:
#SUP_UPDATE= yes # #SUP= /usr/local/bin/cvsup #SUPFLAGS= -g -L 2 #SUPHOST= cvsup.uk.FreeBSD.org #SUPFILE= /usr/share/examples/cvsup/stable-supfile #PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile #DOCSUPFILE= /usr/share/examples/cvsup/doc-supfile
Uncomment these lines:
SUP_UPDATE= yes # SUP= /usr/local/bin/cvsup SUPFLAGS= -g -L 2 SUPHOST= cvsup2.at.freebsd.org SUPFILE= /etc/standard-supfile PORTSSUPFILE= /etc/ports-supfile
Change SUPHOST to point to a faster cvsup mirror. An example file of ports-supfile can be found on /usr/share/examples/cvsup/. Try to edit it and add KERNCONF:
KERNCONF= YGGDRASIL
This is your Kernel Config File Name, check this link to build your own kernel :)
Upgrading
First, to update your system sources, go to /usr/src and run make update.
# cd /usr/src # make update
Now its time to buildworld. Follow the following steps (remember that you are on /usr/src)
# make buildworld # make buildkernel # make installkernel
Let's explain what these commands will do. First, all your new sources get compiled, after that you build the new kernel with your personal configuration file (Do you remember KERNCONF?) and install it. now it's time to run your system in single user mode, for security reasons of course, you can reboot and choose the option 4 on the boot menu to boot the system in single user mode. You can deal with some things if you choose this way, but why waste time? ;) run now:
# shutdown now
It put you on single user mode. Run cd /usr/src again and continue with this:
# mergemaster -p # make installworld # mergemaster # reboot
The mergemaster command is used to merge configuration files, man mergemaster, -p it's for pre-buildworld mode, next you will install your new world, run again mergemaster to update the new config files, finally you can reboot your system. Try to make a backup of your running system first of course, machines are not perfect :\
Conclusion
Well, FreeBSD is a great system and upgrading it is not too hard, this HOWTO can prove it LOL!. Try a uname -a and look at what you got ;)
FreeBSD Yggdrasil.Delictum.us 5.4-RELEASE-p1 FreeBSD 5.4-RELEASE-p1 #1: Tue May 24 16:35:07 COT 2005 root@Yggdrasil.Delictum.us:/usr/obj/usr/src/sys/YGGDRASIL i386
Last update: 2005-05-30 (Rev 2695)