Install a specific version of a package in Debian / Ubuntu

Quiet often we setup auto pipelines for Continuous Integration in Cloud (like GitLab CI, Travis CI etc) and we install required packages (like mvn or gradle) using apt-get install command to run the build.

Sometimes it is quiet important to have a specific major version of a package or major-minor version of a package to run the build, otherwise the build might break with unintended behaviour.

Hence this post explains the following commands on Debian / Ubuntu operating system:

  1. List all available packages
  2. Search for a package
  3. List the available version of a package
  4. Install a specific version of a package
  5. Install a specific major version of a package
  6. Install a specific major.minor version of a package
  7. Install a specific major.minor.security version of a package


List all available packages

apt-cache pkgnames

Search for a package

apt-cache search jdk

List the available version of a package

apt-cache madison maven

Install a specific version of a package

apt-get install -y maven=3.3.9-4

Install a specific major version of a package

apt-get install -y maven=3\*

Install a specific major.minor version of a package

apt-get install -y maven=3.3\*

Install a specific major.minor.security version of a package

apt-get install -y maven=3.3.9\*

Comments

Popular posts from this blog

JSON with curl and jq

Import self signed in Linux for Chrome / Chromium headless testing

Colima - Drop In replacement for Docker Desktop for Mac and Linux