Today I will show how to manage multiple application version . Indeed when you use the classical way as yum install … or whatever you can not to have multiple version.
I see often people that install multiple version anywhere and after you have to set env var as PATH, LD_LIBPATH, PYTHONPATH…
For this task they are a nice tool named alternatives. This tool is mainly used to have an open java and the proprietary, then we miss to often, that it could to be used for others application. This tool is not to manage only a java environment. You can to use it for any software.
I use it to have multiple version of:
They are no limit.
I will show how i do for the D compiler you could adapt easily for your software. That is not the easier software to use through alternatives like this you will see what you can to do and how.
1/ Grab the Software
DMD his hosted on github and it need phobos and druntime, to get all do:
2/ Build your application
This part is unnecessary, if you have directly the binary.
The command below will build : dmd, druntime, phobos
3/ Installing your application
I install external software into /opt and i follow this convention: /opt/
And alternatives will link the given version to /usr/local/ . Into /opt I have all versions for a given application and into /usr/local only application with a specific version.
For this we need to create the directory into /opt
And now we have just to install build files into these directory:
Add a little configuration file into bin directory
4/ Run alternatives
Here we said to alternatives to bind dmd which is located at /opt/dmd/2.065/bin/dmd to /usr/local/bin/dmd.
As the priority I use always the version here: 26500 for dmd major version 2 minor 65 and bump 00 .
Note: Always fill on two digits (or more if need) as here 0 become 00. That is important example you have version 2.64.11 and 2.65.0 which could give 26411 and 2650. But Alternatives will think that 2.64.11 is newer than 2.65.0.
slave parameter tell to alternatives which file it need to provides when this version is choose.
You can invoke:
This will set dmd with highest priority ( in our case the latest version )
You can specify a version by giving the name and his path to desired version as:
With this you will switch to an older version