I am always writing this down on a sheet of paper that always seems to disappear when it is time to update my servers. This is a note to myself that I can always find or at least that is the expectation.

This is the sequence of steps outlined in the FreeBSD Handbook. It is a pretty bare framework but if followed, should work everytime.

   # make buildworld
   # make buildkernel
   # make installkernel
   # reboot
   # mergemaster -p
   # make installworld
   # mergemaster
   # reboot


This assumes you are doing this for the very first time. After the install you create the directory /usr/local/etc/cvsup as the location for the files used when running csup. This is the default location for csup which we learned from the information in the man page (you checked the man page, didn't you?). To run CSup you need configuration files so we copy the sample files into the working directory for CVSup. By the way, this does all assume that you are root.

 # mkdir /usr/local/etc/cvsup
 # cd /usr/local/etc/cvsup
 # cp /usr/share/examples/cvsup/stable-supfile ./
 # cp /usr/share/examples/cvsup/ports-supfile  ./

Change this entry in both files to choose the server to update from

 *default host=cvsup??

Having done this you can then begin to get the latest version of the files.

 # cd /usr/local/etc/cvsup
 # csup -g -L 2 stable-supfile
 # csup -g -L 2 ports-supfile     *** SEE BELOW *** 

Read /usr/src/UPDATING to see if any special handling is required for this update.

The next step for stable is to compile the source to create executables and other support files but before doing this there is an opportunity to change the settings used by the compiler.

 CPUTYPE= CPU type here - see file comments for choices
 CFLAGS= -O -pipe
 COPTFLAGS= -O -pipe

This might be overkill, especially the first time, but after you have done this once there are files that remain from the last go around. Sometimes they can have an unpredictable affect on the procedure, so it is best to clean up. If you did not clean up and have problems with the resulting kernel of userland this would be something to try to fix the problems.

 # cd /usr/obj
 # chflags -R noschg *
 # rm -rf *
 # cd /usr/src
 # make clean
 # make clean

 # make -j 4 buildworld  
 # make buildkernel KERNCONF=GENERIC
 # make installkernel KERNCONF=GENERIC

 # shutdown now
 # cd /usr/src
 # mergemaster -p
 # make installworld
 # mergemaster -iU  
        -i  automatically installs the file if it does not already exist
            in the destination directory
        -U  attempt to auto upgrade a file that has not been modified by user
	These two options will save you from having to answer unnecessary
        prompts during mergemaster and only have to deal with the files
        that you have changed.

	Mergemaster makes a copy of the relevant files from the new build
        and places them in a directory structure off of /var/tmp/tmproot.  
        It will compare these to the files that exist on your system and 
        if differences are found you are asked how to deal with them.
        You want to install as many new versions of the files as you can
        without losing the changes that you have made to them.

	Once you are comparing files

        d - leave file unchanged
        i - install new version of file
        m - merge

        - old version 
        + new version 

If you are prompted to install new version of /dev/MAKEDEV allow mergemaster to run it for you.

 # reboot

You can also remove old directories, files and libraries by running the following commands after a rebuild.

 # cd /usr/src
 # make check-old
 # make delete-old

Custom Kernel

To create a custom kernel create a new kernel config file that will be edited to incorporate the changes you want. A custom kernel can add or remove functionality and improve performance by taking advantage of code tuning for specific CPU chip sets. Removing unneeded drivers and capabilites will result in a smaller kernel which will have a smaller memory footprint and free up memory for other uses.

  cd /usr/sys/i386/conf
  cp GENERIC customkernel

  modify the file

  cd /usr/src
  make buildkernel KERNCONF=customkernel
  make installkernel KERNCONF=customkernel


When I first wrote this, the CVS/CVSup program was used to update both the source and the ports. It has been this way for a long time but change was sure to come. And now it has finally arrived. Port updates using CVS/CVSup are being replaced with the PORTSNAP program. I read a posting on dated 12.SEPT.2012 that beginning 13.FEB.2013 the Ports tree would no longer be available using CVS/CVSup. FreeBSD is changing. :)

# portsnap fetch

# portsnap extract 
# portsnap update

Extract will completely replace the port tree.  It is suggested that this be run
the first time you use portsnap.  After that, the use of update is recommended.
If you add your own patches then use update or extract will overwrite them.  If
you do not then I do not see any problems with using extract.

/usr/ports                  location of ports tree
/etc/portsnap.conf          config file

Location of some ports:
    openvpn           - in security
    smartmontools     - in sysutils
    cvsup-without-gui - in net