What Exactly is pgAdmin?
pgAdmin is a management tool for PostgreSQL and derivative relational databases such as EnterpriseDB’s EDB Advanced Server. It may be run either as a web or desktop application.
pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
source(pgadmin.org)
As at the time of writing this, PgAdmin 4.23 is the latest version and from the official download page, this can be installed using the apt-get install method, though for now only Ubuntu 16.04 (Xenial), 18.04 (Bionic), 19.10 (Eoan), 20.04 (Focal) are officially available through the apt-get method, that leaves a headache for the users of the Latest Linux mint (version codename ulyana).
I’M SURE THE PGADMIN TEAM IS WORKING ON ADDING apt-get support for ulyana (it's still relatively new) but this is a workaround to get the latest version of pgAdmin4
This method also works for any Linux version
Follow the following steps to install pgAdmin4 on your Linux/Ubuntu machine
- Update the system
I've seen this on so many installation guides and guess what ill ask you to do first, UPDATE.
2. install PostgreSQL (if you don't have it installed already)
Create the username and password for PostgreSQL database. Type the following command in the terminal to add login credentials for the user, Postgres
3. Install the required packages
4. Create a virtual environment
Run the following commands navigate to your home directory, create a new folder named pgAdmin4 and create the virtual environment.
5. Activate the virtual environment
6. Fetch and install the latest version of pgaAdmin4 using pip install
7. Configure and run pgAdmin 4
Create a new file named config_local.py in lib/python3.8/site-packages/pgadmin4
Then add this to the file
8. Test the installation by running the command below
This should start pgAdmin4
9. Create an alias in your
/.bashrc file
A brief explanation of the above snippet
10. You can easily start The Pgadmin using the “startPg” command
we are good to go
NB : Using virtual environment isn’t necessary. You can install pgadmin4 as your local package (e.g. at
/.local/lib/python3.8/site-packages/pgadmin4) instead of installing in a virtual environment. BUT IT IS ADVISABLE TO USE A VIRTUAL ENVIRONMENT
How to Install PostgreSQL with pgAdmin4 on Linux Mint 21/20
pgAdmin is an open-source feature-rich, frontend management tool that allows you to easily administer and manage your PostgreSQL relational database from a web browser.
It provides an easy-to-use user interface that simplifies the creation and monitoring of databases and database objects. PgAdmin 4 is an improvement of the earlier pgAdmin tool and is available for Linux, Windows, macOS systems, and even a Docker container.
In this tutorial, you will learn how to install PostgreSQL with pgAdmin4 on Linux Mint 21 and Linux Mint 20.
Step 1: Install PostgreSQL Database on Linux Mint
1. To start off, launch your terminal and update your packages using the apt package manager as shown.
Once the update is complete, proceed to the next step.
Since pgAdmin4 provides a frontend interface for the management of PostgreSQL database objects, it’s essential to have PostgreSQL installed first.
2. To do this, we are going to install the postgresql package and postgresql-contrib which offers extended features that extend the functionality of PostgreSQL.
3. Usually, PostgreSQL starts automatically on boot up. You can confirm this using the command given below:
4. To log in to your PostgreSQL instance, first switch to the postgres user. The Postgres user comes included by default with the installation of PostgreSQL. Then run the psql command as shown.
5. Additionally, you can check if the database server is accepting incoming connections as shown.
Step 2: Install pgAdmin4 on Linux Mint
pgAdmin4 is available for Ubuntu 16.04 and later versions and can easily be installed using the APT package manager. The same cannot support Linux Mint and Pgadmi4 developers are yet to include support that allows users to easily install the frontend management tool using the APT package manager.
6. The only viable option is to install pgAdmin4 from a virtual environment. So first, we will install the prerequisite packages as shown.
7. Next, install the Python virtual environment and associated dependencies.
8. Next, create a directory where you will create a virtual environment.
9. Then create the virtual environment as shown. Here, pgadmin4env is the name of the virtual environment.
10. Once the virtual environment is in place, activate it as shown.
11. Then use the pip tool to install pgadmin4 as shown.
12. Next, create a configuration file config_local.py.
and add the lines below.
13. To start the pgAdmin4 management tool, invoke the command:
14. Finally, head over to your browser and browse the address shown.
You will be prompted to set the master password, so proceed and set a strong password and click the ‘Ok’ button.
15. To make things easier, you can create an alias in the
/.bashrc file as shown.
16. Next, update the bashrc file.
17. Finally, you can start the pgAdmin4 management tool by simply invoking the startPg command.
Once again head over to your browser and log in to the PgAdmin4 interface. And this concludes the installation of PostgreSQL with pgAdmin4 on Linux Mint 21 and Linux Mint 20.
Tutorial Feedback.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Related Posts
39 thoughts on “How to Install PostgreSQL with pgAdmin4 on Linux Mint 21/20”
Can you provide the uninstall steps for the installation of PostgreSQL with pgAdmin4 you have provided?
Here are the instructions to uninstall PostgreSQL with pgAdmin4 on the Linux Mint system.
What is my postgresql password? I did the above but didn’t create a password.
In step 14, you will be asked to set a master password, have you set it?
I have the “vera” mint 21.1 version, but following the procedure install version 14. I want postgreql version 15.
To install PostgreSQL 15 on Linux Mint, then follow these instructions:
Thank you very much brother, I was able to install it up to point 14, the rest was no longer necessary.
Remember to check the paths of the requests so that pgadmin4 runs.
I’ve followed this guide, but step 13 does not work for some reason. I get this as an error message:
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/*myname*/pgadmin/*
How to Install PostgreSQL with pgAdmin4 on Linux Mint 20
pgAdmin is an open-source feature-rich, frontend management tool that allows you to easily administer and manage your PostgreSQL relational database from a web browser.
It provides an easy-to-use user interface that simplifies the creation and monitoring of databases and database objects. PgAdmin 4 is an improvement of the earlier pgAdmin tool and is available for Linux, Windows, macOS systems, and even a Docker container.
In this tutorial, you will learn how to install PostgreSQL with pgAdmin4 on Linux Mint 20.
Step 1: Install PostgreSQL Database on Linux Mint
1. To start off, launch your terminal and update your packages using the apt package manager as shown.
Once the update is complete, proceed to the next step.
Since pgAdmin4 provides a frontend interface for the management of PostgreSQL database objects, it’s essential to have PostgreSQL installed first.
2. To do this, we are going to install the postgresql package and postgresql-contrib which offers extended features that extend the functionality of PostgreSQL.
Install PostgreSQL on Linux Mint
3. Usually, PostgreSQL starts automatically on boot up. You can confirm this using the command given below:
Check PostgreSQL Status
4. To log in to your PostgreSQL instance, first switch to the postgres user. The Postgres user comes included by default with the installation of PostgreSQL. Then run the psql command as shown.
Connect to PostgreSQL Shell
5. Additionally, you can check if the database server is accepting incoming connections as shown.
Check PostgreSQL Accepting Incoming Connections
Step 2: Install pgAdmin4 on Linux Mint
pgAdmin4 is available for Ubuntu 16.04 and later versions and can easily be installed using the APT package manager. The same cannot support Linux Mint 20 and Pgadmi4 developers are yet to include support that allows users to easily install the frontend management tool using the APT package manager.
6. The only viable option is to install pgAdmin4 from a virtual environment. So first, we will install the prerequisite packages as shown.
Install Prerequisite Packages
7. Next, install the Python virtual environment and associated dependencies.
Install Python Virtual Environment
8. Next, create a directory where you will create a virtual environment.
9. Then create the virtual environment as shown. Here, pgadmin4env is the name of the virtual environment.
Create Virtual Environment for pgAdmim4
10. Once the virtual environment is in place, activate it as shown.
11. Then use the pip tool to install pgadmin4 as shown.
Install PgAdmin4 in Linux Mint
12. Next, create a configuration file config_local.py.
and add the lines below.
Create PgAdmin4 Configuration
13. To start the pgAdmin4 management tool, invoke the command:
Start PgAdmin4 Service
14. Finally, head over to your browser and browse the address shown.
You will be prompted to set the master password, so proceed and set a strong password and click the ‘Ok’ button.
Set PgAdmin4 Password
15. To make things easier, you can create an alias in the
/.bashrc file as shown.
16. Next, update the bashrc file.
17. Finally, you can start the pgAdmin4 management tool by simply invoking the startpg command.
Start PgAdmin4 Tool
Once again head over to your browser and log in to the PgAdmin4 interface. And this concludes the installation of pgAdmin4 on Linux Mint.
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint
Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/
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
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)
About Cloud Network
Providing on the Web, online library and learning platform for IT Professional Developers with a unique blend of original content, peer-to-peer advice from the largest community of IT.