ubuntu安装pgAdmin 4

时间:2024-01-22 09:46:02

One way to install pgadmin4 is to download its Python wheel at https://www.postgresql.org/ftp/pgadmin3/pgadmin4/v1.0-beta1/pip/ and then use pip to install it:

it is better to install with virtualenv

virtualevn pgadmin_install
cd pgadmin_install
source ./bin/activate
pip install <name of the pgadmin wheel download from https://www.pgadmin.org/download/pgadmin-4-python-wheel/>

According to https://www.pgadmin.org/download/pip4.php, to run pgadmin4, do the following:

and add following code in your config_local.py which is in the same location with config.py, if you install it with virtualenv, the config_local.py should locate in ~/pgadmin4/lib/python2.7/site-packages/pgadmin4

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')

Once installed, you will need to create a config_local.py file in the same directory as config.py. On a machine with a virtual environment created at ~/pgadmin4, this is~/pgadmin4/lib/python2.7/site-packages/pgadmin4. Ensure you set values for the SECRET_KEY, SECURITY_PASSWORD_SALT and CSRF_SESSION_KEY settings at bare minimum - see config.py for more information and other settings that can be customised. In order to reference other variables from config.py, you may need to include from config import *at the top of config_local.py.

pgAdmin can now be run with a command like python ~/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py. Finally, point your browser to http://127.0.0.1:5050.

ref: https://askubuntu.com/questions/788457/how-to-install-pgadmin-4-in-server-mode-on-ubuntu-16-04

https://*.com/questions/46707935/oserror-errno-13-permission-denied-var-lib-pgadmin