Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's easy to install a specific version of a package with apt-get:

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

For example:

apt-get install jenkins=1.517

But is there a shortcut for installing the latest version?

For example, say writing a script to automate Jenkins installation. After adding http:/q/ to /etc/apt/sources.list, Jenkins is available from two sources. Now, I'd like to tell apt-get to install the latest version without knowing exactly what the latest version is at the time the script is executed.

Is this possible in any simple way?

share|improve this question
apt-get by default get the latest version. run apt-get update before to be sure – Anwar Shah Jun 27 '15 at 5:20
up vote 7 down vote accepted

just type

apt-get update    
apt-get install <package-name>

And the latest available in all your repositories will be installed.

share|improve this answer
Don't forget apt-get update before apt-get install ... to update the package lists from repositories. – Eric Carvalho Jun 3 '13 at 13:13
Thanks, kind of obvious... :) Earlier I've run into having an older version installed unintentionally, but maybe that was caused by forgetting to do apt-get update first. – Jonik Jun 3 '13 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.