Saucepan

How to guides and technology tutorials for Amazon AWS, Google Cloud, Linux, macOS, Windows, and other systems

How to setup a LAMP stack on CentOS

Published: 22 January 2017
Filed Under: CentOS

A LAMP stack is an acronym for Linux (CentOS), Apache, MySql (MariaDB), and PHP. This guide assumes you have CentOS already installed and you have connected to the server as a non-root user.

Install the Apache web server

Install Apache through the CentOS package manager, yum. We'll then start the Apache service as well as enable it to automatically start when the system boots.

sudo yum install httpd
sudo systemctl enable httpd
sudo systemctl start httpd

Modify firewall settings

Configure the firewall to allow connections to http and https:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Install MariaDB

Install PHP

Restart Apache

Reboot Apache to make sure it loads all the new configuration and modules.

sudo systemctl restart httpd