Software developers periodically release new versions of their products with better functionality and in many cases with performance and security improvements. When we install any of these applications through packages in distributions such as Ubuntu, CentOS or Debian, by default the latest version of this utility will be installed which, although it is ideal and practical, in some specific cases other applications may not be compatible with That version. For example, many applications require Java 8 for optimal operation but do not run with Java 9..
To solve this, today we will see how we can install a specific version of any application , as long as it is available, in these distributions and thus execute the tasks with the correct versions.
1. How to install a specific package on CentOS, RHEL or Fedora
When working with any of these distributions, it will be necessary to verify all available versions of the selected package regardless of whether they are installed or not.
By default, the yum command, typical of these Linux distros, will omit old versions of a package and will always try to install the latest version available to enjoy it, but as we have indicated, this is not always ideal..
Another problem in these distributions is that when searching for information about a specific package, the yum command will only display the latest version of that package in the result of the information, list or search subcommands. To correct this, we can use the parameter --showduplicates, which is responsible for displaying all versions of active packages in the repository.
Step 1
For this, we will execute the following:
yum --showduplicates list “Packageâ€
There we can see the results with the different versions available to be installed in the system..
Step 2
Using this command, the format of names for packages to use is:
Package_name.architecture conversion_number –build_number repository
The number_build line represents the minor changes made by the package developer with details such as additional documentation, changes to the configuration files and more. Once we have clear the specific version of the package to install, we can install it using any of the following syntax:
package_name-version (Install the complete package) build_number “package_name-version _build_numero†(Install a specific version)
Step 3
In this case we can see that the package is already installed, in this case, it will be necessary to remove the version of the installed package, if you need to install an earlier version of the selected packages.
To remove a package we execute the following syntax:
yum remove “packageâ€
2. How to install a specific package on Ubuntu or Debian
Step 1
For these popular Linux distributions, it will be necessary first to check the version of the package installed on the system including all the packages available in the repository, for this we will use the apt-cache command like this:
sudo apt-cache policy “Packageâ€
Here we can see if the selected package is installed and the versions available for installation.
Step 2
If we want to install a specific version of the selected package, we will execute the following syntax:
sudo apt install “package-versionâ€
Step 3
If we already have a more recent installed version of the package in the distribution, it will be necessary to remove it by executing the following:
sudo apt remove “packageâ€
Once this removal process is executed, we can repeat the installation process of the desired version of the selected package without problems.
In this way, we have the opportunity to manage the versions of the packages in Linux.