The Internet That Doesn't Suck

The LAMP Stack

LAMP stands for “Linux, Apache, MySQL, and PHP”. The components are somethines swapped out (MariaDB of MySQL, Python or Perl for PHP, etc), but the core concept is Linux + A web server + a database + a programming language.

It’s a programming model that has become less popular with the rise of cloud services - Most modern stacks are preoccupied wth making sure automated deployment requirements are happy, not focusing on the actual core of what you are trying to set up.

Examples

Wordpress

Wordpress is a traditional LAMP stack application. To install Wordpress, you download the source, set up Apache & MySQL, and turn it on.

phpBB3

phpBB3 is also a LAMP stack application. It implicitly assumes Apache in its documentation, which can lead to difficulties using alternative web servers like nginx.

Setting up the LAMP stack

Get a Linux server

Getting a VPS is detailed in the tutorial here.

Install Apache

sudo apt install apache2 

If you need Apache PHP modules:

sudo apt install libapache2-mod-php

After installation, turn it on:

systemctl start apache2

And enable it as a system service, so that it starts automatically if the host restarts.

systemctl enable apache2

Apache assumes both a user and a group called www-data. All files being served by Apache must belong to this user:group. To set permissions for all files in a directory, run:

chown -R www-data:www-data /path/to/your/data
sudo apt install apache2 mysql-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y

Service-specific behaviors you may need

phpBB3

phpBB3 needs Apache’s rewrite module:

a2enmod rewrite

Install MySQL

sudo apt install mysql-server

Then run:

sudo mysql_secure_installation

To secure the server. (TODO: Guide for this? This may be unneeded.)

You will also need to create a table for the service to use.

In general, for service “example_service”, you’ll need to run something like:

CREATE DATABASE example_service;
CREATE USER 'example_service_user'@'localhost' IDENTIFIED BY 'a_STRONG_password_12345';
GRANT ALL PRIVILEGES ON example_service.* TO 'example_service_user'@'locahost';
FLUSH PRIVILEGES;
EXIT;

Install PHP

Installing PHP is usually as simple as:

sudo apt install php

Python and Perl (the other two major ‘P’ languages) are likely already installed. If they are not, apt list will show the available packages apt knows how to install, and apt list | grep searchterm will show all packages containing “searchterm”.

Generally, the difficult part at this stage is not getting the language runtimes set up, but making sure that the (application-specific) libraries and things you need are all installed.

Service-specific modules you may need

phpBB3