LAMP (Linux, Apache, MySQL and PHP). This has been a winning combination for decades, and is widely used even today. These provide for all the required layers for a high performing full stack web application. It is good to have LAMP server ready on your OS, for rapid prototyping and for running common utilities.

The installation process requires independent steps for installing each of these components.


The Apache HTTP Server is simple to install. It is available in the Metapackage apache2. So it can be installed directly using the apt command.

This installs and starts the httpd service — that listens on the port 80, for http requests. You can configure this further using the config file — that is well documented and intuitive.

Now, to verify the installation and service, use the below command

This should be enough if you are working on an isolated machine that hosts the LAMP server along with your development tools. Then you would be running the web app on localhost. That is enough to start. But, if you are working in a team or working on a remote machine that connects to the hosting server, then you also need to ensure that the installation has opened up the firewall for the required ports.

The installation process should have opened the port 80 and 443 for the apache http server. You can check more detail using this command

After ensuring that the ports are opened, try to hit the URL from a browser. — or the URL of the machine where the server is installed. It should show the Apache2 Ubuntu Default Page


Next in line is the MySQL DB. Installing the MySQL is straightforward. Just pull it up using the apt.

The installation process will ask you several questions including the root password. You are allowed to leave it blank, but always advised to set a strong password for any database.


PHP has been one of the popular scripting languages on the web. For years, we have seen websites developed in PHP. And the numbers continue to grow. PHP interpreter can be installed very easily using the apt command.

Along with the core PHP interpreter, you should also install some of the important and frequently used libraries.

Also install the PHP MyAdmin — a very useful utility to manage the MySQL database. You can install it using the below command:


Finally, restart the Apache HTTP Server so that it picks all the latest configurations.

Now we can check if things are really working, by accessing a PHP file. Create a new file in the path below:

This path (/var/www/html) is defined in the apache config file. You can change it if you want to.

Inside this file, add a small PHP script

Now, open the link in browser http://{base_url}/info.php. This should show you a colorful page with all the details about the PHP installation.

Congrats! You have successfully installed the LAMP server.