23.2 C
Senior Writer and partner

How to install LAPP (Apache + PHP + PostgreSQL) on Ubuntu 20.04

There are many combinations of programs and servers in Linux. Of all of them, the LAMP or LEMP stack is one of the most known and popular but some prefer PostgreSQL over MariaDB / MySQL. So, in this post, you will learn how to install the LAPP stack on Ubuntu 20.04

This stack also provides us with a functional server but with a different database manager like PostgreSQL. This database handler is maybe the most powerful in the world in open source. So it is normal that many want to make the change.

So, let’s start.

How to install LAPP on Ubuntu 20.04

1.- Install Apache web server on Ubuntu 20.04

The first step is to install the Apache webserver which is one of the most secure and reliable servers within Linux. Together with Nginx, they are one of the most popular in the world.

- Advertisement -

So, open a terminal or SSH session and run it:

sudo apt install apache2

Then, start the service and enable it to start with the system:

sudo systemctl start apache2
sudo systemctl enable apache2

Finally, you can open a web browser and go to the following address http://your-server or http://ip-server and you will see Apache’s default page.

Apache Default page on Ubuntu 20.04
Apache Default page on Ubuntu 20.04

This indicates that the installation has been successful.

2.- Install PHP on Ubuntu 20.04

Now the next component is PHP which is a very popular programming language in the web environment. Therefore, it must be installed along with some of its fundamental modules.

php7.4 libapache2-mod-php7.4 openssl php-imagick php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-pgsql php-ssh2 php7.4-xml php7.4-zip unzip

Now to prove that PHP and Apache are working properly, let’s make a test file.

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

And add the following content:

Save the changes and close the editor.

Then restart Apache:

sudo systemctl restart apache2

Then open it from your web browser, for example http://your-server/test.php

PHPinfo method
PHPinfo method

If you manage to see a page with the PHP information, then both are working correctly.

3.- Install PostgreSQL on Ubuntu 20.04

PostgreSQL is one of the most advanced and modern relational database managers out there. It is always shown as the immediate competitor of MySQL and MariaDB in the segment of open source and community database managers.

One of the main advantages of using PostgreSQL is that it has extensive documentation and supports powerful features. All this in an open-source and free application.

Installing PostgreSQL is quite simple and we explain it in detail in this post:

How to install PostgreSQL on Ubuntu 20.04?

And so you have the LAPP stack ready to work.


The LAMP stack is one of the popular and famous ones that exist but it is not the only one. Now we present you an alternative that changes to MySQL / MariaDB by PostgreSQL in a fast and easy way and forming the LAPP stack that is quite used too

Thanks for reading

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article