Build a LEMP stack (Linux, NGINX, MySQL, PHP) - Arch Linux

To build a dynamic web application, you need what has been coined a “stack” - which is developer lingo for an integrated set of software that has all of the components your application needs.

Most stacks have the same types of component, and differ mainly in which pieces of software they use for those components. For example, we’ll look at LEMP (which this article covers):

Component

LAMP Software

Operating system

Linux (e.g. Arch Linux)

Web server

NGINX (pronounced engine-x)

Database

MySQL

Programming language

PHP

If you're astute, maybe you noticed that LEMP is basically an acronym for the software the stack uses (LNMP is difficult to pronounce in English, so they used “E” for NGINX because of its pronunciation).

In this guide, we'll walk you through installing all of these components (except for Linux, which is already installed as your OS when you create the server).

Install MySQL

Run the pacman update to ensure your server is up-to-date on all of its packages:

sudo pacman -Syu

Install MySQL:

sudo pacman -S mysql

When prompted, choose the mariadb provider. MariaDB is the community-driven drop-in replacement for MySQL, and is functionally identical to MySQL.