How To Install and Configure pgAdmin 4 in Server Mode

Published: 05 October 2022
on channel: MivoCloud
2,484
57

pgAdmin is an open-source administration and development platform for PostgreSQL and its related database management systems. Written in Python and jQuery, it supports all the features found in PostgreSQL. You can use pgAdmin to do everything from writing basic SQL queries to monitoring your databases and configuring advanced database architectures.

In this tutorial, we’ll walk through the process of installing and configuring the latest version of pgAdmin onto an Ubuntu 20.04-22.04 server, accessing pgAdmin through a web browser, and connecting it to a PostgreSQL database on your server.

Useful Links
VPS/VDS - https://www.mivocloud.com/

Commands Used

FIRST STEP
sudo apt install libgmp3-dev libpq-dev
sudo mkdir -p /var/lib/pgadmin4/sessions
sudo mkdir /var/lib/pgadmin4/storage
sudo mkdir /var/log/pgadmin4
sudo chown -R user:user /var/lib/pgadmin4
sudo chown -R user:user /var/log/pgadmin4
cd environments/
source my_env/bin/activate
python -m pip install -U pip
python -m pip install pgadmin4==6.10
python -m pip install gunicorn

Second Step
nano my_env/lib/python3.10/site-packages/pgadmin4/config_local.py

WRITE IN FILE
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
SERVER_MODE = True

python my_env/lib/python3.10/site-packages/pgadmin4/setup.py

THIRD STEP
WRITE IN /etc/nginx/sites-available/your_domain
server {
listen 80;
listen [::]:80;

server_name your_domain www.your_domain;

location / {
proxy_pass http://unix:/tmp/pgadmin4.sock;
include proxy_params;
}
}

gunicorn --bind unix:/tmp/pgadmin4.sock --workers=1 --threads=25 --chdir ~/environments/my_env/lib/python3.10/site-packages/pgadmin4 pgAdmin4:app


Watch video How To Install and Configure pgAdmin 4 in Server Mode online without registration, duration hours minute second in high quality. This video was added by user MivoCloud 05 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,484 once and liked it 57 people.