Setup Ubuntu 16.04 LTS with Apache2 2.4.29, MariaDB 10.2, PHP 7.2 (LAMP)

Sometimes it’s good to have the absolute latest versions of software… in most cases, the latest versions includes new features, bug fixes and other capabilities not available in the previous releases…

When building websites or blogs based on the LAMP stack, you may want to start with the latest applications that make up the stack… LAMP is Ubuntu, Apache2, MariaDB and PHP… This post shows students and new users how to install the latest versions of Apache2, MariaDB and PHP on Ubuntu 16.04 LTS Server…

Currently Ubuntu 16.04 LTS servers are running with older but stable versions of Apache2, 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 Apache2 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 Apache2 2.4.29 on Ubuntu 16.04 LTS

The latest version of Apache2 isn’t available on Ubuntu 16.04 currently… In order to install it, you must add a third-party repository to Ubuntu… Run the commands below to add the repository and key.

sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install apache2

After that, update and install Apache2.. 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 apache2

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 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-get 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 libapache2-mod-php7.2

That’s it!

This is how to install the latest version of LEMP on Ubuntu 16.04 LTS.

Enjoy!

You may also like the post below:

Setup Ubuntu 16.04 LTS with Nginx 1.13.8, MariaDB 10.2, PHP-FPM 7.2 (LEMP)

5 Replies to “Setup Ubuntu 16.04 LTS with Apache2 2.4.29, MariaDB 10.2, PHP 7.2 (LAMP)

  1. sudo add-apt-repository ppa: ondrej / apache2
    ejecuto este comando tal cual y dice Error: need a single repository as argument

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.