Nginx – How to install specific version of Nginx on Ubuntu

nginxUbuntu

I've got an Ubuntu 14.04 webserver, and I'd like to install a specific major version of Nginx on it. This means that if I install Nginx 1.8, I do not want Ubuntu to upgrade to 1.9 at any point. However, minor version upgrades are OK (1.8.1 to 1.8.2).

I've found the PPA nginx/stable, but isn't someone maintaining a repository where I can choose the actual version to install? This would be similar to the Ubuntu official package, but just a newer major version.

I consider this to be an essential requirement in order to be able to maintain stable environments where (a) I can guarantee a specific version and (b) critical software not suddenly just jumps a major version up and consequently breaks due to e.g. non-compatibility with configuration files.

Best Answer

Install the specific version from nginx ppa

sudo apt-get install nginx=1.8.*

And stay there

sudo apt-mark hold nginx=1.8.*

although you could just stick with 'stable' and trust the package maintainers.

sudo -s
nginx=stable # use nginx=development for latest development version
echo "deb http://ppa.launchpad.net/nginx/$nginx/ubuntu lucid main" > /etc/apt/sources.list.d/nginx-$nginx-lucid.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
apt-get update
apt-get install nginx

how-to-prevent-updating-of-a-specific-package