pgAdmin is the leading graphical Open Source management, development and administration tool for PostgreSQL. pgAdmin4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL database.
In this tutorial, we are going to show you how to install pgAdmin4 in Server Mode as a web application using apache2 and Wsgi module on Ubuntu 20.04 LTS.
Install pgAdmin4 on Ubuntu 20.04
01- first, let’s import the pgAdmin4 key by running the below command:
$ curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
02-To install pgAdmin4 on Ubuntu 20.04 we need to add an external repository, so execute the following command:
$ sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
03- After we add the pgAdmin4 repository, let’s use the below command to install pgAdmin4 as server mode:
$ sudo apt install pgadmin4-web
04- Once we done installing pgAdmin4, we need to configure the pgAdmin4 by setting up the intial pgAdmin user account and the Apache Web server as below:
$ sudo /usr/pgadmin4/bin/setup-web.sh Setting up pgAdmin 4 in web mode on a Debian platform... Creating configuration database... NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: [email protected] Password: Retype password: pgAdmin 4 - Application Initialisation ====================================== Creating storage and log directories... We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? y The Apache web server is running. A restart is required for the pgAdmin 4 installation to complete. Would you like to continue (y/n)? y Apache successfully restarted. You can now start using pgAdmin 4 in web mode
05- To verify the pgAdmin4 has been installed successfully, open your web browser and go to the following address:
sudo ufw allow http
Now, enter the email address and password you created during the installation and you will see the following screen:
You have successfully installed pgAdmin4 on your Ubuntu 20.04 LTS machine. You might want to check the following guides: