Categories: TutorialsUbuntu

How to Install a Specific Version of Some Packages in Linux/Ubuntu?

In some cases, Installing Specific Versions of some packages is useful in order to avoid ruining the dependency tree in a System. As some packages in our Ubuntu System are installed as a dependency for another Application or Package, this may lead to version conflicts between multiple packages or applications. Also, some users require the use of a specific version of a package according to their liking or their needs. Thus, with useful commands in Ubuntu, a specific version of an Application or Package can easily be installed.

This article elaborates on the procedures of installing a specific version of an Application or Package in Ubuntu.

How
Sponsored
to Install a Specific Version of Some Packages in Linux/Ubuntu?

Specific Versions of a Package can easily be installed in Ubuntu through various commands and also from the GUI. The various approaches to installing specific Package Versions of a Package are:

  • Install a Specific Version of a Package through the “apt-get” Command
  • Install a Specific Version of a Package through the “apt” Command.
  • Install a Specific Version of a Package through the GUI.
  • Install a Specific Version of a Package through the Synaptic Tool.

Each listed command and approach is discussed below.

Install Specific Package Version using the “apt-get” Command

The “apt-get” is a useful command in Ubuntu that handles the packages and can be used to retrieve packages. These packages can then be installed on your Ubuntu System with the “apt-get install” command. Apart from only installing the Packages, the “apt-get” command can also be used to update the packages with the “apt-get update” command and remove any packages from your Ubuntu System using the “apt-get remove” command. Also, the “apt-get” command can be used to install a specific version of an Application or a Specified Package in Ubuntu. Install a specific version of an Application or Package with the “apt-get” command having the syntax:

apt-get install <packageName>=<packageVersion>

Before installing a specific version of a package, retrieve all the versions of the package using the “–all-versions” command along with the “apt” command and the package name:

sudo apt list –all-versions <packageName>

In our case, we listed all the versions of the “vlc” package using the “apt” command:

sudo apt list –all-versions vlc

The Command line displays the versions of the “vlc” package that can be installed:

Among the versions, we will install the “vlc 3.0.16-1build7” version:

Now, to install the specified versions of “vlc”, the “apt-get” command in our case will be:

sudo apt-get install vlc=3.0.16-1build7

This will start downloading the 3.0.16 Version of the package “vlc”. Once the download is completed, the package will be extracted to our Ubuntu System:

To verify if the specific version of the “vlc” package was installed, use the package name along with the “–version” command in the Terminal. In our case, we will use the “vlc” package name along with the “–version” command:

vlc –version

As you can see in the Terminal, the VLC version 3.0.16 is installed on our Ubuntu System:

Install Specific Package Version using the “apt” Command

The “apt” is another useful command utility that manages the packages of your Ubuntu System. With the “apt” command, you can install specific packages, update those packages, and even remove specific packages when necessary. Also, the “apt” command can be used to install a specific version of an Application or Specific Package. To install a specific version of an Application or a Specified Package in Ubuntu, the “apt” command will be:

apt install <packageName>=<packageVersion>

Before installing a specific version of a package, use the “apt list” command along with the “–all-versions” command to retrieve all the versions of the specified package:

sudo apt list –all-versions <packageName>

In our case, to list all the available versions of the package “rolldice” in Ubuntu, the “apt list” command will be:

sudo apt list –all-versions rolldice

The Terminal will display all the versions of the “rolldice” package that can be installed:

We will install the “rolldice” Version 1.16-1build1 on our Ubuntu System:

Now, to install the specific version of “rolldice”, in our case, version 1.16, the “apt” command will be:

sudo apt install rolldice=1.16-1build1

The “apt” command will start downloading the “rolldice” packages. Wait for the packages to be downloaded with the “apt install” command and then extracted on your Ubuntu System:

Once the packages are installed, you can verify the installed package with the “–version” command. In our case, to verify the “rolldice” version, the “–version” command will be:

rolldice –version

As you can see, the “rolldice” version 1.16 is Installed on our Ubuntu System:

Install Specific Package Version through the GUI

Specific Versions of a Package can also be installed through the GUI by downloading the DEB Package from their official website. To download a package through the GUI method, open your Web Browser. In our case, we will click on the Firefox Application to start it:

In the URL Bar, search for “download Virtualbox”. Once the websites appear, click on the Official Website of Virtual Box to open the web page:

The Virtual Box Download web page will open:

In the Download Page, scroll down and find the “VirtualBox older builds” section:

In the Older Build Section, click on the “VirtualBox older builds” link that will redirect you to the Older Builds Page of the Virtual Box:

The Older Builds of the VirtualBox will appear where you can download the version of your own choice:

In our case, we will download the VirtualBox 7.0 Version by clicking on it:

Once you click on the Version you wish to install, you will be redirected to the releases Page where you will select the Operating System for which you wish to install VirtualBox. As we are using Ubuntu 22.04, we will click the Ubuntu 22.04 Host:

The VirtualBox Deb Package will start downloading:

Once the download is completed, click on the File Location option to open the File Download Directory:

After clicking the File Location icon, the File Download Directory will open, in our case, the Downloads Directory:

Right-click on the Deb File to extract it in the Current Directory. Among the list of drop-menu options, click on the “Extract Here” option:

The Extraction Process will start and once the extraction is completed, a window will pop up informing about the success of the process. Click on the “Show the Files” option:

Sponsored

The Extracted Files can be seen in the Directory. In our case, Three files are extracted:

Now, to install the Virtual Machine Package, select both the extracted “tar.xz” files and right-click to open the drop-down options menu. In the drop-down option menu of the files, click on the “Extract” option:

The Files will start extracting and you can see the progress:

Once the Files are extracted, you can then use the package.

Install Specific Package Version through Synaptic

The Synaptic is a Third Party Package Manager Application in Ubuntu that can be used to install specific packages from the Official Repository. The Synaptic is not pre-installed in Ubuntu. To install the Synaptic application on your Ubuntu System, use the “apt” command:

sudo apt install synaptic -y

The Synaptic Package will start downloading:

Once the Synaptic Command is installed, you can start the Synaptic Application by running the “synaptic” command in the Terminal:

synaptic

The Synaptic Package Manager Application will start and you will see the Default Home Window of the Application:

To Install a Specific Version of an Application or a Specific Package, you have to search for that package first in the Synaptic Package Manager. To search for a Package, click on the “Search” option:

A new “Find” window will appear where you can search for Specific Packages:

In our case, we will search for the “chrome” package:

Once you add the Package Name to search for, you can filter your search as well. Click on the “Look in” option and choose an option to either find the Package in the Package Name, Find the Package according to the Description and Name, or choose any other option for searching. In our case, we will select the Name option:

Once you have added the Package Name and selected the Filter option, click on the Search button to start searching for the required packages in the Synaptic Package Manager:

All the Packages whether they are the dependency of the specified package or not, will be listed in the Synaptic Package Manager:

Now, to install a specific version of an Application or a specific package, click on the package from the list. In our case, we clicked on the “chrome-gnome-shell” package:

Once you click on the Package, a drop menu will appear consisting of multiple options. Click on the “Mark for Installation” option:

In some cases, a pop-up window will appear after you Mark the Package for Installation. The pop-up window will inform you about the changes that will be made in other packages by installing the selected package or the pop-up window will inform you about the installation of other dependency packages for the required selected package to work. Click on the Mark Button:

Now, to apply the changes and start the Installation of the Marked Packages, click on the “Apply” button from the Menu:

A Summary Window will appear where you can see the changes that will be applied to your Ubuntu System during the addition of the Package. Click on the Apply Button:

The Synaptic Package Manager will now start downloading the Packages. Wait for the Download to complete:

Once the Packages are downloaded, the Synaptic Package Manager will start installing the Packages onto your Ubuntu System:

After the Packages are Installed and the Changes are Applied, you will see the Successful Message Window:

Thus, the selected package will be installed onto your Ubuntu system. Similarly, you can install other packages through the Synaptic Package Manager.

Hold on Packages Using the “apt-mark” Command

The “apt-mark” is a useful command in Ubuntu that can hold the packages or a specific package from updating or upgrading. As you have installed a specific version of a Package, the “apt update” command will update all the packages in the Ubuntu Repository every time the command is executed which will lead to the upgrade of the specific version of the Package that you installed earlier. Thus, to avoid accidental upgrades with the “apt update” command, the “apt-mark” command is used having the syntax:

sudo apt-mark hold <packageName>

When we use the update command, the specified packages on hold won’t update. In our case, to hold the updates of the package “vlc”, the “apt-mark” command will be:

sudo apt-mark hold vlc

The Terminal will display that the specified Package is set to be “on hold”:

Thus, every time you run the “apt update” command, you don’t have to worry about the system updating the specific version applications or packages.

Now, to un-hold the already on-hold package, the “apt-mark” command along with the “unhold” command is used:

sudo apt-mark unhold <packageName>

In our case, to un-hold the “vlc” command, the “apt-mark” command will be:

sudo apt-mark unhold vlc

The Terminal will display that the specified Package is not on hold anymore:

Conclusion

For some users, the need to install a specific version of a package may be due to their liking or their needs, but for others, installing a specific version of the package may resolve a lot of Version and Dependency Conflicts. This article explains the procedure of each, the “apt-get”, the “apt”, the GUI method, and the Synaptic Method for installing a specific version in Ubuntu.

 

Ubuntu Server Admin

Recent Posts

Building RAG with enterprise open source AI infrastructure

One of the most critical gaps in traditional Large Language Models (LLMs) is that they…

18 hours ago

Life at Canonical: Victoria Antipova’s perspective as a new joiner in Product Marketing

Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…

2 days ago

What is patching automation?

What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…

3 days ago

A beginner’s tutorial for your first Machine Learning project using Charmed Kubeflow

Wouldn’t it be wonderful to wake up one day with a desire to explore AI…

4 days ago

Ubuntu brings comprehensive support to Azure Cobalt 100 VMs

Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…

4 days ago

Ubuntu Weekly Newsletter Issue 870

Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…

5 days ago