KrUsTy!
January 2nd, 2003, 14:52
Well, after a dressing down from MiNiOn, I figure I had better get this done. :D
Thanks for the motivation! :oops:
Keeping up with new version of ports/packages can be almost impossible. Doing this manually can mean ending up with a pretty messy installs of various ports and even different versions of the same thing!
portupgrade makes updating your installed ports a breeze! I have put this into 2 sections, first make sure your ports tree is updated, and then the portupgrade program for updating installed ports. If you already track the ports tree via CVS, skip this first part.
1. CVS - keeping your ports tree up-to-date
You will need to keep your ports tree updated to the latest versions of all the ports. Using CVS is an easy way to do this. For those of who have not had much or any experince with CVS, there is an great port to get you started. Its called "cvsupit". This will installed all the things you need for CVS and will setup up your CVS
You need to have a ports tree. If you don't, download the lastest ports tree, and install it.
ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/
get ports.tar.gz
tar xzf ports.tar.gz in /usr
Now that you have a ports tree, you need to keep it up-to date, which is where CVS comes in. So to install the "cvsupit" por which gets this all setup for you;
cd /usr/ports/net/cvsupit
make install clean
This will load everything you need, and when done, will go into a menu which will walk you through the setup of CVS. The first page asks about tracking the main OS source. You can it you want to, but for this you don't need that.
Skip the FreeBSD Source updating choose "none - Skip the updating of /usr/src/"
The next menu asks "Would you like to track the FreeBSD ports collection?". Answer "YES".
The next menu asks "Would you like to track the FreeBSD doc sources? You can answer "NO" to skip this.
Then it asks "Base directory for src, ports and docs subdirs?" You should leave it as /usr.
Then it will ask you to choose a CVS server. Choose which one is good for you.
Once your sever is chosen, it will ask "Do you wish to run the CVSup update now?" Hey, might as well, no time like the present!
If you choose "yes" then it will ask about compression, choose whatever suits you. You will then get a verbose panel of the CVS updating your ports collection. Once done it will give you the command to use to update the ports whenever you like. You can put this in a CRON or the Daily script, or you can just make it into a small shell script to run whenever you want to.
So now your ports tree is updated. Now onto the really cool stuff!
2. Portupgrade - updating your installed ports and packages.
You will need to install the portupgrade program.
cd /usr/ports/sysutils/portupgrade
make install clean
Then to take a look a what needs updating you can run;
pkg_version -v
which gives you a pkg_info with a comparison of your ports tree and installed packages and tell you which ones need to be updated. To upgrade a port, say for example an "unzip-5.50" installed port,
portupgrade -r unzip-5.50
It will then use the ports to build and reinstall that port, and any of its depencies (-R). Even better is just having portupgrade bring your entire installed packages and ports up to date;
portupgrade -ra
This will go through all ports/packages that need updating and update them! Cool! Although you may want to make sure you have the time, cause some building of ports, say KDE, can take quite a long time. To avoid getting too far behind I usually take a look about once a week and make sure that my installed ports are current, and if not I bring them up to date via portupgrade.
Sometimes portupgrade will have trouble with a dependecy in a particualr port. It will ask you to fix this by running pkgdb -F, which basically rebuilds your installed ports/packages database. It is interactive and you should just answer its questions as best you can.
For a much more in depth discussion of portupgrade and its various parts, take a look at this article, from which much of my little how to is based;
http://www.onlamp.com/pub/a/bsd/2001/11/29/Big_Scary_Daemons.html
A very good article. Take its warning about backing up your /usr/db/pkg database before playing around with portupgrade seriously. I have never had any trouble, nor heard about anyone who did, but always wise to have a backup copy of this database incase things get ugly.
Comments, questions and fixes are welcomed of course!
Happy upgrading!
{K}
Thanks for the motivation! :oops:
Keeping up with new version of ports/packages can be almost impossible. Doing this manually can mean ending up with a pretty messy installs of various ports and even different versions of the same thing!
portupgrade makes updating your installed ports a breeze! I have put this into 2 sections, first make sure your ports tree is updated, and then the portupgrade program for updating installed ports. If you already track the ports tree via CVS, skip this first part.
1. CVS - keeping your ports tree up-to-date
You will need to keep your ports tree updated to the latest versions of all the ports. Using CVS is an easy way to do this. For those of who have not had much or any experince with CVS, there is an great port to get you started. Its called "cvsupit". This will installed all the things you need for CVS and will setup up your CVS
You need to have a ports tree. If you don't, download the lastest ports tree, and install it.
ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/
get ports.tar.gz
tar xzf ports.tar.gz in /usr
Now that you have a ports tree, you need to keep it up-to date, which is where CVS comes in. So to install the "cvsupit" por which gets this all setup for you;
cd /usr/ports/net/cvsupit
make install clean
This will load everything you need, and when done, will go into a menu which will walk you through the setup of CVS. The first page asks about tracking the main OS source. You can it you want to, but for this you don't need that.
Skip the FreeBSD Source updating choose "none - Skip the updating of /usr/src/"
The next menu asks "Would you like to track the FreeBSD ports collection?". Answer "YES".
The next menu asks "Would you like to track the FreeBSD doc sources? You can answer "NO" to skip this.
Then it asks "Base directory for src, ports and docs subdirs?" You should leave it as /usr.
Then it will ask you to choose a CVS server. Choose which one is good for you.
Once your sever is chosen, it will ask "Do you wish to run the CVSup update now?" Hey, might as well, no time like the present!
If you choose "yes" then it will ask about compression, choose whatever suits you. You will then get a verbose panel of the CVS updating your ports collection. Once done it will give you the command to use to update the ports whenever you like. You can put this in a CRON or the Daily script, or you can just make it into a small shell script to run whenever you want to.
So now your ports tree is updated. Now onto the really cool stuff!
2. Portupgrade - updating your installed ports and packages.
You will need to install the portupgrade program.
cd /usr/ports/sysutils/portupgrade
make install clean
Then to take a look a what needs updating you can run;
pkg_version -v
which gives you a pkg_info with a comparison of your ports tree and installed packages and tell you which ones need to be updated. To upgrade a port, say for example an "unzip-5.50" installed port,
portupgrade -r unzip-5.50
It will then use the ports to build and reinstall that port, and any of its depencies (-R). Even better is just having portupgrade bring your entire installed packages and ports up to date;
portupgrade -ra
This will go through all ports/packages that need updating and update them! Cool! Although you may want to make sure you have the time, cause some building of ports, say KDE, can take quite a long time. To avoid getting too far behind I usually take a look about once a week and make sure that my installed ports are current, and if not I bring them up to date via portupgrade.
Sometimes portupgrade will have trouble with a dependecy in a particualr port. It will ask you to fix this by running pkgdb -F, which basically rebuilds your installed ports/packages database. It is interactive and you should just answer its questions as best you can.
For a much more in depth discussion of portupgrade and its various parts, take a look at this article, from which much of my little how to is based;
http://www.onlamp.com/pub/a/bsd/2001/11/29/Big_Scary_Daemons.html
A very good article. Take its warning about backing up your /usr/db/pkg database before playing around with portupgrade seriously. I have never had any trouble, nor heard about anyone who did, but always wise to have a backup copy of this database incase things get ugly.
Comments, questions and fixes are welcomed of course!
Happy upgrading!
{K}