How do I install pgadmin 4 on ubuntu?

Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace stretch with the actual distribution you are using:

deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main

i.e.deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main

(You may determine the codename of your distribution by running lsb_release -c). For a shorthand version of the above, presuming you are using a supported release:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ codename-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

i.e.sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc, update the package lists, and start installing packages:

sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-10 pgadmin4   # on wheezy/jessie/trusty: pgadmin3

Alternately, this shell script will automate the repository setup. Note that the shell script leaves the source package repo (deb-src) commented out; if you need source packages, you will need to modify /etc/apt/sources.list.d/pgdg.list to enable it.

 

Leave a Comment

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