Cyberithub

How to Install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa)

Advertisements

In this article, we will see how to install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa). pgAdmin is the most popular, free and open source PostgreSQL database administration and development tool used by many of the database professionals across the globe. It can be deployed and used in three different modes - server, desktop and web mode. This GUI based tool provides rich set of features that not only simplifies the connection to the database but also makes querying and searching database objects easier.

It can be easily installed and used on all the famous systems such as Linux, Unix, macOS and Windows to manage PostgreSQL and EDB Advanced Server 10 and above. More on official website. Here we will see the steps to install pgAdmin 4 on Ubuntu 20.04 LTS based systems.

 

Key Features

  • It has powerful query tool with colour syntax highlighting support
  • It has fast datagrid for display/entry of data
  • It has graphical query plan display
  • It also has Grant Wizard for rapid updates to ACLs
  • It includes Procedural language debugger (supporting pl/pgsql and edb-spl)
  • It also includes Schema diff tool for managing differences between schemas
  • It has ERD Tool for designing and documenting schemas
  • It provides the feature of Auto-vacuum management as well
  • It has excellent monitoring dashboard to monitor the resource and other utilization
  • It allows us to perform backup, restore, vacuum and analyze on demand
  • SQL/shell/batch job scheduling agent and so on

 

How to Install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa)

How to Install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa)

Also Read: How to Install Apache Ant on Ubuntu 20.04 LTS (Focal Fossa)

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get and curl utility available in your Server.

d) You should also have gpg utility installed in your Server.

 

Step 2: Update Your Server

Before installing pgAdmin 4 packages, it is a better idea to download and install all the latest available updates from default Ubuntu repo by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Hit:1 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu focal InRelease
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:7 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease
Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:9 http://ppa.launchpad.net/juju/stable/ubuntu focal InRelease
Hit:10 https://download.sublimetext.com apt/stable/ InRelease
Hit:11 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Get:12 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Hit:13 http://ppa.launchpad.net/mojo-maintainers/ppa/ubuntu focal InRelease
...............................................

 

Step 3: Add GPG Key

You have the visit the official website and get the latest step to download and install the public key for repository. As of now, we need to run below curl command to install the public key.

cyberithub@ubuntu:~$ curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

 

Step 4: Add Repo

After installing the key, you need to add the repo from where pgAdmin 4 related packages needs to be downloaded and installed. This can be done by running below command. Below step will not just add the repo but it will also update the system cache about that newly added repo along with all its packages information.

cyberithub@ubuntu:~$ sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Hit:1 https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu focal InRelease
Hit:2 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://ppa.launchpad.net/flatpak/stable/ubuntu focal InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:8 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease
Hit:9 https://download.sublimetext.com apt/stable/ InRelease
Hit:10 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 InRelease
Hit:11 http://ppa.launchpad.net/juju/stable/ubuntu focal InRelease
Get:12 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Hit:13 http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal InRelease
Hit:14 http://ppa.launchpad.net/mojo-maintainers/ppa/ubuntu focal InRelease
Hit:15 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal InRelease
Fetched 222 kB in 3s (66.0 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.

 

Step 5: Install pgAdmin 4

In the next step you can install pgAdmin 4 by running sudo apt install pgAdmin4 command as shown below. This will download and install the package along with all its dependencies from the added repo.

cyberithub@ubuntu:~$ sudo apt install pgadmin4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libapache2-mod-wsgi-py3 pgadmin4-desktop pgadmin4-server pgadmin4-web
The following NEW packages will be installed:
libapache2-mod-wsgi-py3 pgadmin4 pgadmin4-desktop pgadmin4-server pgadmin4-web
0 upgraded, 5 newly installed, 0 to remove and 4 not upgraded.
Need to get 196 MB of archives.
After this operation, 300 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libapache2-mod-wsgi-py3 amd64 4.6.8-1ubuntu3.1 [93.8 kB]
Get:2 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main amd64 pgadmin4-server amd64 7.5 [93.6 MB]
Get:3 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main amd64 pgadmin4-desktop amd64 7.5 [103 MB]
Get:4 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main all pgadmin4-web all 7.5 [2,756 B]
Get:5 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main all pgadmin4 all 7.5 [860 B]
Fetched 196 MB in 2min 21s (1,391 kB/s)
Selecting previously unselected package libapache2-mod-wsgi-py3.
(Reading database ... 254669 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-wsgi-py3_4.6.8-1ubuntu3.1_amd64.deb ...
Unpacking libapache2-mod-wsgi-py3 (4.6.8-1ubuntu3.1) ...
Selecting previously unselected package pgadmin4-server.
Preparing to unpack .../pgadmin4-server_7.5_amd64.deb ...
Unpacking pgadmin4-server (7.5) ...
Selecting previously unselected package pgadmin4-desktop.
...............................................................

 

Step 6: Launch pgAdmin 4

After successful installation, you can launch pgAdmin 4 from Desktop by navigating to Activities and searching pgAdmin in the search bar as shown below. Once it appears, click on it to open.

How to Install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa) 1

When you launch it for the first time after installation, then it should look like below. You can now connect to your either local or remote PostgreSQL database and start using it.

How to Install pgAdmin 4 on Ubuntu 20.04 LTS (Focal Fossa) 2

 

Step 7: Uninstall pgAdmin 4

Once you are done using pgAdmin 4 utility you can choose to uninstall it from your system by using sudo apt remove pgadmin4 command as shown below. But you may also notice that removing this utility will make other pgAdmin 4 based applications such as pgadmin4-desktop, pgadmin4-server and pgadmin4-web unusable. So please watch this step before running.

cyberithub@ubuntu:~$ sudo apt remove pgadmin4
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libapache2-mod-wsgi-py3 pgadmin4-desktop pgadmin4-server pgadmin4-web
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
pgadmin4
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 271286 files and directories currently installed.)
Removing pgadmin4 (7.5) ...

Leave a Comment