1$ sudo apt update -y
2$ sudo apt install postgresql postgresql-contrib
3$ sudo systemctl status postgresql
4$ sudo -i -u postgres
5$ psql
6# \q
7$ sudo pg_isready
8$ sudo apt install libgmp3-dev build-essential libssl-dev
9$ sudo apt install python3-virtualenv python3-dev libpq-dev
10$ mkdir pgadmin4 && cd pgadmin4
11$ virtualenv pgadmin4env
12$ source pgadmin4env/bin/activate
13$ pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.30/pip/pgadmin4-4.30-py3-none-any.whl
14$ sudo nano pgadmin4env/lib/python3.8/site-packages/pgadmin4/config_local.py
15
16import os
17DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
18LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
19SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
20SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
21STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
22SERVER_MODE = False
23
24$ python pgadmin4env/lib/python3.8/site-packages/pgadmin4/pgadmin4.py
25Or
26./pgadmin4env/bin/pgadmin4&
27
28# Finally, head over to your browser and browse the address shown.
29# http://127.0.0.1:5050
30
31$ echo "alias startPg='~/pgAdmin4/venv/bin/python ~/pgAdmin4/venv/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py'" >> ~/.bashrc
32$ source ~/.bashrc
33$ startpg