Debian & Ubuntu Linux: Install a package from backports

Hi,

if you require a newer version of a package on a debian based system it may be possible that it is backportet from the latest testing line.

For example, you want use OpenJDK 11 on debian stretch.

First of all add the backport repository.

root@debdev ~ # echo deb http://deb.debian.org/debian stretch-backports main > /etc/apt/sources.list.d/stretch-backports.list
root@debdev ~ # apt-get update

Search for OpenJDK

root@debdev ~ # apt-cache search openjdk
...
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
...
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)

To get/show the repository a package comes from

root@debdev ~ # apt-cache policy openjdk-11-jdk-headless
...
 *** 11.0.3+1-1~bpo9+2 100
        100 http://deb.debian.org/debian stretch-backports/main amd64 Packages
        100 /var/lib/dpkg/status

Install the package

root@debdev ~ # apt-get -t stretch-backports install openjdk-11-jdk-headless

If the package name is unique you can omit the -t switch

root@debdev ~ # apt-get install openjdk-11-jdk-headless

Michael

Leave a Reply Cancel reply