How To Install Pgadmin 4 On Ubuntu 20.04 LTS Linux – Linux Shout | Hot Mobile Press

Learn the commands to install pgAdmin 4 – PostgreSQL Tools on Ubuntu 20.04 LTS Focal Fossa Linux to manage databases from a web-based GUI.

Just like the popular phpMyAdmin for graphically managing MySQL or MariaDB databases, here we have it pgAdmin. It is also free, open-source software that provides a graphical interface for PostgreSQL database developers and administrators. The pgAdmin open source license is inherited from the PostgreSQL project. pgAdmin runs on Windows, Linux, macOS and other Unix derivatives.

Unlike Linux, however, pgAdmin can be easily installed on Windows and macOS to manage remotely or locally running PostgreSQL.

pgAdmin supports the versions of PostgreSQL that are supported at the time of the release of a given version of pgAdmin (see PostgreSQL Versioning Policy).

Even for users not involved in database development, the pgAdmin is still a must-have software for those using PostgreSQL. For example, if you want direct access to the created databases for checking or troubleshooting; for backing up and restoring databases and can even delete databases that are no longer used.

Well, this pgAdmin offers two types of installation, one is desktop deployment and the other is server deployment.

Server Provisioning: With this installation method, pgAdmin is installed as a web application on a command line server using a web server, so that one or more users can access it simultaneously via a web browser. Credentials are of course required for security reasons.

Desktop Deployment: This type of installation is like any other software that is installed locally on the computer. This means you don’t need a browser to connect and access PostgreSQL, but are limited to just one user currently logged into the operating system. Again, the user needs a GUI running a supported operating system.

Well, installing pgAdmin as a central web application in the local network (server deployment) makes sense if you don’t want to limit it to just one PC. However, here we will show you both web and desktop installation for Ubuntu 20.04 Focal Fossa.

Steps to install PostgreSQL pgAdmin 4 on Ubuntu 20.04

The steps in this tutorial can also be used for other Ubuntu 20.04 Focal Fossa based Linux like Linux Mint, Elementary OS, POP_OS and more…

1. Add the pgAdmin 4 repository

Although pgAdmin is an open-source application, we cannot install it using the Ubuntu default system repository because it is not available there. To get it we need to manually add the officially released repo from the developers of this tool on our system. Here’s the command to do it.

sudo sh -c 'echo "deb$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'

2. Add GPG public key

Next, our system needs to ensure that the packages we receive to install pgAdmin 4 are from the original source as released by the developer without any modification. For this we need to add the GPG key on our system, which is used to sign the packages of this tool by its developers.

sudo curl | sudo apt-key add

3. Update Ubuntu 20.04

After completing the two steps above, we have prepared our system to install the latest version of pgAdmin. But before that, update the system to allow the system to rebuild the APT package manager’s package index cache.

sudo apt update && sudo apt upgrade

4. Install pgAdmin4 on Ubuntu 20.04 server

As we discussed at the beginning of this tutorial, pgAdmin can be used both as a desktop app and as a web application. So here we show you how to install both or one of them.

Those who want pgadmin4 desktop only app on Ubuntu Linux can use this command:

sudo apt install pgadmin4-desktop

Whereas those using Ubuntu Server and are required only the web-based interface from pgAdmin can use this:

sudo apt install pgadmin4-web

Well, there may be a scenario where you are using and want a GUI Ubuntu server or desktop both a pgAdmin desktop and a web app on a single system. If that’s the case, you can use:

sudo apt install pgadmin4

Here we are using Ubuntu 20.04 Server, so we opt for the web application of this PostgreSQL GUI tool.

5. Configure the pgAdmin user account

This step only applies to the web interface, ie if you have it installed pgadmin4-web Then run the given command to create a username and password for the pgAdmin user account. This is for security purposes, so that no arbitrary user can access pgAdmin’s web interface to manage the databases.

sudo /usr/pgadmin4/bin/

Enter the email address you want to use as your username and password. Once this is done, setup will prompt you to restart the Apache web server. Press Y and press the Enter button to restart it.

6. Access the pgAdmin web interface

Alternatively, if you have the desktop app installed, you can just go to the application launcher and search for pgAdmin there. However, users like us who have installed the web app of this tool need to open the browser on the system that can access the server IP address where you installed pgAdmin.

In the URL field, enter the following: http://your-server-ip-address/pgadmin4

Once you have received the web interface, use the username and password configured in the previous step of this tutorial to log in.

Access the PgAdmin web interface

7. Connect the PostgreSQL database

The next step is to connect the available local or remote PostgreSQL server to access it and manage it in pgAdmin through its graphical interface.

However, if you haven’t installed and configured PostgreSQL database for remote/local access yet, here is the tutorial about it: How to Install PostgreSQL Database on Ubuntu Linux.

Step 1.Click in your pgAdmin dashboard Add new server.

Add a new server in PgAdmin Ubuntu 20.04

Add new database server in pgAdmin 4

Step 2: Give a name to your server that you want to add in pgAdmin. It’s just for easy identification of the server, so you can use any name you like. After that click on “connection“Tab.

Name server PostgreSQL PgAdmin

Name server PostgreSQL server

step 3: In this step we will add the details of the local or remote PostgreSQL database server that we want to connect to. Add the server’s IP address. Leave the port and maintenance database values ​​unchanged. Next, in the Username, add the user of the database you want to access and in the Password field, add the password of your database user.

Finally click on the Save on computer Button. If all goes well you will have access to your remote database server.

Connection establishment pgadmin 4

Set up database connection

Here is pgAdmin’s dashboard once connected.

How to Install Pgadmin 4 on Ubuntu 20.04 LTS Linux

7. How to update

Here we used APT package manager and pgAdmin 4 official repository to install it on Ubuntu 20.04. So if you want to install the latest available compatible update on your system in the future. Just run:

sudo apt update && sudo apt upgrade

8. Remove or uninstall pgAdmin from Ubuntu 20.04

Anyone who no longer wants pgAdmin 4 on their Ubuntu 20.04 LTS server or desktop system can remove it. To do this, go to your command terminal and run the following command:

For desktop app only

sudo apt autoremove --purge pgadmin4-desktop

For web app onlythat we have installed here.

sudo apt autoremove --purge pgadmin4-web

Or you can remove it completely, regardless of the type of installation:

sudo apt autoremove --purge pgadmin4*

To remove the repository:

sudo rm -r /etc/apt/sources.list.d/pgadmin4.list

More articles:

How to install phpMyAdmin with Apache on Ubuntu 22.04 LTS
Install Postgresql 13 on AWS Ec2 Amazon Linux 2
Install PostgreSQL and pgAdmin in AlmaLinux / Rocky 8
Install Stremio Streaming App on Ubuntu 22.04 LTS Jammy

Leave a Comment