Verified and Tested 09/05/15
In this How-To, we will walk you through installing LAMP on your Debian 8.2 Cloud Server. 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.
A server with Debian 8.2 installed. If you do not have a server already, you can spin up a virtual private 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:
An example of ifconfig showing the IP of 126.96.36.199
In our example, we would put http://188.8.131.52 in the address bar and get the following page:
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.
An example of the setting the MySQL password during install.
Secure MySQL from the default settings with the following command:
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:
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:
Insert the following code in the empty space then save and exit:
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:
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!