This is a fast and version that is clear of to build a working LAMP server to host your websites with it. As a refresh, LAMP stands for Linux, Apache, MySQL and PHP which in this guide we’ll replace it with MariaDB that is faster than traditional MySQL server. As what I can remember, I wrote about LAMP installation on CentOS 7 already but never write the thing that is same brand new Ubuntu variation that is now variation 15.04 codename Vivid Vervet. Therefore, continue reading!


  1. A host / VPS operating Ubuntu 15.04 that this guide i personally use its x86_64 variation from DigitalOcean.
  2. SSH customer software like Putty and appropriate knowledge to utilize the app.
  3. Some fundamental understanding of typical unix demand.
  4. A cup coffee or tea as constantly.

How to put in Apache 2

Step 1 – very first thing first, login towards host as root (i suppose you knew utilizing SSH Putty that is/). Like me, you will be asked to change default root password:

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 13

Step 2 – Update Ubuntu’s packages to latest version using this command:

apt-get update -y
 apt-get upgrade -y


Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 14

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 15

Step 3 – Now here’s the main command to install Apache 2 webserver on Ubuntu 15.04:

apt-get install apache2 -y

You’ll see something similar to this:

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 16

How to Install PHP 5

Step 1 – For the first step, you can start installing PHP5 and MySQL PHP modules using this command:

apt-get install php5 php5-mysql -y

the process will be done in few seconds if you are using a droplet from DO. Pic:

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 17

Step 2 – Install other PHP5 modules your software / script might need. There are many modules available and your app/script may need ones that are specific. But you’ll install many modules that are common apps usually need it. Here’s the command you can issue:

apt-get install php5-cgi php5-cli php5-common php5-curl php5-dev php5-gd php5-tidy php5-xmlrpc php5-xsl php5-mcrypt php5-imap php5-json that is php5-imagick php5-mcrypt libapache2-mod-php5 -y



Step 3 – That’s it. Now you can always check which PHP variation is set up by using this command that is magic*******)

php -v

In my example it is PHP 5.6.4


How to Install MariaDB Server

Step 1 – The command to install MariaDB is still the same which is:

apt-get install mariadb-server -y



Step 2 – Once the install process is finished, you have to firstly setup new root password to your MariaDB install (standard is blank). Problem this demand:


Simply strike Enter in your keyboard then answer next questions accordingly if asked with current password. Do not forget to create password that is new keep in mind it (it’s your database password for individual root).

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 18

Guide to put in Apache, MariaDB, PHP on Ubuntu 15.04 VPS 19

Step 3 – Now login to MariaDB to check your newly produced root password:

mysql -u root -p

enter your MySQL root password


(it is MariaDB v10.0.17 which is equivalent to MySQL 5.6 & 5.7

Finally, do not forget to restart Apache 2 webserver:

service apache2 restart

that’s it*****)As you can see from the pic above. You can now start hosting your websites / blogs in it(web directory):

mkdir -p /var/www/
 on it which shortly can be done this way:

How to Host A Website on Ubuntu LAMP Server

Step 1 – Create the directory where you put all your site’s files; mkdir /var/www/

the production just appears like this:


Step 2 – you can store all files including scripts and medias of your website so you have now a directory where. What’s next to do is to make sure Apache will know where to access when a domain name is called. Hence, you have to create a new hosts that are virtual, a configuration block of Apache for every single of one’s domain / sub-domain.

nano /etc/apache2/sites-available/

The demand informs nano editor generate a file that is new Do not forget to change every in this tutorial with your domain that is own title. Additionally, you can install it easily with this command:

apt-get install nano -y

Step 3 – Now a blank editor page will show up if you have no Nano installed yet. Next, copy paste configuration below and adjust few lines accordingly:

<VirtualHost *:80> 
      ServerAdmin [email protected]
      DocumentRoot /var/www/
      ErrorLog /var/www/ 
      CustomLog /var/www/ combined
      <Directory /var/www/>
         Options Indexes FollowSymLinks
         AllowOverride All
         Order allow,deny
         allow from all

here’s an example:


Save it and exit Nano editor (Control+O then Control+X).

Step 4 – Reload Apache to be able to read a configuration that is new.

service apache2 reload

Step 5 – after that you can allow the digital Hosts (setup) file by using this demand:



You may then test that by producing a phpinfo file:

nano /var/www/

and place this line within:

<?php phpinfo(); ?>


Save it and leave Nano editor (Control+O then Control+X).

Open your web browser and kind:

then you certainly will now see a number of setup information on your set up PHP.

Step 6 – this is certainly optional you might need it if you use WordPress:

chown www-data:www-data -R /var/www/
 chmod 755 /var/www/

That’s all. Don’t neglect to follow me personally on twitter to obtain faster notification of the latest change.

About The Author

How exactly to make use of the DOM Tree and Nodes

Previous article

How exactly to Benchmark a Website with Firefox, Siege, and Sproxy On Ubuntu 16.04

Next article

You may also like


Leave a Reply

More in Apache