Introduction

A LAMP server is a web server combination of Apache, MySQL, and PHP on Linux server. It is widely used for hosting PHP and MySQL based websites on the world wide web. This tutorial is created to help administrators to configure LAMP-based web hosting environment on Debian Jessie.

Advertisement

This tutorial helps you to step by step setup of LAMP Stack on a Debian 8 Jessie system.

Step 1 – Prerequisites

Login to your Debian system with a sudo privileged user or root user using ssh command. Windows users can either use putty or other alternatives.

ssh root@debian8

After login to your Debian system upgrade the current packages to the latest available version.

sudo apt-get update
sudo apt-get upgrade

Also, install packages on your system required for commands used in this tutorial.

sudo apt install ca-certificates apt-transport-https 

Step 2 – Install Apache2

Apache2 packages are available under default apt repositories. You can install Apache2 on a Debian 8 by running below command.

sudo apt-get install apache2

Step 3 – Install MySQL

MySQL server packages are also available in Debian 9 base repository. Run below command to install MySQL server for your LAMP setup.

sudo apt-get install mysql-server

Default repositories don’t contain latest packages. Use this tutorial to install latest MySQL server on Debian 8.

The installation process will prompt for the root user password.

Step 4 – Install PHP

The default Debian repository contained older PHP packages. To install the latest PHP versions enable the below PPA on your System, This provides the latest PHP packages for installation on Debian Linux.

wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo echo "deb https://packages.sury.org/php/ jessie main" | tee /etc/apt/sources.list.d/php.list

Now install PHP packages on your system. Also install some other required modules to work PHP with MySQL and Apache2.

apt update
sudo apt-get install php php-mysql libapache2-mod-php

Step 5 – Verify Setup

The LAMP installation on Debian 8 has been successfully completed. You can test your setup by creating phpinfo file on your server. Edit the below file in your favorite text editor.

vi /var/www/html/info.php

Add the below content.

Now access the info.php file in a web browser using your system IP address.

Share.

3 Comments

Leave A Reply


Exit mobile version