How to Install Nagios Core on Ubuntu 16.04

This tutorial explains how to install Nagios Core on an Ubuntu 16.04 server. Nagios is an open source enterprise-class software that is used to monitor network infrastructures, servers and applications. With Nagios you can monitor Linux and Windows servers as well as web applications, Linux and Unix applications and Windows applications. The features include parallelized service checks, plugin system, notifications via email, pager or user defined service, web interface for viewing status, log files, problem history and notifications and much more.
This guide should work on other Linux VPS systems as well, such as the latest versions of Ubuntu, but it was tested and written for Ubuntu 16.04.