LEMP stack installation scripts for Ubuntu 14.04

This weekend I overhauled my quick-lemp scripts for automating part of the server setup and LEMP stack installation process. The basic functionality is the same: standard new server setup is performed and a fully functioning LEMP stack is installed along with a sample Flask applications. What has changed is the way the scripts are divided and how they configure the components during the actual LEMP stack installation.

quicklemp-trusty-setup.shBasic basic new server configuration

Creates a new user with sudo and www-data membership.

Configures sshd to listen on a different port, disable root logins, and allow only the newly created member.

Installs Uncomplicated Firewall (ufw) to manage iptables rules.

Blocks all incoming traffic except for WWW, HTTPS, and the reassigned SSH port.

quicklemp-trusty-stack.shLEMP stack installation

Installs Nginx, MariaDB, and uWSGI.

Nginx is installed from PPA to get the latest stable version. A single IPv6-friendly server block is added along with configuration files from the HTML5 Boilerplate team. Optionally adds a self-signed certificate and enables HTTPS.

MariaDB 10.1 is installed from a customized repository instead of MySQL. The root password is set during installation.

These scripts were designed for Ubuntu 14.04 (Trusty). Other releases may work as well, especially just for the LEMP stack installation, but have they have not been tested. It would be a good idea to review each file prior to running them so you know exactly what they’re doing.