How To Install PostgreSQL With Pgadmin4 On Linux Mint 20
How To Install PostgreSQL With Pgadmin4 On Linux Mint 20
Menu
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.
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.
$ sudo -i -u postgres
$ psql
# \q
5. Additionally, you can check if the database server is accepting incoming
connections as shown.
$ sudo pg_isready
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
RedHat RHCSA and RHCE Certification Preparation Guide - Get This Book
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.
$ virtualenv pgadmin4env
10. Once the virtual environment is in place, activate it as shown.
$ source pgadmin4env/bin/activate
/ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.30/pip/pgadmin4-4.3
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
Create PgAdmin4 Configuration
$ python pgadmin4env/lib/python3.8/site-packages/pgadmin4/pga
Or
./pgadmin4env/bin/pgadmin4&
14. Finally, head over to your browser and browse the address shown.
http://127.0.0.1:5050
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.
$ source ~/.bashrc
17. Finally, you can start the pgAdmin4 management tool by simply invoking the
startpg command.
$ startpg
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.
If you liked this article, then do subscribe to email alerts for Linux tutorials. If you
have any questions or doubts? do ask for help in the comments section.
Related Posts
Useful GUI Tools to Free Up Space on Ubuntu and Linux Mint
How to Burn CD/DVD in Linux Using Brasero
Best Tools to Install on Fresh Linux Mint Installation
How to Install KDE Plasma in Linux Desktop
How to Install ONLYOFFICE Desktop Editors in Linux
Thomas Tschoepke
December 2, 2021 at 12:23 am
Reply
Thomas Tschoepke
December 2, 2021 at 12:32 am
$ sudo curl
https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo
apt-key add
$ sudo sh -c 'echo "deb
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal
pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt
update'
$ sudo apt update
$ sudo apt install pgadmin4-desktop #for desktop
OR
$ sudo apt install pgadmin4-web #for web
If web version:
$ sudo /usr/pgadmin4/bin/setup-web.sh
Reply
Ami
February 27, 2022 at 7:29 am
E: The repository
'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal
pgadmin4 Release' does not have a Release file.
E: The repository 'http://apt.postgresql.org/pub/repos/apt
ulyssa-pgdg Release' does not have a Release file.
Reply
Ravi Saive
December 2, 2021 at 11:26 am
@Thomas,
I have tried it on my Linux Mint 20, and it worked well. What error are you
getting on your side?
Reply
Thomas Tschoepke
December 3, 2021 at 4:35 pm
Can’t remember the error. But with the steps, I posted above one does
not need virtual environments and stuff…
Reply
Jesus Reina
August 17, 2021 at 9:24 pm
pgadmin4env) root@usuario-Intel-powered-classmate-PC:~/pgadmin4#
python pgadmin4env/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py
NOTE: Configuring authentication for DESKTOP mode.
Traceback (most recent call last):
File “/root/pgadmin4/pgadmin4env/lib/python3.8/site-
packages/sqlalchemy/engine/base.py”, line 1771, in _execute_context
self.dialect.do_execute(
File “/root/pgadmin4/pgadmin4env/lib/python3.8/site-
packages/sqlalchemy/engine/default.py”, line 717, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: table version already exists
Reply
Aga
June 20, 2021 at 12:28 am
Got the same issue, does anyone know how to uninstall all of this?
Reply
Agung Setiawan
June 9, 2021 at 12:19 am
Same issue
Reply
sven
February 8, 2021 at 1:20 am
Step 11: The package is no longer available, currently you can use Version
4.30:
pip install
https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.30/pip/pgadmin4-4.30-
py3-none-any.whl
Step 13: Meanwhile in Version 4.30 there is a binary to start the server:
./pgadmin4env/bin/pgadmin4&
Reply
Ravi Saive
February 8, 2021 at 10:21 am
@Sven,
Reply
LJ
April 6, 2021 at 9:35 am
Can I ask that want version of python you used, because I got error like
this:
The above exception was the direct cause of the following exception:
]
(Background on this error at: http://sqlalche.me/e/14/e3q8)
^C
[1]+ Exit 1 ./pgadmin4env/bin/pgadmin4
Reply
Danny Hamshananth
April 16, 2021 at 12:07 pm
Hi LJ,
My Linux Mint is 20.1 Ulyssa and the Python version is 3.8.5 (The
default one available with the OS).
(https://stackoverflow.com/questions/7695962/postgresql-password-
authentication-failed-for-user-postgres)
Reply
Ahmad
May 11, 2021 at 3:04 am
Reply
Aditya Saxena
June 6, 2021 at 2:00 pm
Name *
Email *
Save my name, email, and website in this browser for the next time I comment.
Notify me of followup comments via e-mail. You can also subscribe without
commenting.
Post Comment
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Mhddfs – Combine Several Smaller Partition into One Large Virtual Storage
Linux Server Monitoring Tools
How to Record and Replay Linux Terminal Sessions using ‘script’ and
‘scriptreplay’ Commands
Tecmint: Linux Howtos, Tutorials & Guides © 2022. All Rights Reserved.
The material in this site cannot be republished either online or offline, without our permission.