Meet 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 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.
Well, this pgAdmin provides 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 22.04 Jammy JellyFish.
Steps to install PostgreSQL pgAdmin 4 on Ubuntu 22.04
The steps in this tutorial can also be used for other Linux based ones like Debian, Linux Mint, Elementary OS, POP_OS and more…
1. Add GPG public key
Next, our system must ensure that the packages we receive to install pgAdmin 4 are from the source released by the developer without any modification. Therefore, to do this we need to add the GPG key on our system, which is 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 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. In order to get it, we need to manually add the officially released repo from the developers of this tool to our system. Here’s the command to do it.
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
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 22.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. To download pgAdmin for other operating systems, visit the official download page.
Those who want just the pgadmin4 desktop 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 22.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.
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:
Once you have received the web interface, use the username and password configured in the previous step of this tutorial to log in.
7. Connect pgadmin to Postgres database – Ubuntu
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. From your pgAdmin dashboard, click the Add new server.
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.
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.
Here is pgAdmin’s dashboard once connected.
7. How to update
Here we used APT package manager and pgAdmin 4 official repository to install it on Ubuntu 22.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 22.04
If you no longer want pgAdmin 4 on your Ubuntu 22.04 LTS server or desktop system, you 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
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