Gentoo slots
So as a Gentoo sysadmin you would like to keep your system clean. But sometimes you also like to do some experiments. For example, you want the stable version of PHP on your system, but you want to check out the latest version. Gentoo allows you to pull in both 7.4 and 8.0 and use them along with each other.
The mechanism behind this is called "slots" and it's fairly simple to use. You just emerge the stable version as usual with:
Once that is finished, you actualy used the first slot. To pull in the latest version without removing the stable version, you do this:
Naturally you will first have to unmask this version by adding it to /etc/portage/package.accept_keywords
Now you can emerge version 8.* to the second slot. To select the version you want to use, you can use eselect:
And you will see the two versions peacefully along with each other. In this example I used apache2, but you can choose between cli, apache2, fpm, cgi and phpdbg. You can even use different versions for each of them. To actually switch to the second slot you do:
There is only one problem with these slots. When you run:
Gentoo will want to remove the non stable and older versions. Luckily, you can exclude them with:
Another option is to add the versions you want to keep to you world file (/var/lib/portage/world)
Or you can preserve a specific version by emerging it with the --no-replace option.