How To Install LAMP Stack On Linux, Ubuntu, Debian, Mint, Fedora? – POFTUT

How To Install LAMP Stack On Linux, Ubuntu, Debian, Mint, Fedora?


LAMP stack is a popular term in the IT world. It is used to express multiple application packages to server PHP applications. Here is the formula Linux+Apache+MySQL+PHP=LAMP . LAMP stack can be created by installing these components one by one. In this tutorial, we assume that we have already installed the Linux distribution like Ubuntu, Debian, CentOS, Mint.

Installing Apache or Httpd

We will start by installing the Apache webserver. Apache is the most popular web server on the internet. Apache has a different name in rpm-based distributions which are httpd.

Install Apache for Debian, Ubuntu, Mint

We will use apt or interchangeble apt-get command for apache2 package installation.

$ sudo apt install apache2

Install Apache for CentOS, Fedora, RHEL

We will use dnf or yum command for httpd package installation. httpd is the name of Apache in rpm based distributions.

$ sudo dnf install httpd

Installing MySQL or MariaDB

MySQL or with its opensource version MariaDB is a database component of the LAMP. We can install it below.

Install MySQL for Debian, Ubuntu, Mint

We will install MySQL with the following command.

$ sudo yum install mysql-server

Install MySQL for CentOS, Fedora, RHEL

We will install mysql-server package.

$ sudo yum install mysql-server
Install MySQL for CentOS, Fedora, RHEL
Install MySQL for CentOS, Fedora, RHEL

Installing PHP

PHP is the programming part of the LAMP stack. Applications, CMS will run with PHP interpreter .

Install MySQL for Debian, Ubuntu, Mint

We will install PHP with a simple command.

$ sudo apt install php

Install MySQL for CentOS, Fedora, RHEL

We will install PHP package like below.

$ sudo yum install php
Install MySQL for CentOS, Fedora, RHEL
Install MySQL for CentOS, Fedora, RHEL

Configuring LAMP Stack

Now we have installed all components of the LAMP Stack. We can

LEARN MORE  How To Generate and Configure Htpasswd For Apache?

Start Apache Web Server

We will start Apache web server explicitly by running following service control command systemctl .

Debian, Ubuntu, Mint

$ sudo systemctl start httpd

CentOS, Fedora, RHEL

$ sudo systemctl start httpd

Check Apache Web Server Status

We can check Apache web server service status with the following command

Debian, Ubuntu, Mint

$ sudo systemctl status httpd

CentOS, Fedora, RHEL

$ systemctl status httpd
Check Apache Web Server Status
Check Apache Web Server Status

Leave a Comment