Skip to content

Set Up a LAMP Stack on a Linux Server – Run Classic PHP Applications

Learn how to efficiently set up a LAMP stack for hosting dynamic PHP websites on a Linux VPS → Find out more

12 November 20267 min read14 Views0 helpful

Introduction

The LAMP stack is a popular collection of open-source software components configured together to make hosting dynamic websites easy—with a particular focus on PHP websites and apps. The acronym stands for: Linux as the operating system, Apache as the web server, MySQL as the database, and PHP for processing. In this guide, we’ll show you how to set up a LAMP stack on a Linux VPS, including a detailed step-by-step explanation and an example of a to-do list website.

Preparation

First, connect to your server via SSH. If you’re not sure how to do this, check out our Initial Access (SSH) guide.

In this guide, we use Ubuntu as the Linux distribution. The commands are identical on Debian and similar on other distributions, but the syntax may differ slightly. Make sure an operating system is installed and that you’re connected via SSH.

As always, update all packages before installation with the following command:

Code
// Ubuntu & Debian
sudo apt update

// CentOS
sudo yum update

// OpenSUSE
sudo zypper up

// Fedora
sudo dnf upgrade --refresh

Conclusion

Congratulations, you’ve successfully installed and configured the LAMP stack! As a next step, we strongly recommend setting up a domain and an SSL certificate so your website can be accessed securely. See our Certbot Guide, which focuses on the Apache plugin, and follow the interactive setup to quickly get a certificate for your domain.

If you have any questions or run into problems, our support team is here to help every day! 🙂

FAQ

Frequently asked questions

Linux as the operating system, Apache as the web server, MySQL as the database, and PHP for processing—a popular combination for hosting dynamic PHP websites.
LAMP uses Apache as its web server, while LEMP uses Nginx (Engine X). The rest of the stack (Linux, MySQL, and PHP) is the same.
Run sudo apt install apache2. Then make sure port 80 (HTTP) is open in your firewall.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.