FreeBSD is Fun

Practical recipes for FreeBSD

Installing EOL software in FreeBSD

Posted

by

Category

Once in a while you may come across the situation where you want to install a particular version of a software package that is not available anymore through ports, usually because it’s considered obsolete (also known as EOL or End-of-life) and thus deemed insecure for production use.

But being humans with free will, it may happen that we may be ready to run the risk because we want to run, for example, a WordPress site using plugins that do not play along with php 8. Or perhaps we have a MySQL 5.6 database and we do not want to bother ourselves with the proper way to transfer databases and instead prefer copying the data files over so we can keep using commands and instructions from a decade ago. Either way, there is a simple way to accomplish this through the ports system.

What we will do is check out an old version of the ports tree from git and compile whichever software we need manually.

Bear in mind that doing these steps may potentially cause problems if we want to update our packages through pkg in the future, or incompatibilities with other installed ports. I recommend doing these steps in a non production system and if possible convert the data we need into a modern format. In any case, I decline any responsability for downtime or loss of data resulting from this procedure. Always backup.

The first step is to install git – which incidentally is the new canonical way of installing ports – portsnap has been deprecated as of FreeBSD 14. The portmaster package is removed in FreeBSD 14 and future versions. Anyhow, let’s get on with it:

pkg install git

If we have the ports tree installed previously our system, we should get rid of it to prevent clashes in files and the like. A simple deletion will do:

rm -R /usr/ports/*

then we will clone the ports tree:

git clone https://git.freebsd.org/ports.git /usr/ports

It may take a while, so in the meantime, let’s find the exact point in time we want to bring back to life. Search for the port you would like to have; for example, php73. Typing something like “freebsd ports php73” into your search engine of choice will probably bring you to this page:

https://www.freshports.org/lang/php73

Scroll down until you find the commit history. Each update of a git repository is called a commit. The first commit we will see (the are ordered by newest first) would probably be the one removing this port, so let’s focus on the one before that, unless you have a specific reason to want another different commit of this port. This is what it looks like:

See those little icons on the left? Click on the first one and copy the string of numbers and letters under “commit”. In our case, for example, the commit hash is:

529117f533a514559415cae1128f90c4c8f131c4

Now go back to the console and cd to /usr/ports.

svn checkout 529117f533a514559415cae1128f90c4c8f131c4

Voila! your ports tree has been sent on the Delorean all the way back to 2021. Now you can just find the desired port and compile it:

cd /usr/ports/lang/php73
make install clean

Keep in mind your ports tree will remain in this state until you “checkout” a different commit.

Not feeling confident? You can always hire me to perform this or any other of the administrative tasks described in this blog.


Leave a Reply

Your email address will not be published. Required fields are marked *