Ubuntu – How to install the latest version of a package with apt-get

aptpackage-management

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/pkg.jenkins-ci.org/debian 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?

Best Answer

just type

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

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