How To Install LAMP in Ubuntu 18.04

Tutorial Difficulty Level    

The objective of this tutorial is to install the LAMP stack (Linux, Apache, MySQL and PHP server) on Ubuntu 18.04 “Bionic Beaver”, which is now available in the ITLC’s Xen Orchestra sandbox as a “Quick Instance”.

Using the tasksel command the procedure of installing LAMP on Ubuntu 18.04 Bionic Beaver is a rather trivial matter. First, make sure that you have are completely up to date and that the tasksel package installed:

To install LAMP server using tasksel execute:

Test your LAMP Install

Create a simple PHP Info page to test your LAMP installation:

The above command will create a new /var/www/html/phpinfo.php file with the following content:

Now, point your web browser to your new LAMP install using the following URL:

http://<YOUR SERVER IP ADDRESS HERE>/phpinfo.php

All done. Below you can find some optional tasks to further configure your LAMP stack server.

MySQL Secure Installation

It is recommended to secure your MySQL installation before using your LAMP stack server in production. To do so execute:

Firewall Configuration

If using the Ubuntu Firewall, the following firewall configuration allows incoming traffic on TCP ports 80 and 443:

Install PHPMyAdmin

Now that Apache2, MySQL and PHP are installed the final step is to install phpMyAdmin and configure. To do that, run the commands below:

When prompted to choose the webserver, select (with the SPACE bar) apache2 and continue.

When prompted again to allow debconfig-common to install a database and configure select No.

Now, open your web browser and login to the server IP address followed by /phpmyadmin