How to save elasticsearch package for later use when elastic release new version

We currently have 2.1 elasticsearch. We are going to upgrade to 2.2, but we want to save the source list and package to be able to roll back to 2.1 if we need.

Also, when we do upgrades to our elastic stack infrastructure but we don't want to upgrade to the latest elasticsearch version, how we would we use the older version through the repo list.

Make sense?

apt and yum both provide ways to both pin a package to a specific version or install a specific version that isn't "latest".

You should consult your applicable OS documentation to see how.