Install PostgreSQL pgAdmin 4 on Ubuntu 22.04 LTS Jammy Linux

Learn the commands to install  – the PostgreSQL GUI interface pgAdmin 4 tools on Ubuntu 22.04 LTS Jammy JellyFish Linux to manage Databases using a web-based graphical user interface.

Just like popular phpMyAdmin to graphically manage MySQL or MariaDB databases, here we have pgAdmin. It is also a free and open source software to provide a graphical interface to develop and administrators of PostgreSQL databases. The open source license of pgAdmin is inherited from the PostgreSQL project. pgAdmin runs on Windows, Linux, macOS, and other Unix derivatives.

However, unlike Linux, pgAdmin on Windows and macOS can easily be installed to manage remote or local running PostgreSQL.

Well, pgAdmin offers two types of installation one is Desktop Deployment and other Server Deployment.

Server Deployment: In this method of installation, the pgAdmin is installed as a web application with the help of a web server on a command line server, so that single or multiple users can access it simultaneously using a web browser. Of course, credentials are required for security.

Desktop Deployment: This type of installation is like any other software installed locally on the computer. This means you don’t require any browser to connect and access PostgreSQL but are limited to only one user who is currently logged on to the operating system. Also, for this, the user needs a GUI running a supported OS.

Well, installing pgAdmin as a central web application in the local network (server deployment) is useful if you don’t want to restrict it to only one PC.  However, here we show you both the installation of Web and Desktop for Ubuntu 22.04 Jammy JellyFish.

Steps to install PostgreSQL pgAdmin 4 on Ubuntu 22.04

The steps given in this tutorial can also be used for other Linux based such as Debian, Linux Mint, Elementary OS, POP_OS, and more…

1. Add Public GPG Key

Next, our system needs to ensure the packages we will receive to install the pgAdmin 4 are from the source as issued by the developer without any alteration. Therefore, for that, we have to add the GPG key on our system used to sign the packages of this tool by its developers.

curl -fsSL https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/pgadmin.gpg

 

2. Add pgAdmin 4 repository

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

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'

 

 

3. Update Ubuntu 22.04

Once you have performed the above two steps we have prepared our system to install the pgAdmin’s latest version. However, before that update the system to let the system rebuild the APT package manager’s package index cache.

sudo apt update && sudo apt upgrade

 

4. Install pgAdmin4 on Ubuntu 22.04 server

As we have discussed at the beginning of this tutorial, pgAdmin can be used as a Desktop app as well as a web application, hence, here we will show you how to install both or any one of the two. To download pgAdmin for other OS you can visit the official download page.

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

sudo apt install pgadmin4-desktop

Whereas, those who are using Ubuntu Server and required only the web-based interface of pgAdmin can use this one:

sudo apt install pgadmin4-web

Well, there may be a scenario in which you might be using a GUI Ubuntu server or desktop and want both a pgAdmin desktop as well as a web app on a single system. If that is the case then you can use:

sudo apt install pgadmin4

Here, we are using Ubuntu 22.04 Server, hence we are going for the Web Application of this PostgreSQL GUI tool.

 

5. Configure the pgAdmin user account

This step is only for the Web interface, which means if you have 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 any random user won’t be able to access the pgAdmin’s web interface to manage the databases.

sudo /usr/pgadmin4/bin/setup-web.sh

Enter the email address that you want to use as a Username and password for the same. Once done, the setup will ask you to restart the Apache web server. Press Y and hit the Enter key to restart it.

Configure the pgAdmin Ubuntu 22.04

 

6. Access pgAdmin Web Interface

Alternatively, if you have installed the Desktop app, then you can simply go to Application launcher and there search for pgAdmin. 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 have installed the pgAdmin.

In the URL box type: http://your-server-ip-address/pgadmin4

As you received the Web interface, use the username and password configured in the previous step of this tutorial to log in.

Login PgAdmin user account

 

7. Connect pgAdmin to Postgres Database – Ubuntu

The next step is to connect the available local or remotely installed PostgreSQL server to access and manage the same in pgAdmin using its Graphical interface.

However, if you have not yet installed and configured a PostgreSQL Database to access remotely/locally, then here is the tutorial on that: How to install PostgreSQL Database on Ubuntu Linux.

Step 1. On your pgAdmin Dashboard, click on the Add New Server.

Add New server pgAdmin ubuntu 22.04

Step 2: Give some name to your Server that you want to add in the pgAdmin. It is just to easily identify the server, hence you can give whatever name you would like to. After that click on the “Connection” Tab.

Register a New PostreSQL server

Step 3: In this step, we will add the details of the local or remote PostgreSQL Database server we want to connect to. Add the IP address of the server. Leave the Port and Maintenance database values as they are. Next, in the username add the user of the database you want to access, and in the Password box, the password of your Database user.

Finally, click on the Save button. If everything goes well you will have access to your remote database server.

Manage Remote PostgreSQL server

Here is the Dashboard of pgAdmin once you get connected.

Install pgAdmin and PostgreSQL on Ubuntu 22.04

 

7. How to Update

Here we have used the APT package manager and official repository of pgAdmin 4 to install it on Ubuntu 22.04. Hence, in the future, if you want to install the latest compatible update available for it on your system. Simply run:

sudo apt update && sudo apt upgrade

 

8. Remove or Uninstall pgAdmin from Ubuntu 22.04

Those who don’t want pgAdmin 4 on their Ubuntu 22.04 LTS server or desktop system anymore can remove it. For that go to your command terminal and run the following command:

For only Desktop App

sudo apt autoremove --purge pgadmin4-desktop

For only Web App, the one we installed here.

sudo apt autoremove --purge pgadmin4-web

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

sudo apt autoremove --purge pgadmin4*

Also, to remove the repository:

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

 

Other 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.