Promise Preston
Promise Preston

Reputation: 28800

PgAdmin: Package 'pgAdmin4' has no installation candidate

I just installed PostgreSQL and I am trying to install pgdmin4, but whenever I run the command below to install pgadmin4 and pgadmin4-apache2

sudo apt install pgadmin4 pgadmin4-apache2

I often get the error

E: Package 'pgadmin4' has no installation candidate

E: Unable to locate package pgadmin4-apache2

I have tried out a lot of solutions, but none seems to do the trick. I need some help.

Upvotes: 48

Views: 80603

Answers (11)

The solution is to open

/etc/apt/sources.list.d/pgadmin4.list

replace una with focal.

Blog post with the solution.

Upvotes: 0

Yuvraj grover
Yuvraj grover

Reputation: 11

Working as of 31 December 2023

  1. curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

  2. 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 && apt update'

  3. Updated command (100% working tested on ubuntu)
    sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal/ pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

  4. sudo apt install pgadmin4

Upvotes: 1

Shubham Yadav
Shubham Yadav

Reputation: 341

I was facing same issue. However I am able to resolve it by following below instructions :

  1. Visit : https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/
  2. select latest directory by date enter image description here
  3. select folder name : apt enter image description here
  4. Follow instructions given in Readme.md file enter image description here

Event after following above instructions if you're not able to install pgadmin4 on ubuntu23.04, then :

In step 2, select different directory by date & follow same instructions.

Note:

I am able to install pgadmin4 v7.8 on ubuntu 23.04 by selecting 2023-11-09 directory in step 2 & then following rest insturctions.

All the best!

Upvotes: 0

Promise Preston
Promise Preston

Reputation: 28800

Here's how I solved the issue;

The issue arises because the repository for pgadmin has not been added to your local machine. To solve the issue, do the following below;

Note: This should work in Ubuntu 16.04 (Xenial), Ubuntu 18.04 (Bionic), Ubuntu 19.10 (Eoan), Ubuntu 20.04 (Focal), Debian 9 (Stretch) and Debian 10 (Buster) and possibly newer releases.

Install the public key for the repository (if not done previously):

curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

Create the repository configuration file:

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 && apt update'

Choose the Installation method that you want:

  • Install pgAdmin (for both desktop and web modes):

    sudo apt install pgadmin4
    
  • Install pgAdmin (for desktop mode only):

    sudo apt install pgadmin4-desktop
    
  • Install pgAdmin (for web mode only):

    sudo apt install pgadmin4-web 
    

You can configure the webserver, if you installed pgadmin for web mode:

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

Resources: pgAdmin 4 (APT)

Upvotes: 147

tio_hecro
tio_hecro

Reputation: 127

Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc

curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null

Create /etc/apt/sources.list.d/pgdg.list.

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

Finally, update the package lists, and start installing packages:

sudo apt update

Provide the web interface accessible in a web browser:

sudo apt install pgadmin4-web

Provide desktop application for Ubuntu system, which required Ubuntu Desktop system:

sudo apt install pgadmin4-desktop

Install both, web and desktop:

sudo apt install pgadmin4

References: https://wiki.postgresql.org/wiki/Apt

Upvotes: 0

Basharat Ali
Basharat Ali

Reputation: 1209

In my case, the following is working:

1st step:

curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

Create the repository configuration file. In the above answer, the command mentioned below is now too old and the page returns 404, so the packages will not be downloaded successfully.

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 && apt update'

2nd step:

The updated and working command is:

sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal/ pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

3rd step:

sudo apt install pgadmin4

Upvotes: 48

geralt_3771
geralt_3771

Reputation: 11

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

sudo apt install wget ca-certificates

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add

sudo apt update

sudo apt install pgadmin4

try this, I found it on : https://o7planning.org/11353/install-pgadmin-on-ubuntu#a6605357

and it worked, despite people saying there is no support for 20.04 (focal)

Upvotes: 1

Rubel Biswas
Rubel Biswas

Reputation: 1434

Run these Command bellow,

  1. sudo apt install curl
  2. curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
  3. 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 && apt update'
  4. sudo apt install pgadmin4

You can also check here.

Upvotes: 4

Dtheekshana
Dtheekshana

Reputation: 82

The issue arises because the repository for pgadmin has not been added to your local machine. To solve the issue, do the following below;

Open your terminal and enter the command below

sudo nano /etc/apt/sources.list.d/pgdg.list

When nano editor opens up, copy and paste the line below into it

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

then copy and paste this thing

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

After that copy and paste this thing

sudo apt-get update && sudo apt-get install pgadmin4

Congratulations your job is done

Upvotes: 0

Bala vamsi
Bala vamsi

Reputation: 222

This has worked for me

sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install pgadmin4 pgadmin4-apache2

Upvotes: 1

Punnerud
Punnerud

Reputation: 8021

For Ubuntu 18.04 you have to add the Postgresql repository and key to apt:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
 sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

After this you have to run

sudo apt update

Then you can install, ex. with "sudo apt install pgadmin4 pgadmin4-apache2 -y"

Upvotes: 7

Related Questions