LAMP (Apache, MySQL, PhpMyAdmin) Install on Ubuntu 14.04

This guide will show you how to install a basic LAMP stack setup on Ubuntu 14.04. LAMP stands for Linux, Apache, MySQL, PhpMyAdmin and provides the basic tools needed to host web files on your server. There's also alternative web servers to use such as Nginx, but require additional configuration. Before starting it's best to have a secondary user that isn't the root user, but this will work with root regardless. When running 'sudo apt-get' commands it may ask for your root password.

Before we get started lets update the currently installed packages on the system.

sudo apt-get update

Now lets go ahead and install the web server, Apache2.
sudo apt-get install apache2
> Sample Output

Once you've installed Apache2 you can navigate to your server IP in your web browser (http://your_server_ip/) and the default Ubuntu web server page should appear.

Now we can install the MySQL server and the required PHP modules for Apache, and run the basic configuration for it.
sudo apt-get install mysql-server php5-mysql
Upon running the command above, you'll be required to enter a MySQL root password to continue with the installation.

Next we'll need to setup the MySQL system tables for the server to work properly. This is needed so the MySQL server can store its essential information such as structures, users, etc.
sudo mysql_install_db
> Sample Output

Next lets run the MySQL secure installation script. This will let you change your MySQL root password if you like, remove test database, and lock MySQL root access to local only.
sudo mysql_secure_installation
> Sample Output

Now we've installed the Apache web server and the MySQL server, we need to install the PHP modules for MySQL. After you've installed these restart your web server.
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo service apache2 restart

You can also install other PHP modules that you might need in the future with the 'apt-get install' command, such as 'apt-get install php5-gd'. We're only installing the required modules for this guide however.

Now everything is setup and working properly! Optionally you can setup PhpMyAdmin to help you manage your MySQL databases through your web browser.

To install PhpMyAdmin in Ubuntu 14.04 it's as simple as running a command.
sudo apt-get install phpmyadmin

A prompt will appear that asks you which web server you're using. Chose "apache2" by pressing the space bar over the selected option then press TAB and select OK. Now the installation will complete and bring you to another PhpMyAdmin installation prompt.
> Sample Output
Select Yes then enter your MySQL root password twice and press enter. Now the PhpMyAdmin installation will complete.

Now you should be able to use and access PhpMyAdmin by navigating to your server IP in your web browser and type /phpmyadmin after the end of the address (http://your_server_ip/phpmyadmin).

That's it!

If you have any questions regarding this guide or any others, don't hesitate to open a technical support ticket.