How to Install a Specific Version of the Package Using apt

Linux operating systems are most known for the installation of any software or package using just the terminal. The Debian-based distributions of Linux make use of the “apt” package manager to install or remove any package on the system from the repository. Sometimes, the user may require to get the specific version of the software to accomplish a specific task using that version. Hence the need to install specific versions of software arises.

In this post, we will demonstrate the method to install the desired version of any package using the apt repository.

How to Install Specific Version of Software?

Before you install a specific version of any software, it is important to know how to install the package. In Debian-based systems, the “apt” is the key player in installing various software. The standard command to install any package using the “apt” is as follows:

$ sudo apt install <package_name> 

This command will install the package with the latest available version. To install a specific version, this command needs to be modified a little. For a better understanding, we have provided a set of sequential steps to install a specific version of the software using “apt”.

Step 1: Check the List of Available Versions

To understand how the modification to the original command (as shown above) works we first need to check which versions of our software are currently available in the apt repository. To achieve this, utilize the following command in the terminal. Here, we are taking “virtualbox” as an example:

This command will output all the versions of that package that are currently available in the apt repository. Check out the sample below:

$ sudo apt-cache madison virtualbox

Step 2: Install the Required Version

To install a specific version, the below-mentioned syntax is followed:

$ sudo apt install package=version -V

In this command, the version is entered alongside the name of the package which will help in specifying the installer to retrieve that version of the package. Check out the example below for reference:

$ sudo apt install virtualbox=6.1.32-dfsg-1build1 -V

In this example, the older version of Virtualbox is chosen and installed using the “apt‘. The “-V” is simply an option used to receive more details about the installation process. Through these simple steps, your system will have installed the desired version of the package with ease.

Conclusion

To install the desired version of any apt package, you simply need to use the “madison” keyword to get a list of all the available versions in the repository. From the list, the version can be chosen and then using a simple command that version can be installed onto the system. This article has given knowledge on the steps needed to install any available version of a package.