How To Install LAMP on Ubuntu 14.04 [Quickstart]

Step 1: Update apt-get package lists

Step 2: Install Apache, MySQL, and PHP packages

When prompted, set and confirm a new password for the MySQL “root” user:

Step 3: Create MySQL database directory structure

Step 4: Run basic MySQL security script

At the prompt, enter the password you set for the MySQL root account:

MySQL root password prompt:

Enter current password for root (enter for none): OK, successfully used password, moving on…

At the next prompt, if you are happy with your current MySQL root password, type “n” for “no”:

MySQL root password prompt:

Change the root password? [Y/n] n

For the remaining prompts, simply hit the “ENTER” key to accept the default values.

Step 5: Configure Apache to prioritize PHP files (optional)

Open Apache’s dir.conf file in a text editor:

Edit the DirectoryIndex directive by moving index.php to the first item in the list, so it looks like this:

Save and exit.

Restart Apache to put the change into place:

Open the PHP script in a web browser. Replace your_server_IP_address with your server’s public IP address: