How to set up LAMP (Linux, Apache, MariaDB, PHP) stack on Debian Wheezy

how-to-set-up-lamp-linux-apache-mariadb-php-stack-on-debian-wheezyLAMP usually refers to a full featured stack containing the Apache web server, the popular database server MySQL and the well known web programming language – PHP, set up on a Linux Operating System.

But, as of lately we’ve seen a lot of open-source communities and some of the largest internet giants as Google switched to the use of MySQL’s open source drop-in replacement – the MariaDB database server, which is what are we going to install today instead of MySQL.

In the following step-by-step set up manual we will explain how to install a LAMP (Linux, Apache, MariaDB, PHP) stack on your Debian Wheezy VPS. Let’s begin:

First, we need to make sure the system is up-to-date:

# apt-get update

# apt-get upgrade -y

Now we can begin isntalling the necessary packages. We will start by installing the webserver:

# apt-get install apache2

add it to system startup and start it up:

# update-rc.d apache2 enable

# service apache2 start

Now, the Apache webserver is installed and started. Its default page is accessible at http://yourdomain.tld

Next, type the following command to install PHP5 along with the Apache PHP5 module and the MySQL php module:

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


# service apache2 restart

to restart the Apache service.

Test the php support by creating an index.php file inside the webserver’s default  document root – the  ‘/var/www/‘ – directory with the following contents:


After a successful verification that php is installed and working, in our next step we will add the required repository and after that install and configure the MariaDB database server.

# apt-get install python-software-properties
# apt-key adv –recv-keys –keyserver 0xcbcb082a1bb943db
# add-apt-repository ‘deb wheezy main’
# apt-get update
# apt-get install mariadb-server

Follow the on-screen instructions to set up a root password for the Mariadb server.

With all of these steps we have successfully installed a LAMP stack on your Wheezy server.

In order to provide easier access and managing of your Mariadb databases we will additionally install phpMyadmin:

# apt-get install phpmyadmin

and answer the questions as follows:

1. Web server to reconfigure automatically: answer ‘apache2’.
2. Configure database for phpmyadmin with dbconfig-common? – answer ‘NO’.

And that’s it. You have sucessfully installed a full LAMP stack with Mariadb and phpMyadmin. Now you can visit http://yourdomain.tld/phpmyadmin/ and login using ‘root‘ as username and the previously set root password.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


How to install Website Baker on a CentOS 7 VPS
Install CakePHP 3.0 on a CentOS VPS
How to install phpBB 3 on a CentOS 6 VPS
  • roman


    Author Reply

    You may add that the double dash in the apt-key got cribbled, confused me a bit.

    • admin


      Author Reply

      We updated the tutorial, thank you for your suggestion.