Install LAMP Stack

Introduction

A “LAMP” stack is a group of open-source software that is typically installed together in order to enable a server to host dynamic websites and web apps written in PHP. This term is an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.

Other versions like WAMP is suited for Windows and more versions are listed here.

The installation requires a Command Line Interface (CLI). Either you can continue on the server itself with the connected screen and keyboard or connect to the server via TELNET or better SSH (secure TELNET). 

Installing Apache

The Apache web server is among the most popular web servers in the world. It’s well documented, has an active community of users, and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website.

Assumed to be logged in and have root privilege:

$ sudo apt update
$ sudo apt install apache2

Press Y when promted to install.

Update UFW.

$ sudo ufw app list

Should display:

Available applications:
Apache
Apache Full
Apache Secure
OpenSSH

What does this mean:

  • Apache: This profile opens only port 80 (normal, unencrypted web traffic).
  • Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic).
  • Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic).

Although no secure certificate is available yet, let's use the FULL profile.

$sudo ufw allow in "Apache"

Verify:

$ ufw status

Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Apache Full ALLOW ANYWHERE
OpenSSH (v6) ALLOW Anywhere (v6)
Apache Full (v6) ALLOW ANYWHERE (v6)

 

Do a spot check right away to verify that everything went as planned by visiting your server’s IP address in your web browser: http://server-ip-address
The following page should be downloaded.

apache test

Apache installation successfully completed