Ubuntu 14.04 LAMP setup.

Install Apache

apt-get install apache2

Test the install   http://   should look like:

Install MySQL

apt-get install mysql-server mysql-client

Enter the mysql root pword:

And again:

Verify the MySQL server status using command:

service mysql status

Install MariaDB (optional)

First you have to remove existing MySQL packages if any. To completely uninstall MySQL along with its configuration files, enter the following command:

apt-get purge mysql*

Run the following command to remove unwanted packages.

apt-get autoremove

Run the following commands to add PPA. Hence, MariaDB 5.5 repository is not yet updated to 14.04, we can use the repository of Ubuntu 13.10 instead.

apt-get install software-properties-common

apt-key adv –recv-keys –keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db

add-apt-repository ‘deb http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/5.5/ubuntu saucy main’

Update the source lists

apt-get update 

Finally, install MariaDB

apt-get install mariadb-server mariadb-client

Enter the root pword

And again:

Check all is good:

service mysql status

Install PHP

apt-get install php5 php5-mysql libapache2-mod-php5

Create a sample “info.php” file in Apache document root folder.
nano /var/www/html/testphp.php  and enter:

Now restart apache to take note of php

service apache2 restart

Now navigate to the file you just created https:///info.php

If you want to install all php modules, enter the command sudo apt-get install php* and restart the apache2 service. To verify the modules, open web browser and navigate to http://server-ip-address/testphp.php. You will able to see all installed php modules.

Manage MySQL Databases (Optional)

A free open-source web interface tool used to manage your MySQL databases: phpMyAdmin. It is available in the Official Debian repositories. So install it with command:

apt-get install phpmyadmin

Select apache:

Select yes

Enter the mysql root password

Enter MySQL application password phpmyadmin.

And again

Access phpmyadmin  http:///phpmyadmin   which should result in:


If you cannot access phpmyadmin from the above path, you might need to add the phpmyadmin config to the apache conf file:

nano /etc/apache2/apache2.conf

Scroll to the end of the file and add and save:

Include /etc/phpmyadmin/apache.conf

Restart apache:

service apache2 restart

 Use the root pword to get in. Which should then look like:

Phpmyadmin security

As a precaution it is best to change the default path to phpmyadmin:
nano /etc/phpmyadmin/apache.conf

The first line should read: 

Alias /phpmyadmin /usr/share/phpmyadmin

Change the “phpmyadmin” bit to something secret:

Alias /somethingsecret /usr/share/phpmyadmin

Leave a Reply

Your email address will not be published. Required fields are marked *