When building websites or blogs based on the LEMP stack, you may want to start with the latest applications that make up the stack… LEMP is Ubuntu, Nginx, MariaDB and PHP… This post shows students and new users how to install the latest versions of Nginx, MariaDB and PHP on Ubuntu 16.04 LTS Server…
Currently Ubuntu 16.04 LTS servers are running with older but stable versions of Nginx, MariaDB and PHP.. If you want to run the latest, you’ll have to install their repositories as well as a third-party PPA for PHP latest.
Also, not all applications are compatible with PHP 7.2… so do some research on the application using the stack..
As of now, 1/17/2018, the latest version of Nginx Mainline is 1.13.8, MariaDB is 10.2.12 and PHP is sitting at 7.2. To have these installed, the steps below should be a starting point.
Step 1: Update Ubuntu 16.04 LTS Server
Before installing packages on Ubuntu servers, your first task should be to update Ubuntu.. to do that run the commands below:
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
Step 2: Install Nginx 1.13.8 on Ubuntu 16.04 LTS
The latest version of Nginx isn’t available on Ubuntu 16.04 currently… In order to install it, you must add Nginx’s packages repository to Ubuntu… Run the commands below to add the repository and key.
cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key sudo apt-key add nginx_signing.key
When you’re done, run the commands below to add Nginx’s mainline repository
sudo sh -c "echo 'deb http://nginx.org/packages/mainline/ubuntu/ '$(lsb_release -cs)' nginx' > /etc/apt/sources.list.d/nginx.list"
After that, update and install Nginx.. doing this will download the latest version for Ubuntu 16.04… if the repository stays on the system, you’ll continue to get the latest version everytime it’s released.
sudo apt update sudo apt install nginx
Step 3: Install MariaDB 10.2.12 on Ubuntu 16.04 LTS
Again, the latest MariaDB version isn’t available to Ubuntu 16.04… to install, add the repository below:
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
After adding the repository key above, continue below to add MariaDB repository. To add the repository for MariaDB, run the commands below:
sudo sh -c "echo 'deb [arch=amd64,i386] https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB-10.2.list"
After that, run the commands below to update and install the latest version of MariaDB database server.
sudo apt update sudo apt install mariadb-server mariadb-client
Step 4: Install PHP-FPM 7.2 on Ubuntu 16.04 LTS
Finally to install the latest version of PHP, run the commands below to add this third-party repository… and follow with installing php 7.2
PHP 7.2 isn’t available on Ubuntu default repositories… in order to install it, you will have to get it from third-party repositories.
Run the commands below to add the below third party repository to upgrade to PHP 7.2
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php
Then run the commands below to update and install PHP 7.2
sudo apt update sudo apt install php7.2-fpm
This is how to install the latest version of LEMP on Ubuntu 16.04 LTS.
You may also like the post below: