How to install PgAdmin4 on Ubuntu 20.04 Foca Fossa
Update the system
sudo apt-get update
Install required packages
Three packages require to install before downloading pgAdmin which are python, pip and virtualenv. Run the following command to install these packages.
sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev
sudo apt-get install python3-virtualenv libpq-dev python3-dev
Create virtual environment
Run the following commands to create a new folder named pgAdmin4 in the current location, go to the newly created folder and create the virtual environment.
mkdir pgAdmin4
cd pgAdmin4
virtualenv pgAdmin4
Activate virtual environment
Go to pgAdmin4 folder under pgAdmin4 and run the following commands to activate the virtual environment.
cd pgAdmin4
source bin/activate
Download pgAdmin 4
Run the following command to download the latest version of pgAdmin 4.
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.20/pip/pgadmin4-4.20-py2.py3-none-any.whl
Install pgAdmin 4
Run the following command to complete the installation process of pgAdmin 4.
pip install pgadmin4-4.20-py2.py3-none-any.whl
Configure and run pgAdmin 4
After completing the installation steps, you have to create a configuration file to run this software. Create a new file named config_local.py in lib/python3.8/site-packages/pgadmin4/ folder using nano editor.
nano lib/python3.8/site-packages/pgadmin4/config_local.py
Add the following content in config_local.py.
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
Now, use the following command to run pgAdmin.
python lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
Now, access http://localhost:5050/ from any browser. If all the steps are completed properly then the browser will display the administration and development platform for the PostgreSQL database.
Join The Conversation
Please Log In to post.