Upgrading FreeBSD - Page 2
If you are sure everything is correct save the file and exit your editor. At this point you should have a cvs-supfile capable of pulling down the sources, ports tree and documentation for FreeBSD which is what you need to update your system. Before proceeding we are going to use a little creativity with the great tools provided to us by FreeBSD and automate this process. Now that you have read your cvs-supfile entirely as I suggested you can create your own shorter file thats easier to work with which I HIGHLY recommend.
First lets backup the original file so if anything goes wrong you have this to refer back to.
# mv /root/cvs-supfile /root/cvs.original
Breaking out your favorite editor again create a new shorter file to look like what I have below and call it cvs-supfile.
*default release=cvs tag=RELENG_6_0
*default delete use-rel-suffix
I know this seems like a long winding road but there is day light at the end of this tunnel. You will be so happy knowing you have applied all security and O/S patches to your system that you have made available to all the mischievous activity on the Internet Below you will find my script that I have created to do what we need in one step. By no means do I consider myself a coder, though this script is safe to use and I use it all the time; now if you know of a better way to accomplish this task by all means share it with the rest of us. I will include it in this document and give you full credit for your work.
In your editor create this file /root/fastestupgrade.sh
if SERVER=`fastest_cvsup -q -c us`; then
cvsup -h $SERVER /root/cvs-supfile
# Now let's update the ports database...
# Now let's see how badly we're out of date...
/usr/local/sbin/portversion -vl "<"
Save the file and exit out of your editor. A little explanation; the above script calls the fastest_cvsup executable and searches for the fastest cvsup servers from your location. It then uses that server to run your cvs-supfile to retreive all of the goodies. Next the script calls portsdb which manages the ports database via the INDEX file. Lastly we call portversion with the -vl switch for verbosity this will list all packages that you have installed and tell you if they are out of date which looks similar to what you see below.
samba-3.0.20,1 < needs updating (port has 3.0.21a,1)
As you can see at the time I did my upgrade samba was out of date it listed what version I have installed and what the newest version is that has been submitted to ports. Unfortunately there will be a separate document on how to deal with updating your applications that have been installed via ports but at least now you have some sort of idea of what apps are out of date.
Ok one last tid bit of info on CVS. For those folks that may be on slow links or running low on disk space or simply want to be considered good net citizens you will want to create yourself a refuse file and put it in your base sup directory. With this file you tell cvs to refuse certain files from the server if not you will pull down everything which is not harmful it just takes up extra disk space. I like to pull down everything that is in reference to the English language this way I am not burdening the cvs server in serving me these additional language files, I do not think I will be reading the translated German documentation for FreeBSD anytime soon so :)
# cd /var/db/
Use your favorite editor to create the refuse file, done this way with VI
# vi refuse
Now if you only want the English language make sure your refuse file looks like such
Now save the file and exit out of your editor. This will refuse all languages for documents and ports EXCEPT for the English language. FreeBSD is constantly growing and getting new translations to different languages all the time so I recommend browsing The FreeBSD Repository to check for any new translations but at the time of this writing the above file would work. I will also do my best to try and keep this document up to date as translations do happen. Because I often will refer back to it from time to time also so it will be in my best interest to maintain it.
It is now time for business. We are ready to start our upgrade process now that all the appropriate files are in place. As root
# uname -a
Make note of the kernel you are currently running you will compare this to the new kernel at the end just for reference.
# cd ~
# sh fastestupgrade.sh
This will take a while but after it is complete lets start our world tour.
# cd /usr/src/
Next we will build world, make our kernel and install our kernel. But we will record this by keeping a log file of everything going on just in case there are errors and if there are you can post your file to the FreeBSD-Stable Mailinglist for help. Though there are some very complex things going on it is not all that difficult, the FreeBSD group has mastered this process and all usually goes without a hitch.
# script ~/buildworld
# make buildworld
You have now built world and captured the process in the /root/buildworld log file. Now cancel the script by hitting cntrl d and you will get an output like below.
Script done, output file is /root/buildworld
Remember we will keep these log files as insurance for each process.
# script ~/buildkernel
# make buildkernel
# cntrl d
Script done, output file is /root/buildkernel
# script ~/installkernel
# make installkernel
# cntrl d
Script done, output file is /root/installkernel