Installing packages with the
apt-get package manager on Ubuntu or Debian usually fetches the latest known version from the repositories. This is a comfortable behavior to use an up-to-date version of the package.
If you want to install a specific package version, you can do that by appending an equal sign and the version number to the package name:
sudo apt-get install package=version
For example, the command to install Elasticsearch in version
6.2.4 looks like this:
sudo apt-get install elasticsearch=6.2.4
That’s it! Awesome, huh 😃
If you run into issues it may relate to outdated repositories. Ubuntu and Debian may not ship or reference the latest package releases.