Ubuntu – II – LAMP server


A LAMP server is a set of software for Web sites. Consists of an Apache Server, MySQL database and PHP interpreter for dynamic Web pages. (Linux Apache MySQL PHP). In our case we will replace MySQL for MariaDB, both similar and compatible.



Introduction to Apache

Apache is an open source web server and the most popular currently, its function is basically show static Web pages. Possibly some will think that he wants a dynamic web server, i.e., it to interact with the server, later when you install PHP will succeed.

The Apache server is modular and can be configured according to our needs, then we will go “tuneando” and adapting the Apache to our needs, it will be one of the most important parts of our server.

Installing Apache

Installation of Apache is as simple as running the following command on our Ubuntu.

sudo apt-get install apache2

Remember “sudo” is used to run the command as an administrator for what subsequently ask the root key.

During the installation type can give certain messages if you want to install the selected package, we give Yes to everything.


Once the installation is finished check that Apache Server is functioning correctly. To do so we introduce in our browser the IP of our Ubuntu machine.

We must show the following web:

Apache page
Apache testing

Apache installed correctly.



Introduction MariaDB

A database is an optimized software to manage large amounts of information and MariaDB performs this function, it is a free system exist multitude of database owners or with free licenses, later we will use others to compare them or because requires it any packages that you install.

MariaDB is a relational database, this means, that the data are associated as if it were a worksheet, there are other databases like MongoDB that stores data which may have no relationship between them.

The reason why we use MariaDB instead of MySQL is because both are compatible but MariaDB is a licensed GPL which is on the other hand free for many programmers seem to be faster and with more features. We have not conducted a performance test and us fiaremos what they say the blogs and forums, in any case are fully supported, so will work us with our WordPress.

Installation MariaDB

Equal that with Apache install MariaDB with a command of Linux, to these altuars you’ve noticed that apt-get install is the command that is used to install new components.

sudo apt-get- and install mariadb-server mariadb-client

During the installation will ask us again the root key and if you really want to add the requested packages.

Then we have to introduce the database root user key. It may be the same as in Linux though security issues should be different, in our case to be a testing server not complicaremos us.

Key MariaDB
Key MariaDB

We must then add a couple of more for proper management and secure database commands.

sudo mysql_install_db
sudo mysql_secure_installation

The first is used to create the tables needed for MariaDB and the second for a more secure installation, and is this where we will pay special attention, as we have several options.

  1. It will first ask you the root password to continue.
  2. Then you have to add n, then it asks if you want to change it.
  3. Delete anonymous users and.
  4. Disable user remote root, in my case I put n, but it is a public servant put and.
  5. Do not delete the access to the test.
  6. Reload the privilege of tables, also not.




PHP is one of the most widespread languages for web programming, is used for dynamic web pages, i.e. pages that interact with the customer. Is a language with many community and with various frameworks like Symfony, Laravel or CakePHP. You have access to databases, it is a little old and there are more options for web programming, but its large community has made that there are a large number of CMS that are among the most used pages for websites, blogs and online stores.


First, we install PHP using the following command.

sudo apt-get install libapache2-mod-php5 php5 php5-mcrypt

Apache configuration

Once installed PHP will give priority to the displayed web, is usually index.html we want be index.php. With sudo nano, edit the Apache configuration file.

sudo nano /etc/apache2/mods-enabled/dir.conf

We will then find something like this, which indicates the order of the file search.

<IfModule mod_dir.c=""></IfModule>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

It should be:

<IfModule mod_dir.c=""></IfModule>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

This way when you enter the url (the ip of the machine) will show us first index.php, there is no sample index.html.

Restart Apache.

sudo service apache2 restart


Finally, we note that really works our PHP. To do this, we will create an index.php file.

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

And we will only edit with the following text.

phpinfo ();

You should see an image like this:


Installation of PHP modules

Finally just to mention that you can install more modules with new features for PHP with:

apt-cache show package

To know that packages of PHP there will use:

apt-cache search php5-




Previous  Index Following

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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