PostgreSQL 10 can’t manage with pgAdmin3. So we need to use pgAdmin4 for handling PSQL10.
First of all we need to install pip3 so we need to run the command
sudo apt install python3-pip
Then install the virtualenv package
sudo pip3 install virtualenv
Then download the Python Wheel pgAdmin4
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.9/pip/pgadmin4-4.9-py2.py3-none-any.whl
Before running this command you just check the the below link
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/
Then find the latest version
Then create a virtualenv in a particular directory ~/py3-venv-pgadmin
mkdir py3-venv-pgadmin
virtualenv –system-site-packages –no-setuptools –python=python3.5 ~/py3-venv-pgadmin
Then activate the virtualenv
cd ~/py3-venv-pgadmin/bin
source activate
And check it
~/py3-venv-pgadmin/bin/pip3
Then install the pgAdmin 4.
pip3 install pgadmin4–2.0-py2.py3-none-any.whl
Then
cd ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4
touch config_local.py
nano config_local.py
Paste the below content
import os
SERVER_MODE = False
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’)
Run this python file using pyhton3
python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/setup.py
Run the pgAdmin 4
python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
Just check the 127.0.0.1:5050
We can use the pgAdmin 4 in the localhost.
Exit from the virtualenv
deactivate
Now we need to create a python script to run pgadmin4
nano ~/py3-venv-pgadmin/pgadmin4.sh
Then paste the below contend
#!/usr/bin/env bash
cd ~/py3-venv-pgadmin/bin
source activate
python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
Then Create alias for bash
nano ~/.bashrc
Then write a single line at the last of this file.
alias pgadmin4=’~/py3-venv-pgadmin/pgadmin4.sh’
reload bashrc
source ~/.bashrc
now you can run pgadmin
pgadmin4
by: https://medium.com/@nikhilkrishnan/how-to-install-pgadmin4-in-ubuntu-16-04-with-python3-aecc79de4b7d