Installing Linux, Apache, MySQL, PHP (LAMP) on Debian 8.2 Cloud Server or VPS

PHP7 Elephant created by Walker Cahall

PHP7 Elephant created by Walker Cahall

Verified and Tested 09/05/15

Introduction

In this How-To, we will walk you through installing LAMP on your  Debian 8.2 Cloud Server or VPS. LAMP is simply a software bundle that consists of 4 components. Linux is the base of the platform; all components are installed within the Linux environment. In this case, we will be using Debian 8.2 for the Linux OS. Apache will be used for the web service. MySQL will be used for database management,  and  PHP will be as the programming language. Altogether this forms LAMP, which is also called a LAMP Stack.

Prerequisites

A server with Debian 8.2 installed. If you do not have a server already, you can spin up a trusted and reliable cloud server in under 30 seconds.

Installing LAMP on Debian 8.2

We will first start by installing Apache. Apache is an open source web server and is the most popular web server in the world.

Installing Apache on Debian 8.2

Install Apache with the following command to begin the install:

apt-get install apache2

Verify if all is working by opening your browser and going to http://youripaddress

If you are unsure what your IP address is, run the following:

ifconfig
An example of ifconfig showing the IP of 192.68.0.2

An example of ifconfig showing the IP of 192.68.0.2

In our example, we would put http://192.68.0.2 in the address bar and get the following page:

Installing Linux, Apache, MySQL, PHP (LAMP) On Debian 8 On A Cloud Server Or VPS 04

An Example of the default Apache page on Debian 8

Installing MySQL on Debian 8.2

Install MySQL with the following command:

sudo apt-get install mysql-server php5-mysql

During the install, it will prompt you to enter a MySQL root password. Set any password that you would like.

Installing Linux, Apache, MySQL, PHP (LAMP) On Debian 8 On A Cloud Server Or VPS02

An example of the setting the MySQL password during install.

Secure MySQL from the default settings with the following command:

mysql_secure_installation

Note: You will be prompted with a series of questions. Simply type N for the change root password and Y for yes on all of them, see the screen shot below:

Installing Linux, Apache, MySQL, PHP (LAMP) On Debian 8 On A Cloud Server Or VPS 03

An example of the questions during mysql_secure_installation

Installing PHP on Debian 8.2

Install PHP with the following command to begin the install:

apt-get install php5

Create a test PHP file in the following directory with the following command:

nano /var/www/html/info.php

Insert the following code in the empty space then save and exit:

<?php
phpinfo();
?>

Restart Apache so all the changes take effect:

service apache2 restart

Test your page in your browser with the following hyperlink changed with your IP address:

http://youripaddress/info.php

Installing Linux, Apache, MySQL, PHP (LAMP) On Debian 8 On A Cloud Server Or VPS 05

An example of the php.info file that was created on Debian 8.2

Congratulations! You have just installed LAMP on your Debian 8 Server. Thank you for following along in this How-To, please check back for more updates or take a look at our Installing WordPress on Debian 8 How-To!

Try it out on our SSD Cloud Servers

Fast Cloud VPS Hosting – Up in 30 Seconds.

100% SSD – Easy to use and pay as you go!

Already have an account? Login
Avatar for Brendan Bonner

About Brendan Bonner

Brendan is currently a Senior Account Executive at Atlantic.Net while serving as the Community and Social Media Manger. He is also involved with special projects, including international Cloud deployments. Brendan's interests are Cloud, VPS, Linux, Windows and full stack development. He is also a Microsoft Certified Professional.
  • Nick Niceman

    You are posting OLD OUTDATED HACKABLE INSTALLATIONS.
    DO NOT TRUST THIS PERSON AS OPENSSL INSTALLABLE IS ONLY – 1.0.1k 8 Jan 2015.
    Which is hackable!!!

Stay Connected With Us