In this article, we will have explained the necessary steps to install and configure pgAdmin4 on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
- Operating System with Ubuntu 20.04
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with APT Commands
Install pgAdmin4 on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install curl ca-certificates gnupg
Step 2. Install PostgreSQL on Ubuntu.
Run the following commands to install the PostgreSQL server on Ubuntu:
sudo apt install postgresql postgresql-contrib
Once the installation is completed, the PostgreSQL service will start automatically. To check the Postgres version and confirm installation run the following psql command:
sudo -u postgres psql -c "SELECT version();"
Step 3. Install pgAdmin on Ubuntu.
First, add pgAdmin4 Key and Repository for Ubuntu 20.04:
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Then, add the pgAdmin4 repository:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
Now Install pgAdmin4 packages with additional packages for the Apache UwsGI application using the apt command:
sudo apt install pgadmin4 pgadmin4-common pgadmin4-apache2
Step 4. Setup PostgreSQL Authentication.
Log in to the PostgreSQL shell using the ‘psql’ command below:
sudo -i -u postgres psql
Now change the password for the ‘postgres’ user using the following query:
Step 5. Accessing pgAdmin 4.
Open your web browser and type the server IP address following by the ‘pgadmin4’ path URL:
On the pgAdmin4 login page, type your email address and password, then click the ‘Login‘ button.
That’s all you need to do to install pgAdmin4 on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. Don’t forget to share your valuable queries/suggestions in the below comment box & also drop your worthwhile feedback.