How to

Install pgAdmin4 on Ubuntu 20.04 LTS

pgAdmin4 is a GUI application for managing PostgreSQL databases graphically. It is a very powerful tool for managing Postgres databases written in python along with the flask framework. In this tutorial, we will learn how to Install pgAdmin4 on ubuntu 20.04 LTS.

Prerequisites

  • An Ubuntu 20.04 LTS machine with a not root sudo user
  • PostgreSQL server installation
  • A PostgreSQL database, role, and password

Install pgAdmin4 on Ubuntu 20.04 LTS

$ python3 --version

If python is not installed already then install first. You can install Python latest version by following this guide. Then continue to the next step.

$ sudo apt-get install python3-dev
$ sudo mkdir /var/lib/pgadmin
$ sudo mkdir /var/log/pgadmin
$ sudo chown $USER /var/lib/pgadmin
$ sudo chown $USER /var/log/pgadmin

Now go the directory (cd) where you want to install pgAdmin4. Actually we will create a python virtualenvironment. And we will install pgAdmin inside the virtual environment.

$ python3 -m venv pgadmin4 
$ source pgadmin4/bin/activate
(pgadmin4) $ pip install pgadmin4
(pgadmin4) $ pgadmin4

After running pgAdmin4, inside your terminal you will be asked to input your user account information (email address and password). Enter the information. The pgAdmin4 local server will be started. You should see something like the below:

Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in
your browser.  * Serving Flask app "pgadmin" (lazy loading)  *
Environment: production    WARNING: Do not use the development
server in a production environment.
Use a production WSGI server instead.  *
Debug mode: off

Now open up your browser, and browse http://127.0.0.1:5050. Now open the credentials to login. Now you can manage your PostgreSQL database.

Further Readings

Posted in