A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.
In this guide, we’ll get a LAMP stack installed on an Ubuntu 14.04 Droplet. Ubuntu will fulfill our first requirement: a Linux operating system.
Note: The LAMP stack can be installed automatically on your Droplet by adding this script to its User Data when launching it. Check out this tutorial to learn more about Droplet User Data.
Before you begin with this guide, you should have a separate, non-root user account set up on your server. You can learn how to do this by completing steps 1-4 in the
Step 1: Install Apache The Apache web server is currently the most popular web server in the world, which makes it a great default choice for hosting a website.
We can install Apache easily using Ubuntu’s package manager, apt. A package manager allows us to install most software pain-free from a repository maintained by Ubuntu. You can learn more about how to use apt here.
For our purposes, we can get started by typing these commands:
sudo apt-get update
sudo apt-get install -y apache2
sudo apt-get install -y php7.0-cli
sudo apt-get install -y php7.0-zip
sudo apt-get install -y php7.0-gd
sudo apt-get install -y php7.0-dom
sudo apt-get install -y php7.0-mysqli
sudo apt-get install -y php7.0-mbstring
sudo apt-get install -y php7.0-curl
We want to move the PHP index file highlighted above to the first position after the Directory Index specification, like this:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml inde$
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml inde$
then pres ctrl+x then Y+enter
sudo apt-get install apache2
sudo apt-get install -y mysql-server
Set root password? *******
sudo apt-get install -y phpmyadmin
sudo nano /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf (add This Line)
sudo /etc/ini.d/apache2 restart
sudo chmod 777 -R /var/www/html/
sudo chmod 777 -R /var/www/html/*
sudo nano /etc/apache2/mods-enabled/dir.conf
Test PHP and get details about your PHP installation
sudo nano /var/www/html/info.php
<?php phpinfo(); ?>
Ctrl+x press y enter