How to Install a Specific Version of a Package in Ubuntu Linux

You can install the latest version of any package from the repository, but you can also ask for a specific version of the software.

When you type sudo apt install package-name, it gives you the most recent version of the package. This may not be what you want if you need to install a specific version of the package for compatibility, features, or other reasons.

Then, in this case, you can ask apt command for the specific version; if they have it, then you can begin with the installation. Otherwise, you can get the binary or source file from the official resource and get it installed.

So let’s start the guide, where I’ll show you how you can use the apt command to ask for a specific version of utilities to install on your system and also show you how you can use Synaptics to get different versions of the same tool.

Method to Install a Specific Version of the Package

There are two methods that I know of that you can use to install particular versions of applications or packages, like using the apt or aptitude command, and if you prefer a GUI, then you can go with the Synaptics package manager.

Install Specific Version of Pacakge from the apt command

The steps are fairly straightforward, so I’d better give you an overview of what we’ll be doing throughout the article. First, I’ll show how you can find the version for which you are looking in the repository and, if it is available, how you can install it on any Ubuntu machine.

Step 01Check the available version of a specific package in the repository

One of the foremost steps here is to check whether the version of the package you are looking for is available in the repository. This can be done by running sudo apt policy package-name, sudo apt-cache madison package-name, or sudo apt list -a package-name.

So for demo purposes, let me find the older version of the Timeshift on my Linux Mint by running any of the following commands:

$ sudo apt policy timeshift
or 
$ sudo apt-cache madison timeshift
or
$ sudo apt list -a timeshift

As you can see, I have found two different versions of Timeshift: one is 22.06.5+Vanessa and another is 21.09.1-1 from the Ubuntu universe repo.

Check available version of timeshift
Check available version of Timeshift

Tip: If you are not finding applications in your newly installed Ubuntu, then check if you have enabled multiverse or universe in the Software Center.

Step 2Install package

Once you find the package available in the repository, you can use the apt command by specifying the package version by following the syntax below:

$ sudo apt install package-name=version

But I suggest you add the -s flag before installing applications, which simulates the installation, so you can be aware of what packages are going to be added to or removed from your system.

$ sudo apt install -s timeshift=21.09.1-1
Installation simulation of specified version of Timeshift
Installation simulation of the specified version of Timeshift

After reading the output, if you find everything is good to go, then remove the -s flag and run the command as shown below to install the specified version of the package.

$ sudo apt install timeshift=21.09.1-1
Install Timeshift
Install Timeshift

When you try to install a certain old version of an application, you may get the error E: Unable to correct problems; you have held broken packages.

To fix that problem, you can look at the error message as shown below and install the dependencies that are needed:

Dependencies error message for python3
Dependencies error message for python3

Command to install python3.10.4-0ubuntu2 with missing dependencies.

$ sudo apt install python3=3.10.4-0ubuntu2 python3-minimal=3.10.4-0ubuntu2 libpython3-stdlib=3.10.4-0ubuntu2

Or else I would recommend that you use the aptitude command to fulfil all dependencies that are required for the programme by running the following command, which will install the particular version of the application without any difficulty.

$ sudo aptitude install libreoffice=1:7.3.2-0ubuntu2

Output may be overwhelming if you’ve never used aptitude, so it’s better to check this article for more information, like how you can install an older version of an application without running into the dependencies issue.

Install a Specific Version of Packages from Synaptic Package Manager

You can also use the Synaptic package manager to install a specific version of a package by choosing the package you want to install, clicking “Package” in the menu bar, and then choosing “Force Version.”

If you don’t have Synaptic installed on your system, then first get it by running the below command:

$ sudo apt install synaptic -y

Once you run Synaptic, you will find the list of applications, buttons, and many other options, but you need to first look at the search option, which you will find on the right of the application interface.

Enter the name of the programme or package you want to install on your system in the “Search” box.

Search for package
Search for package

Now select the “virtualbox” or the respective package that you have searched and press Ctrl + E, or you can use the menu option Package -> Force Version.

It will open a new prompt where you need to select the version from the drop-down menu that you want to install and click on “Force Version”.

Like I have selected the 6.1.32-dfsg-1build1 (jammy) over the default 6.1.38-dfsg-3~ubuntu.22.04.1 (jammy updates)

Choose Version
Choose Version

Once you click on “Force version,” it will ask you to mark the following changes:

Click on mark
Click on mark

Next, you need to click on the “Apply” button you will find on the application’s main interface, and after that, it will prompt you for the summary, where you need to once again click on “Apply”.

Click on Apply button
Click on Apply button

Wait for the installation to complete, and once it’s done, close the window and check the package in the Terminal or Applications menu.

Wait for the procress to complete
Wait for the changes to apply

Not every programme can be easily installed using this method because some programmes have this dependency issue. So it’s better to use the aptitude command to install a specific version of the application.

Wrap up

That’s all for this article, where you have learned how to install a specific version of an application in Ubuntu using sudo apt package-name=version, aptitude, and the Synaptic package manager.

If you are not able to install an application due to a dependency issue, then you need to manually fulfil the dependencies, which may be a tiresome process, so it’s better to use the aptitude command for this purpose.

For any reason, if you want to have an older version of the application, then I would suggest you get the AppImage, or if you are using Flatpak, then read this guide to get a specific older version of the application.

If you know any other way to install specific version of command, then let use know in the comment section.

Leave a Reply