install pgAdmin4 manually

Post Reply
brid.surapol
Posts: 156
Joined: 11 Apr 2013, 11:43

install pgAdmin4 manually

Post by brid.surapol »

Code: Select all

sudo apt-get update

Code: Select all

sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev

Code: Select all

mkdir pgadmin4
cd pgadmin4
virtualenv pgadmin4
cd pgadmin4
source bin/activate
download (version 4.21 หรือ version ใหม่กว่า)
https://ftp.postgresql.org/pub/pgadmin/ ... ne-any.whl

copy pgadmin4-4.21-py2.py3-none-any.whl ไปยัง folder pgadmin4

Code: Select all

pip install pgadmin4-4.21-py2.py3-none-any.whl

Code: Select all

vim lib/python2.7/site-packages/pgadmin4/config_local.py
ใส่ content ข้างล่าง เข้าไปใน config_local.py

Code: Select all

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 pgAdmin4 ด้วยคำสั่ง

Code: Select all

python lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
brid.surapol
Posts: 156
Joined: 11 Apr 2013, 11:43

pgadmin4 bash script

Post by brid.surapol »

Code: Select all

source /installed_folder/pgadmin4/bin/activate
python /installed_folder/pgadmin4/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
ตัวอย่าง

Code: Select all

source /data/brid_dev/apps.bin/pgadmin4/bin/activate
python /data/brid_dev/apps.bin/pgadmin4/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
brid.surapol
Posts: 156
Joined: 11 Apr 2013, 11:43

Re: install pgAdmin4 manually

Post by brid.surapol »

Code: Select all

sudo vim /etc/apt/sources.list.d/pgdg.list
add this line to the above "file"

Code: Select all

deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main

Code: Select all

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Code: Select all

sudo apt-get update

sudo apt install pgadmin4 pgadmin4-apache2

Code: Select all

sudo a2enmod rewrite

sudo systemctl restart apache2
in browser

Code: Select all

http://localhost/pgadmin4/

http://your-server/pgadmin4/
Post Reply

Return to “การใช้งาน PostgreSQL”