Install LAMP On Ubuntu 15.04

Like in older version of Installing LAMP on Ubuntu 13.xx 14.xx there aren’t any major changes (except if you are using MySQL instead of MariaDB, in that case you change one keyword 🙂 and ofcourse our lovely systemd ) anyway, I will demonstrate the commands and procedures you need to  Install LAMP Stack On Ubuntu 15.04 .

As stated before, LAMP is acronym for Linux Apache MySQL and PHP. Now in our days it’s also MariaDB instead of MySQL or LAMPP, meaning Linux Apache MariaDB(MySQL) Php and PhpMyAdmin. Let’s begin.

Install LAMP On Ubuntu 15.04

1. Install Apache

Apache httpd is our web server. It provides a full range of web server capabilities including CGI, SSL and virtual domains.

To install Apache, type:

or exclude sudo if your are already root, but really it doesn’t matter a lot.

Testing Apache:

Open your web browser and navigate to http://localhost/ or http://server-ip-address/. You don’t know your local IP address because of dhcp ?

Try ifconfig or ip addr


2. Install MySQL

MySQL is our relational database management system (RDBMS). There are also other choices like PostgeSQL, Firebird, Percona, but here we deal with the ..famous one, Mysql (and MariaDB eventually)

During installation, you’ll be asked to setup the MySQL “root” user password. Enter two times a root password and it will be OK. Care, it’s not your system’s root password, it’s MySQL’s admin password. No need for the same password.

You can verify the MySQL server status using command:

On Ubuntu 15.04:

On Ubuntu 14.10 and previous versions:

Sample output:

3. Install MariaDB

In case you want to use MariaDB instead of MySQL community edition, follow the steps below.

MariaDB is a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements.

First you have to remove existing MySQL packages. To completely uninstall MySQL along with its configuration files, enter the following commands one by one:

After removing MySQL, run the following command to install MariaDB.

Alternatively, you can install it using MariaDB repository if you want to try most recent version of MariaDB. Run the following commands to add PPA. As of writing this, MariaDB PPA is not yet updated to Ubuntu 15.04. However, we can use the repository of Ubuntu 14.10 instead.

Update the software sources list and install MariaDB using following commands:

During installation you will be asked to set mysql ‘root’ user password. Enter the password twice, and complete the installation.

Note: In Ubuntu 15.04, MariaDB won’t ask you to set root user password during installation.

Also, you can’t set password using command:

It will throw the following error.

To fix this error, log in to mysql prompt without password as root user:

Then, run the following commands one by one in the mysql prompt:

That’s it. Now, set database administrative “root” user password using command. Press Enter and go with the default settings.

Check if mariadb is running or not, using the following command:


4. Install PHP

PHP (acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:

To test PHP, create a sample “phpinfo.php” file in Apache document root folder.

Add the following lines.

Restart apache2 service.

On Ubuntu 15.04:

On Ubuntu 14.10 and lower versions:

Navigate to http://server-ip-address/phpinfo.php. It will display all the details about php such as version, build date, modules used, paths and commands etc.

5. Manage MySQL Databases (Optional)

Install phpMyAdmin

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

Select the Web server that should be automatically configured to run phpMyAdmin. In my case, it is apache2.

Additional Note: if you followed all steps carefully, phpMyAdmin should work just fine. In case phpMyAdmin is not working, please do the following steps.

Open terminal, and type:

Add the following line at the end.

Save and Exit. Restart apache service:

On Ubuntu 15.04:

On Ubuntu 14.10 and lower versions:

6. Access phpMyAdmin Web Console

Now, you can access the phpmyadmin console by navigating to http://server-ip-address/phpmyadmin/ from your browser.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.