How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint
Visit the Pgadmin 4 Ubuntu download site:
https://www.pgadmin.org/download/
METHOD 1
Importing GPG key
sudo apt install wget ca-certificates
Install Pgadmin4 from Ubuntu repositories
Step1 :- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Add PostgreSQL APT repository
Step2 :- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Updating
Step3 :- sudo apt update
Installation pgadmin4
Step4 :- sudo apt install pgadmin4 pgadmin4-apache2 -y OR sudo apt-get install pgadmin4 pgadmin4-apache2
Check Status
Step :- systemctl status apache2
UFW Firewall Configured
Step :- sudo ufw allow http
Step :- sudo ufw allow https
Verify Open Browser
http://[SERVERIP OR LOCALHOST OR DOMAIN]/pgadmin4/
Login with your email address and password.
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
===================================================================================================================================
METHOD 2
Creating a New User
Step5 :- useradd -m -s /bin/bash itcloudnet
Step6 :- passwd STRONGPASSWORD
Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/{sessions,storage}
OR
Step8 :- sudo mkdir -p /var/lib/pgadmin4/sessions
Step8 :- sudo mkdir /var/lib/pgadmin4/storage
Changing the Owner of all Directory
Step9 :- sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4/ /var/lib/pgadmin4/
Install Dependencies
Step10 :- sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev -y
Install Apache2
Step11 :- sudo apt install apache2 apache2-utils libapache2-mod-wsgi libexpat1 ssl-cert python -y
Creating Virtual Env
Step11 :- su - itcloudnet
Step12 :- virtualenv pgadmin4
Step13 :- cd pgadmin4/
Step14 :- source bin/activate
Installation pgadmin4
Step15 :- wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v3.6/pip/pgadmin4-4.19-py2.py3-none-any.whl
Install Package through pip command
sudo apt-get install python-pip
Step16 :- pip install pgadmin4-4.19-py2.py3-none-any.whl
Creating New Configuration file
Step17 :- cd lib/python2.7/site-packages/pgadmin4/
Step18 :- nano config_local.py
Now Copy & Paste
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
Run
Step19 :- python setup.py
Step20 :- pip install psycopg2-binary
Step21 :- sudo chown -R www-data:www-data /var/lib/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/lib/pgadmin4
Step22 :- sudo chown -R www-data:www-data /var/log/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4
Configure Apache2
Step23 :- cd /etc/apache2/sites-available/
Change the 'ServerName' with your own domain name
Step24 :- sudo nano pgadmin4.conf
ServerName pgadmin.itcloudnet.blogspot.com
Now test the configuration and activate the pgAdmin4 virtual hosts
Step25 :- apachectl configtest
Step26 :- a2ensite pgadmin4
Restart Apache2 Service
Step27 :- systemctl restart apache2
URL Access
http://pgadmin.itcloudnet.blogspot.com
===================================================================================================================================
HOW TO CONNECT POSTGRESQL DB VIA or WITH PGADMIN4
Login with your email address and password
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
Step28 :- "Add New Server" Button then type PostgreSQL Server or Local details and then save.
Click on General -->
Name : postgresql-local OR localhost
Server group : Servers
Comments : Local PostgreSQl Server
Click on Connection -->
Maintenance : postgres (DB host)
Username : postgres (DB name)
password : itcloudnet$123! (DB passwrod)
Save
Thats it.........
Visit the Pgadmin 4 Ubuntu download site:
https://www.pgadmin.org/download/
METHOD 1
Importing GPG key
sudo apt install wget ca-certificates
Install Pgadmin4 from Ubuntu repositories
Step1 :- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Add PostgreSQL APT repository
Step2 :- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Updating
Step3 :- sudo apt update
Installation pgadmin4
Step4 :- sudo apt install pgadmin4 pgadmin4-apache2 -y OR sudo apt-get install pgadmin4 pgadmin4-apache2
Check Status
Step :- systemctl status apache2
UFW Firewall Configured
Step :- sudo ufw allow http
Step :- sudo ufw allow https
Verify Open Browser
http://[SERVERIP OR LOCALHOST OR DOMAIN]/pgadmin4/
Login with your email address and password.
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
===================================================================================================================================
METHOD 2
Creating a New User
Step5 :- useradd -m -s /bin/bash itcloudnet
Step6 :- passwd STRONGPASSWORD
Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/{sessions,storage}
OR
Step8 :- sudo mkdir -p /var/lib/pgadmin4/sessions
Step8 :- sudo mkdir /var/lib/pgadmin4/storage
Changing the Owner of all Directory
Step9 :- sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4/ /var/lib/pgadmin4/
Install Dependencies
Step10 :- sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev -y
Install Apache2
Step11 :- sudo apt install apache2 apache2-utils libapache2-mod-wsgi libexpat1 ssl-cert python -y
Creating Virtual Env
Step11 :- su - itcloudnet
Step12 :- virtualenv pgadmin4
Step13 :- cd pgadmin4/
Step14 :- source bin/activate
Installation pgadmin4
Step15 :- wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v3.6/pip/pgadmin4-4.19-py2.py3-none-any.whl
Install Package through pip command
sudo apt-get install python-pip
Step16 :- pip install pgadmin4-4.19-py2.py3-none-any.whl
Creating New Configuration file
Step17 :- cd lib/python2.7/site-packages/pgadmin4/
Step18 :- nano config_local.py
Now Copy & Paste
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
Run
Step19 :- python setup.py
Step20 :- pip install psycopg2-binary
Step21 :- sudo chown -R www-data:www-data /var/lib/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/lib/pgadmin4
Step22 :- sudo chown -R www-data:www-data /var/log/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4
Configure Apache2
Step23 :- cd /etc/apache2/sites-available/
Change the 'ServerName' with your own domain name
Step24 :- sudo nano pgadmin4.conf
ServerName pgadmin.itcloudnet.blogspot.com
Now test the configuration and activate the pgAdmin4 virtual hosts
Step25 :- apachectl configtest
Step26 :- a2ensite pgadmin4
Restart Apache2 Service
Step27 :- systemctl restart apache2
URL Access
http://pgadmin.itcloudnet.blogspot.com
===================================================================================================================================
HOW TO CONNECT POSTGRESQL DB VIA or WITH PGADMIN4
Login with your email address and password
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
Step28 :- "Add New Server" Button then type PostgreSQL Server or Local details and then save.
Click on General -->
Name : postgresql-local OR localhost
Server group : Servers
Comments : Local PostgreSQl Server
Click on Connection -->
Maintenance : postgres (DB host)
Username : postgres (DB name)
password : itcloudnet$123! (DB passwrod)
Save
Thats it.........