Ubuntu and Debian are popular Linux distributions that come with a large repository of software packages. While these repositories are regularly updated with the latest versions of software packages, sometimes you may need to install a specific version of a package. In this article, we’ll show you how to install a specific package version on Ubuntu and Debian.

Advertisement

Method 1: Using apt-get Command

The apt-get command is a powerful package management tool that comes pre-installed on Ubuntu and Debian. You can use the apt-get command to install a specific version of a package from the official repository. Here’s how to do it:

Step 1: Update the Package Repository

Before you can install a specific package version, you need to make sure that your package repository is up-to-date. Open the terminal and run the following command:

sudo apt-get update 

This will update the package repository with the latest package information.

Step 2: Find the Available Package Versions

To find the available versions of a package, you can use the following command:

apt-cache showpkg <package-name> 

For example, if you want to find the available versions of the Apache2 package, you can run the following command:

apt-cache showpkg apache2 

This will display a list of available package versions, along with their dependencies.

Step 3: Install the Specific Package Version

Once you’ve found the package version you want to install, you can use the following command to install it:

sudo apt-get install <package-name>=<package-version> 

For example, if you want to install version 2.4.29-1 of the Apache2 package, you can run the following command:

sudo apt-get install apache2=2.4.29-1 

This will install the specific package version along with its dependencies.

Method 2: Using dpkg Command

The dpkg command is another package management tool that can be used to install a specific version of a package. Here’s how to do it:

Step 1: Download the Package Version

Before you can install a specific package version, you need to download the package file. You can do this by visiting the Debian Package website (https://packages.debian.org/) or the Ubuntu Package website (https://packages.ubuntu.com/), searching for the package, and downloading the .deb file for the version you want to install.

Step 2: Install the Package Version

Once you’ve downloaded the .deb file, you can install it using the dpkg command. Open the terminal and navigate to the directory where you downloaded the .deb file, and run the following command:

sudo dpkg -i <package-file-name>.deb 

For example, if you downloaded the Apache2 package version 2.4.29-1, you can run the following command:

sudo dpkg -i apache2_2.4.29-1ubuntu4_amd64.deb 

This will install the specific package version along with its dependencies.

Conclusion

In conclusion, installing a specific package version on Ubuntu and Debian is a simple process that can be accomplished using either the apt-get or dpkg command. By following the steps outlined in this article, you’ll be able to install the exact package version you need to get your software up and running. Good luck!

Share.

1 Comment

Leave A Reply


Exit mobile version