In this tutorial we will explain how you can get a LAMP (Linux, Apache, MySQL and PHP) environment by following a few simple steps. In addition, we will also show you how to install PhpMyAdmin so that you can configure and manage your databases directly from your web browser.
"LAMP" is the acronym formed from the following words "Linux", "Apache", "MySQL" and "PHP".
Specifically, each of these initials refers to a technology that allows you to host and run web applications. Here are the details:
The LAMP environment or "LAMP Stack " is possibly one of the most popular technology combinations used by web applications such as WordPress and PrestaShop.
In order to have our LAMP environment (essential requirement to install web applications that require these technologies) it will be necessary to have a Cloud server with Linux. We recommend "Debian" or "Ubuntu" distributions.
Once our Linux server is deployed, we will already have the first technology of this environment. Next we will see how to install the rest: Apache, MySQL and PHP.
info From now on, this manual will assume that you have knowledge about SSH, about how to execute commands from the terminal in Linux and that you are using the "Ubuntu 18.04" distribution. Other systems may have variations, especially CentOS or RedHat.
First of all, it is advisable to ensure that all the operating system packages are up to date. To do this, run the following command with superuser permissions:
apt-get update && apt-get upgrade
During the upgrade process, it is possible that user intervention may be requested. This will depend on the packages taht being upgraded and the response will depend on each circumstance. In most cases you will be able to opt for the default configuration.
Installing apache is simple and only requires the following command:
apt-get install apache2
In case we are asked for any kind of confirmation, we simply need to confirm by pressing Y
and then space
.
The above command will install and configure the Apache web server with the default parameters.
At this point it is important to note that we will want to install the MySQL server. That is to say, the program in charge of managing and serving the databases. Likewise, we must also emphasize that throughout this manual we have been talking about "MySQL ". The latest version of Ubuntu actually uses the database management system "MariaDB ". However, this difference is transparent and harmless to the user in terms of this manual and 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.
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 PHP version to be installed is 7.2.
Following the previous steps we will already have a LAMP environment, although it may be necessary to make some kind of configuration or adjustments to 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 whole manual, as it requires user intervention. Please read the following steps carefully:
apt-get install phpmyadmin
info Read the instructions carefully. It is easy to make a mistake at this step and you may not complete the installation of PhpMyAdmin properly.
Next, you will need to choose which server you want PhpMyAdmin to use. You should check the apache2
option by pressing the space key
.
It is important that the box to the left of the word apache2
is marked with an asterisk: *
.
Once you have checked the box, press the tab key
to highlight the <OK>
button and finally, confirm your selection by pressing the ENTER key
.
Next, the installer will give you the option to activate the configuration and install your own PhpMyAdmin database with the default settings. Unless you are experienced with PhpMyAdmin we recommend that you choose this option.
Confirm the option by pressing Enter Key
on the <YES>
option.
Finally, you must define a password that will be assigned to the administrator user. Remember that it is recommended that this password contains at least 10 characters, including numbers, lowercase letters, uppercase letters and symbols. Since this is a web app, you should choose a strong enough password to avoid unauthorized access.
Finally, open a web browser and go to the following URL:
http://<ip-of-your-server>/phpmyadmin
If you have followed the configuration steps correctly, you should see the PhpMyAdmin welcome screen. To finish, you just need 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 need to make additional adjustments and configurations specific to the characteristics of your project. For example, the configuration of the Apache Virtual Hosts.