Get Nginx Latest on Ubuntu 17.04 | 17.10

This brief post shows students and new users how to install the latest versions of Nginx, aka Engine-X on Ubuntu 17.04 | 17.10 server. Nginx is a fast and lightweight web server that provide improved website performance.

Nginx, an alternative to Apache2 and other web servers, can be installed easily in Ubuntu by running the apt-get install command.

However, installing Nginx from Ubuntu default repository probably won’t get you the latest stable or mainline versions. This post is going to show you how to download and install Nginx from its repository for the absolute latest.

If you’re a webmaster and don’t mind whether you get the latest stable version, then run the commands below on Ubuntu server to install Nginx. The commands below will get most stable version found in Ubuntu repository, but won’t necessarily be the latest.

To install Nginx from Ubuntu repository, run the commands below:

sudo apt-get install nginx

After running the commands above, Nginx should be installed and ready to use.

Installing Nginx from its Repository

To install the latest version of Nginx, you must add its repository to Ubuntu. This can be done by running the commands below to add its repository key to the server.

cd /tmp/ && wget

After adding the repository key, the two repository below can get Nginx installed.

Nginx has two repositories. They are, Stable and Mainline repositories.

Nginx’s Mainline repository contains packages of both Stable and Mainline repositories. Stable repository contains packages only available in the stable branch. Consider Nginx’s mainline repository as a place new features get introduced.

After packages and features in the current mainline repository are tested and proven, the repository is then promoted to the latest stable and a new mainline is created.

Adding Nginx Mainline Repository

To add Nginx Mainline repository to Ubuntu, run the commands below:

sudo sh -c "echo 'deb '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/NginxMainline.list"

Then run the commands below to install Nginx.

sudo apt-get update
sudo apt-get install nginx

Adding Nginx Stable Repository

To add Nginx Stable Repository to Ubuntu, run the commands below

sudo sh -c "echo 'deb '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/NginxStable.list"

Then run the commands below to install Nginx

sudo apt-get update
sudo apt-get install nginx

If both Nginx mainline and stable repositories are added to Ubuntu, packages will be installed from Nginx mainline repository because they’re the latest.


This post shows students and new users how to install the latest versions of Nginx on Ubuntu server. Nginx has two primary repositories. The Stable and Mainline repositories. The mainline repository is where newer features and packages get introduced.

The stable repository has packages that are tested and proven to work in a production environment.


You may also like the post below:

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.