Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdanyow/ab0e182f3d1f3b71776c36168312b584 to your computer and use it in GitHub Desktop.
Save jdanyow/ab0e182f3d1f3b71776c36168312b584 to your computer and use it in GitHub Desktop.
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/pgadmin/pgadmin4/v1.5/pip/pgadmin4-1.5-py2.py3-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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment