How to install binary packages on older FreeBSD releases / Install binary packages on FreeBSD 7.2

If you’re in a situation like, me where you run some old verison of FreeBSD and you need to install a bunch of packages let’s say GNOME Desktop environment on a host which before was used as a network router / mail server and general firewall. You will probably be surprised the usual way to install a pre-compiled BSD binaries with pkg_add -vr packagename will no longer work, i.e.:


freebsd# pkg_add -vr gnome2
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/gnome2.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/gnome2.tbz' by URL
pkg_add: 1 package addition(s) failed

The reason why binary package fetch and install no longer work is obvious the repository link ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/ which was previously working no longer works.

So to install be able to install this already obsolete compiled packages what is neccessery is to explicitly change the FTP location, where the packages will be looked for with a location to a working link corresponding to your FreeBSD version. To make sure the link is working in accordance with your FreeBSD release do a search in Google and get the proper FTP link. My BSD version is RELEASE 7_2, hence after a quick look in Google, I found a binary repository containing packages for my FreeBSd under link:


ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.2-release/Latest

To change the default set binary .tgz packages repository to the newer correct one for the currently logged in user via tty or over ssh use the csh / bash PACKAGESITE variable.
Whether in csh type:


freebsd# setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.2-release/Latest/

Either if you use Bourne Again (bash) shell type;


[root@freebsd ~]# export PACKAGESITE="ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.2-release/Latest/"
[root@freebsd ~]#

Just as a matter of fact it is useful to say pkg_add command uses FreeBSD (Linux wget like) fetch to download the pre-compiled binaries. In other words the PACKAGESITE var is understood by fetch command, whether it is looking for some shell exported vars 🙂
To make the new PACKAGESITE setting permanent in csh include it in /root/.cshrc:


echo 'setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.2-release/Latest/' >> /root/.cshrc

If your root user is set to use bash add it to /root/.bashrc


echo 'export PACKAGESITE="ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.2-release/Latest/"' >> /root/.bashrc

That’s all now you will now be able to install pre-compiled packages via pkg_add 🙂 Enjoy!

Share this on

More helpful Articles

Download PDFDownload PDF

Leave a Reply

CommentLuv badge