How to install pgAdmin 4 in desktop mode? The documentation only details server mode.
-
The docker version sure was a lot easier and faster way of installing PGAdmin4. I spent a lot of time to do it the old way that was in the readme file. The way to access it then is in a browser window, point it to 0.0.0.0:5050 and it comes up real good. It loads quite fast BUT when I try to create a server with it it keeps saying that Postgresql is NOT running, however in PGAdmin3 Postgresql is running fine. Have read many comments saying what a poor product it is so use at your own risk!!! – Gerald Brown May 15 '17 at 12:54
-
kiahosseini.github.io/help/2016/10/18/… – Dave Jarvis Aug 22 '17 at 0:41
-
2Only pgadmin3 is available on apt (ubuntu 16.04). Any idea how to open a request to Canonical to include pgadmin4 in apt packages? What's the process of requesting an "app" to be included in a package manager? – AlikElzin-kilaka Dec 26 '17 at 8:47
-
@AlikElzin-kilaka - check my answer below for the apt approach. – Muhamed Huseinbašić May 30 '18 at 13:31
-
If anyone just wants pgAdmin3 you can simply install it using the Ubuntu Software application that's on all Ubuntu installations. – Kyle Bridenstine Aug 22 at 13:23
For pgAdmin 4 v4.12 on Ubuntu, according to the download page:
Install dependencies, create a virtual environment, download, install & configure
Using Python2.x
sudo apt-get install virtualenv python-pip libpq-dev python-dev
cd
virtualenv pgadmin4
cd pgadmin4
source bin/activate
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.12/pip/pgadmin4-4.12-py2.py3-none-any.whl
Using Python3.6 (Preferred to avoid encoding related issues)
sudo apt-get install virtualenv python3-pip libpq-dev python3-dev
cd
virtualenv -p python3 pgadmin4
cd pgadmin4
source bin/activate
pip3 install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.12/pip/pgadmin4-4.12-py2.py3-none-any.whl
Configure
Override default paths and set it to single-user mode in the local configuration file:
nano lib/python2.7/site-packages/pgadmin4/config_local.py
For Python3.x:
nano lib/python3.6/site-packages/pgadmin4/config_local.py
Write:
import os
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
SERVER_MODE = False
Run
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.x:
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
Access
Access at http://localhost:5050
Exit
Exit with Ctrl-C
Run again
cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.6
#!/bin/bash
cd ~/pgadmin4
source bin/activate
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
Make a shortcut
touch ~/pgadmin4/pgadmin4
chmod +x ~/pgadmin4/pgadmin4
nano ~/pgadmin4/pgadmin4
Write:
#!/bin/bash
cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.6
#!/bin/bash
cd ~/pgadmin4
source bin/activate
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
Now you can just run it with a simpler command:
~/pgadmin4/pgadmin4
Python3 users
Replace [x] in Python3.6 with your respective version.
Conflict with pgAdmin 3 configuration
pgAdmin 4 will not start in the environment where pgAdmin 3 was previously installed and used because of incompatible configuration in the .pgadmin directory. The simplest solution is to either clear that directory or tweak config_local.py to point to a clean new .pgadmin4 directory.
-
-
5I'd like to add that so I can quickly run it, I added this to my ~/.bashrc : alias pgadmin="source ~/pgadmin4/bin/activate && python ~/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py" That way I can just type pgadmin and it launches, like it SHOULD out of the box. You listening pgadmin? – light24bulbs Jun 13 '17 at 21:32
-
1Here is the correct link for FTP v2.1: ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/… – Aïssa Ghouti Jan 22 '18 at 12:42
-
1Could the hard linking to python3.6 dependency in the
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.pybe removed/replaced? That way the answer would be more future proof. – paul23 Sep 4 '18 at 18:22 -
1On Ubuntu 19.04 which comes with Python 3.7 swap out every occurence of 3.6 with 3.7 in the Python 3.x instructions. – Karl Richter May 19 at 9:15
Other option is to use docker and a docker image provided by thaJeztah - https://github.com/thaJeztah/pgadmin4-docker
$ docker run --rm -p 5050:5050 thajeztah/pgadmin4
Then to access a PostgreSQL DB instance from within pgadmin4 you should use the IP of the host instead of localhost and 127.0.0.1 since Docker will map those to the container itself.
The IP of a dockerised DB instance could be found with 2 steps:
find the container ID of your db with:
docker psinspect the container_name to find its ip with:
docker inspect <ID from previous step>
you are looking for something like "IPAddress": "172.18.0.3"
-
1How can you make it see a dockerized postgres? localhost/127.0.0.1/container id did not work for me. – ampofila Apr 18 '17 at 12:04
-
1Can we set the IP static i.e. we don't have to update our application to point to new docker container IP every time we restart it – Nam G VU Sep 16 '17 at 4:45
-
Nice, added a chromium application shortcut, and it's almost like having the actual application back- – chrismarx Jan 22 '18 at 15:26
-
Other way to connect the host database: stackoverflow.com/questions/24319662/… – qmn1711 Sep 24 '18 at 13:17
On Ubuntu 16.04 you can install pgadmin4 with
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
I have tested this on 16.04.
-
Okay, one another thing i want to know that how do i start if i installed it on server. – Akhilendra Aug 3 '18 at 7:27
-
1For Ubuntu based distros like Mint you may want to replace the
$(lsb_release -cs)with the version of Ubuntu it's based on. For example, Mint Sarah (version 18) is based on Xenial and looks like this:sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'– aggregate1166877 Sep 28 '18 at 22:47 -
3It looks like the ultimate solution, at least for Ubuntu +16.xx. Thanks ! – Louisb Nov 19 '18 at 10:47
protected by Community♦ Oct 6 '17 at 23:18
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?