How To: Upgrade FreeBSD with CVSup

existenz

Verified User
Joined
Jul 18, 2003
Messages
607
Location
/dev/null
We are going to upgrade our FreeBSD system with the CVSup tutorial. The FreeBSD team unlike Linux develops the Kernel and World. They are separate parts but linked together. Good practice will tell you not to upgrade just the kernel but the entire system.

Let check to see what we are running:

host# uname -a

FreeBSD host.domain.com 5.1-RELEASE-p1 FreeBSD 5.1-RELEASE-p1 #0: Fri Mar 12 16:17:31 EST 2004 [email protected]:/usr/obj/usr/src/sys/GENERIC i386

We are going to assume that you have the ports system installed. Ports is a system that was developed to make it easy to install all types of software. Think of it like the Windows Add/Remove idea with a twist. You can check by going to /usr and looking for a ports folder. If you don't have anything in that folder you can download it here:

host# cd /usr
host# fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz
host# tar -xzf ports.tar.gz

Now we will install cvsup.

host# /usr/ports/net/cvsup make && make install

What we need to do is get a configuration file and make the necessary changes before upgrading the system. We will get the example file and move it to the root level.

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

You will need to edit the stable-cvsup file. Choose a local mirror to download the update. Now 2 problems can exist new code is available around 60 minutes after it has been committed so their are people who download about once a hour to get the latest code. Therefore the highest loads tend to be on the hour and you may have to hold till a server is free or you can switch the option in the file in the server is full. cvsup.freebsd.org tends to be the most busy of the servers for obvious reasons.

host# cd /
host# ee stable-cvsup

Scroll down to you see these lines:

*default host=cvsup.freebsd.org
*default base=/usr
*default prefix=/usr
# The following line is for 4-stable. If you want 3-stable or 2.2-stable,
# change "RELENG_4" to "RELENG_3" or "RELENG_2_2" respectively.
*default release=cvs tag=RELENG_5_2
*default delete use-rel-suffix

For the default host these is where you put the CVSup server closest to you. The other change you will make is for default release. If you are running a FreeBSD 4.x system change this to RELENG_4_9 this will bring you to 4.9. If you are running 5.x then change this to RELENG_5_2 which will bring you to 5.2.1.

Now we will let CVSup download all the updates.

host# /usr/local/bin/cvsup -g -L 2 /stable-cvsup

Now we have downloaded all the updates we will compile and install them. You can follow these steps. If you have built a custom kernel (you probably won't be reading this) it is safest to build the GENERIC for the update then rebuilding for your custom kernel again, there are people who will just rebuild from the sources the custom kernel.

host# /usr/src
host# make -j4 buildworld (a)
host# make -j4 buildkernel (a)
host# make installkernel

(a) This option will allow the system to spawn concurrent builds. 4 is the number of builds and this is about the best for a single processor machine if you have a SMP server try 10.

Reboot your server.

host# /usr/src
host# make installworld
host# mergemaster -ai

Reboot your server

host# uname -a

FreeBSD host.domain.com 5.2.1-RELEASE-p1 FreeBSD 5.2.1-RELEASE-p1 #0: Fri Mar 12 16:17:31 EST 2004 [email protected]:/usr/obj/usr/src/sys/GENERIC i386

Thanks for rhoekman, Xuru for also lending their help with this.
 
Last edited:
host# make -j4 buildworld (a)
host# make -j4 buildkernel (a)
host# make installkernel

(a) This option will allow the system to spawn concurrent builds. 4 is the number of builds and this is about the best for a single processor machine if you have a SMP server try 10.

I have had people ask me about the switch -j4. I will try to clarify that. What it does, is launch multiple make commands at once. Rather than just running one make command you can specifiy as many as you want. The problem is that after so many you can overload the system. It has been suggested that about 4 process are about as much as a single processor can do. In the 10 range is what you can try with a multi-processor box.

If you have a HyperThreading processor or dual core ie P4, Xeon, Opteron check to see if your kernel support SMP and HyperThreading. You can do a quick check of the "top" command. If you see a colume labeled C, that is the processors. A single Xeon will see 0 or 1, a dual 0, 1, 2, 3. If you have more than one you can run it like a dual processor.
 
There is also a cleaner way to install the cvsup application.

Just run the command
pkg_add -r cvsup-without-gui
Then just jump straight to the
cp /usr/share/examples/cvsup/stable-supfile /stable-cvsup Step

:D
 
EDIT : Rewritten on the fourteenth of November of the year two thousand and four.

You can also include ports in your upgrades and use portupgrade to easily update your system.

Add this to the stable-cvsup file:

ports-all tag=.

----
Example with building and upgrading vim:
PHP:
cd /usr/ports/editors/vim
make WITHOUT_X11=yes
make WITHOUT_X11=yes install

We used a special argument, so in order to keep it for the next upgrade, we need to store it somewhere safe.

In /usr/local/etc/pkgtools.conf

Fill in the MAKE_ARGS zone like this :

PHP:
MAKE_ARGS = {
'editors/vim' => 'WITHOUT_X11=YES',
}

Next time you want to upgrade vim, you just do a :

# /usr/local/bin/cvsup -g -L 2 /stable-cvsup
#portupgrade -rR editors/vim -l logfile

(Based on a FreeBSD tutorial written by A. Shih)
 
Last edited:
Thank you very much for that tip Olivier. I always wondered how that could be done. Does this also work for the PHP port?
 
At home it works great to setup Apache/PHP, but it's best to stick with the default conf or be prepared to waste a lot of time understanding how to make every hosting app work together.
 
I updated my earlier post.

Now something else...if you want to check what needs updating before actually doing it.

Right after cvsup gave you your prompt back, do this:

#portsdb -Uu

It takes forever...and then:

#portversion -l "<"

This will give you a list of outdated packages.

You can then manually update each package with :

#portupgrade -rR folder/package -l logfile

or if the list is too long, you can lauch a global upgrade with a pausing system:

#portupgrade -arRi -l logfile

This will ask you what to do for each package.
 
i use FreeBSD 4.10-RELEASE and i'm happy with this kernel... just want to update the ports
does someone know how can i proceed?

thanks
 
portupgrade will help you there. I found this to be a good tutorial:http://www.freebsddiary.org/portupgrade.php
You can also technically do it by adding this to your stable-cvsup file and remove everything else as stated above.
Code:
ports-all tag=.
Doing this should just update /usr/ports but I still think portupgrade will do a better job for you. Just depends on what your looking for. pkg_version will also do some of the same things, except its not so thorough with dependencies of packages your trying to update.
 
Last edited:
Does DirectAdmin have any problems if I was to say update from 4.9 to 4.11?

going to risk it, if things go wrong I might be taking a wee trip :D
 
Last edited:
Geffy said:
Does DirectAdmin have any problems if I was to say update from 4.9 to 4.11?

going to risk it, if things go wrong I might be taking a wee trip :D

You shouldn't have a problem with that upgrade. And most likely should not have any problems upgrading to any new versions of the 4.x line.
 
it went well, except that i couldnt seem to get directadmin to stop restarting while I was building things, oh well no harm done as far as I can tell
 
Back
Top