How To Install Specific Package Version on Ubuntu & Debian – TecAdmin (2024)

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.

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!

How To Install Specific Package Version on Ubuntu & Debian – TecAdmin (2024)

FAQs

How do I install a specific version of a package in Ubuntu? ›

How to Install a Specific Package Version on Ubuntu?
  1. Step 1: Update the Packages List.
  2. Step 2: Search for the Available Versions.
  3. Step 3: Install the Version.
  4. Step 1: Download the “. deb” File.
  5. Step 2: Install the “.deb” File.
Jun 9, 2023

How to install Ubuntu Debian package? ›

You can install a .deb file on Ubuntu using the dpkg or apt command. Here's how: Using dpkg: Open a terminal window and navigate to the directory containing the .deb file. Run the command sudo dpkg -i filename.deb, replacing filename.deb with the actual name of the .deb file.

How do I install a specific version of Linux? ›

Sometimes, we may need root access to install certain packages.
  1. 2.1. Check the Installed Version. Before moving forward, we first need to check the installed version. ...
  2. 2.2. Check the Available Version. ...
  3. 2.3. Uninstall the Current Version. ...
  4. 2.4. Install a Specific Package Version. ...
  5. 2.5. Verification of Installation.
Mar 18, 2024

How do I upgrade a single package to a specific version of apt? ›

“You just need to do apt-get install --only-upgrade <packagename> . This will upgrade only that single package, and only if it is installed. If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out --only-upgrade .”

How to install packages with specific version? ›

To install a specific version of a package using pip, use the syntax pip install package==version . For example, to install version 1.0. 0 of a package named 'sample', use pip install sample==1.0.

How to manually install a package in Ubuntu? ›

Installing deb package on Ubuntu/Debian
  1. Install gdebi tool and then open and install the . deb file using it.
  2. Use dpkg and apt-get command line tools as follows: sudo dpkg -i /absolute/path/to/deb/file sudo apt-get install -f.

How to install a Debian package in terminal? ›

On Debian (or if you prefer Apt in Ubuntu), use these steps:
  1. Press Ctrl + Alt + T to open a terminal window.
  2. Type sudo apt update and press Enter.
  3. Enter your password when prompted.
  4. Type sudo apt install gdebi and press Enter or Return.
Jan 19, 2024

How to install a package in Debian? ›

Install a package (including unpacking and configuring) onto the file system of the hard disk: dpkg --install foo_VVV-RRR. deb . Unpack (but do not configure) a Debian archive into the file system of the hard disk: dpkg --unpack foo_VVV-RRR. deb .

How to install a package in Ubuntu command line? ›

You can use APT to install, update, remove and even search for software packages, etc. The most common and simplest way to install packages via apt is to run the following command: apt install package_name .

How do I apt install an old version of a package? ›

If you want to downgrade a package to a specific version available in the repositories, you can use the apt-get install command with the = operator and the desired version number. For example: sudo apt-get install package_name=1.2. 3-4.

How to install a specific version of a package using yum? ›

How to install specific version via yum? To install a specific version of a package using yum on a centOS or Red Hat-based system, you use the sudo yum install <package-name>-<version> . Just replace <package-name> with the actual name of the package and <version> with the specific version number you want to install.

How to use sudo apt install? ›

The apt-get command to install packages
  1. First, check that all packages are up to date: sudo apt-get update. ...
  2. To install a package. sudo apt-get install [packagename]
  3. To Un-install a package. ...
  4. Search for Packages. ...
  5. Check which Packages are installed. ...
  6. To find out if a package is already installed. ...
  7. Clean up.

How do I change the version of a package? ›

To change the version of an installed package to a specific version, we reinstall the package while specifying what version of the package we want to install. This updates the current version of the package.

Which command is used to install a new package? ›

The Install-Package cmdlet installs a software package and its dependencies. Install-Package uses parameters to specify the packages Name and Source. The Credential parameter uses a domain user account with permissions to install packages. The command prompts you for the user account password.

What is the command to upgrade packages in Ubuntu? ›

Enter "sudo apt upgrade" into the command line: This command will upgrade all software programs that have updates available. You may see a list of the packages that will be upgraded as well as the quantity of disk space required. If you are happy, type 'y' and press Enter to proceed with the upgrade procedure.

How to specify package version in apt install? ›

You can specify a specific version to install a package this way: apt-get install pkg=version .

How to install specific version of npm in Ubuntu? ›

Install npm-check-updates on Ubuntu
  1. Step 1: Install npm-check-updates. To install npm-check-updates, open a terminal and run the following command: ...
  2. Step 2: Run npm-check-updates. Once npm-check-updates is installed, navigate to your project directory in the terminal. ...
  3. Step 3: Update Packages. ...
  4. Step 4: Additional Options.
Dec 5, 2023

Top Articles
Latest Posts
Article information

Author: Velia Krajcik

Last Updated:

Views: 6133

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.