Install LAMP (Linux, Apache, MariaDB and PHP) in Ubuntu 15.10

LAMP stack is the combination of the most frequently used software packages to build dynamic websites. LAMP is an abbreviation that uses the first letter of each of the packages included in it: Linux, Apache, MariaDB, PHP.

Install LAMP on Ubuntu 15.10

Install LAMP on Ubuntu 15.10

You can use LAMP to build awesome websites with platforms such as WordPress or Joomla for example.

If you are PHP developer you can install LAMP on your computer and test your code locally. This doesn’t mean that LAMP cannot be used in production environments as well.

If you are looking for LEMP (Linux, Nginx, MariaDB and PHP) environment for your server or computer, you can go through below article.

Install LEMP Stack on Ubuntu 15.10

In this tutorial I am going to show you how to install and configure LAMP in Ubuntu 15.10. The guide assumes that you have already installed Ubuntu 15.10. If you have not installed already, you can refer to our guides here:


  1. Ubuntu 15.10 Desktop Installation Guide
  2. Ubuntu 15.10 Server Installation Guide
  3. Configure Static IP Address and DNS in Ubuntu 15.10

Step 1: Installing Apache Web Server

1. Now that you have the “L” in LAMP  it’s time to proceed to the “A” – Apache. It can be easily installed by running:

$ sudo apt-get install apache2

When asked to confirm the installation, press "y" followed by enter.

Install Apache in Ubuntu 15.10

Install Apache in Ubuntu 15.10

2. Once the installation is complete, you can test your installation by going to:

To find your IP address, you can use command such as:

$ ifconfig -a
Check IP Address Ubuntu 15.10

Check IP Address Ubuntu 15.10

3. Now copy/paste the IP address in your browser. You should see the following page:

Apache Default Page

Apache Default Page

4. The default location for website files (also know as document root) for Apache is:


The Apache configuration file is located at:


Step 2: Installing MariaDB Database

5. MariaDB is a relational database management system. It is a community fork of the probably better known MySQL database server. It is meant to remain free under the GNU/GPL. This is why it is now the preferred choice for relational database management system.

Installing it in Ubuntu 15.10 can be completed with:

$ sudo apt-get install mariadb-server mariadb-client
Install MariaDB in Ubuntu 15.10

Install MariaDB in Ubuntu 15.10

6. When the install is complete, you can start and the statu of MariaDB service with:

$ sudo service mysql start
$ sudo service mysql status
Start MySQ Database

Start MySQ Database

7. If you want to secure your MariaDB installation you will need to run:

$ sudo mysql_secure_installation
Secure MySQL Installation

Secure MySQL Installation

8. You will be asked to enter the current MariaDB root password. The default password is empty so you can simply press enter. After that you can enter the new root password (twice):

Set MySQL root Password

Set MySQL root Password

9. After that you can disable anonymous accounts for the MySQL service. It is strongly recommend that such accounts are disabled in production environment.

10. The next step in securing your MariaDB installation is to disable remote access to your databases from root user. This option should be disabled unless you have a good reason for using root. Instead, you can create privileged users later:

Remove MySQL Anonymous User

Remove MySQL Anonymous User

11. When installing MariaDB it creates a default “test” database, you can safely remove that when asked to:

Finally to make sure that the changes are saved, you will ned to reload the privileges:

Remove MySQL test Database

Remove MySQL test Database

You are done securing your your MariaDB configuration.

If you wish to modify the settings of your MariaDB server, you will need to edit the following file as root:


Step 3: Installing PHP Programming Language

12. The final step in our tutorial is completing the installation of PHP. It is an programming language used to developed dynamic websites. Larger part of the websites in the world wide web are built using this language. Many content management systems such as WordPress and Joomla are written in this language!

Installing PHP on Ubuntu 15.10 can be completed by running:

$ sudo apt-get install php5 libapache2-mod-php5
Insall PHP in Ubuntu 15.10

Install PHP in Ubuntu 15.10

13. You will now need to restart Apache so it can see the changes you just made and run PHP.

$ sudo service apache2 restart
Restart Apache Web Sever

Restart Apache Web Sever

14. Finally it’s time to test our settings. You can create a test PHP file which will show us the current PHP configuration. For that purpose create a file called info.php in:


For example you can use:

sudo vi /var/www/html/info.php

Insert the following code in the file:


15. Finally save the file by pressing Esc and “:wq“. Now to verify that your PHP code is properly executed, open:


You should see the following page:

Check Php Info

Check Php Info

If you need to change the PHP settings, you should edit the following file:


Remember that each time you change the PHP settings,  you will need to restart Apache so the changes can take effect. Apache can be restarted with:

$ sudo service apache2 restart

Thats it! You now have all the tools required to build a dynamic website, learn programming or create your own hosting server.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Marin Todorov

I am a bachelor in computer science and a Linux Foundation Certified System Administrator. Currently working as a Senior Technical support in the hosting industry. In my free time I like testing new software and inline skating.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

Got something to say? Join the discussion.

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.