Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
5 minutes PgAdmin4 Desktop install guide

5 minutes PgAdmin4 Desktop install guide

Done on Linux (Ubuntu tested)

Virtualenv & install of Python package & its deps

cd $HOME
virtualenv --python=/usr/bin/python2.7 pgadmin4
source pgadmin4/bin/activate
pip2.7 install https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.0/pip/pgadmin4-1.0-py2-none-any.whl

Add a default configuration

echo "# coding: utf-8
from config import *

SERVER_MODE = False

# Secret key for signing CSRF data. Override this in config_local.py if
# running on a web server
CSRF_SESSION_KEY = 'MyAlternateSuperSecret1'

# Secret key for signing cookies. Override this in config_local.py if
# running on a web server
SECRET_KEY = 'MyAlternateSuperSecret2'

# Salt used when hashing passwords. Override this in config_local.py if
# running on a web server
SECURITY_PASSWORD_SALT = 'MyAlternateSuperSecret3'
" > $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib() + '/pgadmin4/config_local.py')")

Run for the first time the server

python $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib() + '/pgadmin4/pgAdmin4.py')")

It should return the following

pgAdmin 4 - Application Initialisation

The configuration database - '/home/myuser/.pgadmin/pgadmin4.db' does not exist. Entering initial setup mode... NOTE: Configuring authentication for DESKTOP mode.

The configuration database has been created at /home/myuser/.pgadmin/pgadmin4.db Starting pgAdmin 4. Please navigate to http://localhost:5050 in your browser.

Open your browser at http://localhost:5050

Running when everything already installed

cd $HOME
source pgadmin4/bin/activate
python $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib() + '/pgadmin4/pgAdmin4.py')")

Then, open your browser at http://localhost:5050

Note: you can use above code in a bash file to avoid boring copy&paste

@NicolasBehra

This comment has been minimized.

@Firdavsbek

This comment has been minimized.

Copy link

commented Sep 5, 2017

Hi @NicolasBehra! I did not get properly, where to put SERVER_MODE = False and other configuring lines to? is there any file that have to contain these lines?

@MathieuDomingo

This comment has been minimized.

Copy link

commented Sep 12, 2017

Hi @Firdavsbek.
You have to put the full command in your terminal.
It's going to create a file named config_local.py, in the YOUR_PGADMIN4_ENV/lib/pythonX.X/site-packages/pgadmin4/
If you follow all the instructions YOUR_PGADMIN4_ENV should be named pgadmin4. and python X.X should be python2.7

The config_local.py will be fulled with all what is written after echo " and before " >

@hrvoojex

This comment has been minimized.

Copy link

commented Nov 5, 2017

Could not install pqAdmin4 app on Kubuntu 17.10. This worked after I installed sudo apt-get install postgresql-server-dev-all

@HarshalBhoir

This comment has been minimized.

Copy link

commented Dec 5, 2017

Thanks for the step by step go through.

@hutber

This comment has been minimized.

Copy link

commented Feb 2, 2018

Error: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

@ravirajvaghela

This comment has been minimized.

Copy link

commented Feb 7, 2018

Step by Step here without any error[ [How] to install pgAdmin 4 in desktop mode on Ubuntu 16.04](https://ravirajsinhv.blogspot.in/2018/02/postgresql-install-pgadmin-4-desktop.html)

@mikbuch

This comment has been minimized.

Copy link

commented Jun 5, 2018

I recommend @ravirajvaghela's step by step tutorial.

You can get the newest Python wheel from here (both links, in this gist as well as in rava's tutorial are outdated):
https://www.pgadmin.org/download/pgadmin-4-python-wheel/

With higher version (3.0) I had to manually create /var/lib/pgadmin directory and alter it's permissions:
https://stackoverflow.com/questions/46707935/oserror-errno-13-permission-denied-var-lib-pgadmin

Also python-psycopg2 and libpq-dev are required, see:
https://stackoverflow.com/a/28938258

@Mrshinezee

This comment has been minimized.

Copy link

commented Jun 13, 2018

Thanks, it was really helpful

@devskope

This comment has been minimized.

Copy link

commented Sep 20, 2018

its easier to get postgreSQL and pgadmin set up on unix by adding the official PGDG repository:

$ curl -s https://salsa.debian.org/postgresql/postgresql-common/raw/master/pgdg/apt.postgresql.org.sh | sudo bash
$ sudo apt-get update
$ sudo apt-get install postgresql-10 pgadmin4

// or

$ sudo apt-get install postgresql pgadmin4
@dalu

This comment has been minimized.

Copy link

commented Oct 12, 2018

@ope-oguntoye no shit sherlock, what do you think this gist is for?

@Dentrax

This comment has been minimized.

Copy link

commented Jan 20, 2019

pgadmin4 - v4.1

This works well for me: (Temporary solution)

cd $HOME
virtualenv --python=/usr/bin/python3.6 pgadmin4
source pgadmin4/bin/activate
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.1/pip//pgadmin4-4.1-py2.py3-none-any.whl
@linxpatrick

This comment has been minimized.

Copy link

commented Feb 22, 2019

Can you expand on the instructions? I had pgAdmin4 v3.6 installed. Couldn't figure out how to upgrade to pgAdmin4 v4.2. I then wanted to remove all traces of pgAdmin4 and couldn't figure out how to do that, either.

@monocongo

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.