Installing only Nginx from Dotdeb

Debian LogoDotdeb is a repository of extra packages for Debian. Dotdeb has newer versions of Nginx, PHP, MySQL, Redis and other server software than you’d find in the official Debian repos. The instructions provided on Dotdeb tell you how to install various versions of PHP and MySQL but they don’t tell you how to install only Nginx. Here’s how you can do that.

First you add the “All” dotdeb repo to a file your /etc/apt/sources.list.d:

deb http://packages.dotdeb.org wheezy all

Next you create a preferences file in /etc/apt/preferences.d/ with the following contents:

Package: *
Pin: release o=packages.dotdeb.org
Pin-Priority: 1
 
Package: nginx*
Pin: release o=packages.dotdeb.org
Pin-Priority: 500

What this does is set a low priority for all packages in the Dotdeb repo except for Nginx. Now apt will not install a package from Dotdeb unless that package’s name begins with nginx.

Next, tell apt to update it’s cache of repo info and install nginx:

sudo apt-get update
sudo apt-get install nginx

For more about package pinning see the man page for apt_preferences.

Leave a Reply

Your email address will not be published. Required fields are marked *