PGAdmin is a web-based GUI tool used to interact with the Postgres database sessions, both locally and remote servers as well. It is an open-source, powerful, and feature-rich graphical user interface (GUI) administration and management tool for the PostgreSQL database. It provides a powerful user interface that enables you to easily create, manage, maintain and use database objects, by both beginners and experienced Postgres users alike.
pgAdmin 4 supports PostgreSQL 9.2 or later, and runs on Unix and its variants such as Linux, Mac OS X as well as Windows operating systems.
In this article, we will learn how to install pgadmin 4 on Ubuntu 20.04 server. This guide assumes that you already have Postgres 9.2 installed and set up. If not checkout How to Install and Configure Postgres 14 Ubuntu 20.04
- How to manage Postgres users and database permissions
- How to Install and Configure Postgres 14 on Debian 11
- How to Use Ansible to Install and Configure Postgres 14 on Debian 11
- How to Install & Configure Postgres 14 on FreeBSD 13
- Running Postgresql 14 with Docker and Docker-Compose
- How to Install and Configure Postgres 14 on Rocky Linux/Centos 8
- How to Install and Configure Postgres 14 Ubuntu 20.04
- How to Install and Configure Postgres 14 on Fedora 34
- How to Install & Configure Postgres 14 on OpenSUSE Leap 15.3
Table of Content
- Ensuring that the server is up to date
- Setting up pgadmin 4 repo
- Installing pgadmin 4
- Accessing the pgAdmin 4 web interface
1. Ensuring that the server is up to date
Before proceeding, let us ensure that our server has updated packages. Use this command to achieve that:
sudo apt update sudo apt upgrade -y
2. Setting up pgadmin 4 repo
The pgadmin 4 package is not found in the default Ubuntu repositories. Let us set up pgadmin repo that will allow us to install and keep track of updates for future pgadmin releases.
Install the public key for the repository
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
Create the repository configuration file and updating the repos:
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
3. Installing pgadmin 4
We can finally install pgadmin. pgadmin is available in both desktop and web mode. If you are running postgres on a local Ubuntu desktop system, the desktop mode is recommended, otherwise the web mode will work just fine. In my case I will be installing the web mode.
To Install for both desktop and web modes:
sudo apt install pgadmin4
To Install for desktop mode only
sudo apt install pgadmin4-desktop
To Install for web mode only:
sudo apt install pgadmin4-web
Once you have the web mode installed, you need to configure it before using. The installation will help set up an initial user and a web server to serve the content. Use this command to configure
This is the output on my system:
$ sudo /usr/pgadmin4/bin/setup-web.sh Setting up pgAdmin 4 in web mode on a Debian based platform... Creating configuration database... NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: [email protected] Password: Retype password: pgAdmin 4 - Application Initialisation ====================================== Creating storage and log directories... We can now configure the Apache Web server for you. This involves enabling the wsgi module and configuring the pgAdmin 4 application to mount at /pgadmin4. Do you wish to continue (y/n)? y The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4
4. Accessing the pgAdmin 4 web interface
Now you can access the pgAdmin 4 web interface. Open a web browser and point it to the address http://127.0.0.1/pgadmin4 or http://SERVER_IP/pgadmin4 and click Enter.
The pgadmin 4 login page will load prompting you for the email address and password that you set earlier. Click login after entering it.
After a successful login, you will land at the pgAdmin4 web interface default dashboard.
To connect to a database server, click on Add New Server. Then add the new server connection name and a comment. Click on the Connection Tab to provide the connection details I.e hostname, database name, database username, and password as shown in the following screenshot. Once you are done, click Save.
Under the Browser, click on the Servers to expand. You should have the server you added. It will show the databases, roles, and table space. Expand the Database link to view the server performance overview under the Dashboard.
We did manage to install pgadmin 4 on Ubuntu 20.04 and add server connection in this guide.
Pingback: Links 20/12/2021: helloSystem 0.7, Steam Deck as a Console, and Much More | Techrights
Awesome post. I install PgAdmin on Ubuntu easily and worked treat.