In this tutorial, we will explain how you can get a LAMP environment (Linux, Apache, MySQL and PHP) following a few simple steps. In addition, we will also teach you how to install PhpMyAdmin so you can configure and manage your databases directly from the web browser.
"LAMP" is composed of the following acronyms of the words "Linux", "Apache", "MySQL" and "PHP".
In particular, each of these initials refers to a technology that allows hosting and running web applications. We detail it below:
The LAMP environment or "LAMP Stack" is possibly one of the most popular combinations of technologies and also used by web applications such as Wordpress and Prestashop.
In order to have our LAMP environment, indispensable requirement to install web applications that require these technologies, it will be necessary to have a Cloud server with Linux. We recommend the "Debian" or "Ubuntu" distributions.
Once our Linux server is deployed, we will already have the first technology in this environment. Next we will see how to install the rest: Apache, MySQL and PHP.
💡 Attention: From now on this manual will assume that you have knowledge about SSH, how to execute commands from the terminal in Linux and that you are using the distribution "Ubuntu 18.04". Other distributions may have variations. Especially distributions like CentOS or RedHat.
1. Update the operating system:
First, it will be advisable to ensure that all operating system packages are update. For this we will execute the following command with superuser permissions:
apt-get update && apt-get upgrade
During the update process, the user's intervention may be requested. It depends on which packages are updated and the answer will depend on each circumstance. In most cases, you can choose the default configuration.
2. Install Apache
Installing apache is simple and requires only the following command:
apt-get install apache2
In case we are asked for any type of confirmation, we should simply grant it by pressing "Y" and then space.
The previous command will install and configure the Apache web server with the default parameters.
3. Install MySQL
At this point, it is important to emphasize that we will want to install the MySQL server. That is, the program in charge of managing and serving the databases. We must also note that throughout this manual we talked about "MySQL" the latest version of Ubuntu, in fact, uses the database management system "MariaDB". This difference, however, is transparent and innocuous to the user of faces to this manual and to the installation or operation of the LAMP environment.
apt-get install mysql-server
Later, we will use the PhpMyAdmin application to finish configuring the databases and create an administrator user.
4. Install PHP
The PHP language can be installed in a very similar way to all previous installations:
apt-get install php
In Ubuntu 18.04 the default version that will be installed in PHP is 7.2.
Following the previous steps, we will already have a LAMP environment, although, maybe, it is necessary to make some configuration or adjustments of each of these components according to the requirements of our web application, project, etc.
Finally, we will proceed to the installation of PhpMyAdmin. It is a web application that will allow us to manage our databases directly from the browser, something that is practical and convenient.
The installation of PhpMyAdmin is possibly the most complex step of the entire manual since it requires the intervention of the user. Please read carefully the following steps:
1. Start installation
apt-get install phpmyadmin
2. Choose the web server
💡 Attention: Read the instructions carefully. It is easy to make mistakes in this step and not complete the installation of PhpMyAdmin properly.
Then you must choose which server you want PhpMyAdmin to use. You must check the option "apache2" by pressing the space key.
It is important that the box to the left of the word "apache2" be marked with an asterisk: "*".
Once you have checked the box, press the "tabulator" to highlight the "
3. Create the own PhpMyAdmin database
Then, the installer will give us the option to activate the default configuration and install the PhpMyAdmin database with the default parameters. Unless you have experience with PhpMyAdmin we recommend that you choose this option.
Confirm the option by pressing "Enter" on the option "
4. Define the password for the PhpMyAdmin admin user
Finally, you must define a password that will be assigned to the administrator user. Remember that it is recommended that this password contain at least 10 characters, including numbers, lowercase letters, uppercase letters and symbols. Being a web app, you must choose a password strong enough to avoid unauthorized access.
5. Make your first login to PhpMyAdmin
Finally, open a web browser and go to the following URL:
If you followed the configuration steps correctly, you should see the welcome screen of PhpMyAdmin. To finish, you just have to login with the following data:
If you have followed the steps in this manual, you will now have a fully functional LAMP environment, ready to install any application that requires this technology stack. Remember that you may have to make additional adjustments and configurations specific to the characteristics of your project. For example, the configuration of Apache Virtual Hosts.