Skip to content

How to install and configure a LAMP stack on Linux

Linux

FAQ · Linux · Help & Support

08. Nov 2026 1 min

A LAMP stack consists of Linux, Apache, MySQL (or MariaDB) and PHP and is a widely used web server setup.

1. Connect to the server via SSH.

2. Install Apache with sudo apt install apache2.

3. Check that Apache is running by opening your server's IP address in a web browser.

4. Install the database: Debian does not include MySQL in its package sources, so use the compatible replacement MariaDB with sudo apt install mariadb-server and then secure the installation with sudo mariadb-secure-installation. On Ubuntu, MySQL is also available via sudo apt install mysql-server (secure it with sudo mysql_secure_installation).

5. Install PHP with sudo apt install php libapache2-mod-php.

6. Verify the PHP installation with php -v.

7. The libapache2-mod-php package enables the PHP module in Apache automatically, so no manual activation is needed. To let PHP access the database, also install sudo apt install php-mysql.

8. Use systemctl restart apache2 to apply the changes.

Still have questions?

Our support team is happy to help - via ticket, email, or phone.