UbuntuUbuntu Based

How To Install pgAdmin on Ubuntu 22.04 LTS

Install pgAdmin on Ubuntu 22.04

In this tutorial, we will show you how to install pgAdmin on Ubuntu 22.04 LTS. For those of you who didn’t know, pgAdmin is a most popular and feature-rich, and open-source PostgreSQL administration and development platform that runs on Linux, Unix, macOS, and Windows.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the pgAdmin4 on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install pgAdmin on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common apt-transport-https wget ca-certificates libpq5 gnupg2

Step 2. Installing pgAdmin on Ubuntu 22.04.

By default, the pgAdmin is not available on Ubuntu 22.04 base repository. Now run the following command below to add the pgAdmin repository to your Ubuntu system:

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'

Next, import the GPG key using the following command below:

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

After the repository is enabled, now install the latest version of pgAdmin using the below command:

sudo apt update
sudo apt install pgadmin4

For additional resources on installing PostgreSQL, read the post below:

Step 3. Configure Apache Web Server for pgAdmin.

Now we initiate Apache web server configuration using the following command below:

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

Output:

Setting up pgAdmin 4 in web mode on a Debian based 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: ngadimin@idroot.us
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 and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4

When the above script runs, enter email and password that you will use to log in into your dashboard.

Step 4. Configure Firewall.

Now we set up an Uncomplicated Firewall (UFW) with Apache to allow public access on default web ports for HTTP and HTTPS:

sudo ufw allow OpenSSH
sudo ufw allow 'Apache Full'
sudo ufw enable

Step 5. Accessing pgAdmin Web Interface.

Once successfully installed, open your web browser and access the pgAdmin Web UI using the URL http://your-IP-addresss/pgadmin4. You will be redirected to the following page:

Install pgAdmin on Ubuntu 22.04 LTS Jammy Jellyfish

Congratulations! You have successfully installed pgAdmin. Thanks for using this tutorial for installing the pgAdmin4 on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official pgAdmin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button