In this tutorial, you are going to learn how to Install pgAdmin on Ubuntu 22.04. PGAdmin is a web and desktop graphical user interface (GUI) application for interacting with Postgres database sessions on both local and remote servers. PGAdmin can be used to do any database administration tasks for a Postgres database. It is the most widely used and feature-rich administration and development environment for PostgreSQL, the world’s most powerful Open Source database. pgAdmin can be used to manage PostgreSQL and EDB Advanced Server 10 and higher on Linux, Unix, macOS, and Windows. Check out our previous article on how to install PostgreSQL on Ubuntu 22.04.
How to Install pgAdmin on Ubuntu 22.04
- To install pgAdmin on Ubuntu 22.04, you need to install the the pgAdmin repositories.
- Beore you can install the pgAdmin repositories, install the following package;
apt install libpq5
- Next, import GPG signing key for the repo using the following command.
wget -qO- https://www.pgadmin.org/static/packages_pgadmin_org.pub \
| sudo gpg --dearmor > /etc/apt/trusted.gpg.d/pgadmin.gpg
- Next, pgAdmin4 PPA should be added to your system, use the command below. Note that currently, no repositories for Ubuntu 22.04, hence,we use the repositories for Ubuntu 21.10;
sudo sh -c \
'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/impish pgadmin4 main" \
> /etc/apt/sources.list.d/pgadmin4.list'
- Then update your system for changes to take effect.
sudo apt update
Install pgadmin 4 on Ubuntu 22.04
- Both desktop and web versions of pgadmin are available. You can install both or just one, depending on your preferences, such as whether you’re using Ubuntu Desktop or Ubuntu Server. In my case I will install web version.
- Use the command below to install both the desktop and web version.
sudo apt install pgadmin4
- To Install desktop version only run the following command.
sudo apt install pgadmin4-desktop
- To Install web version only run the command below.
sudo apt install pgadmin4-web
Sample output
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: galera-4 libaio1 libconfig-inifiles-perl libdbd-mariadb-perl libfprint-2-tod1 libhtml-template-perl libmariadb3 libpmem1 libreadline5 libterm-readkey-perl mariadb-client-10.7 mariadb-client-core-10.7 mariadb-common mariadb-server-10.7 mariadb-server-core-10.7 socat Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libapache2-mod-wsgi-py3 pgadmin4-server The following NEW packages will be installed: libapache2-mod-wsgi-py3 pgadmin4-server pgadmin4-web 0 upgraded, 3 newly installed, 0 to remove and 3 not upgraded. Need to get 96.5 MB of archives. After this operation, 300 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libapache2-mod-wsgi-py3 amd64 4.6.8-1ubuntu3 [93.3 kB] Get:2 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main amd64 pgadmin4-server amd64 6.5 [96.4 MB] Get:3 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4/main all pgadmin4-web all 6.5 [2,644 B] Fetched 96.5 MB in 1min 35s (1,011 kB/s) Selecting previously unselected package libapache2-mod -wsgi-py3. (Reading database ... 204924 files and directories cur rently installed.) Preparing to unpack .../libapache2-mod-wsgi-py3_4.6.8- 1ubuntu3_amd64.deb ... Unpacking libapache2-mod-wsgi-py3 (4.6.8-1ubuntu3) ... Selecting previously unselected package pgadmin4-serve r. Preparing to unpack .../pgadmin4-server_6.5_amd64.deb ... Unpacking pgadmin4-server (6.5) ... Selecting previously unselected package pgadmin4-web. Preparing to unpack .../pgadmin4-web_6.5_all.deb ... Unpacking pgadmin4-web (6.5) ... Setting up pgadmin4-server (6.5) ... Setting up libapache2-mod-wsgi-py3 (4.6.8-1ubuntu3) .. . apache2_invoke: Enable module wsgi Setting up pgadmin4-web (6.5) ...
- Next, set up pgadmin4-web. Note: To add a login screen to the web dashboard, you need to run the following command if you installed both or only pgadmin4-web.
sudo /usr/pgadmin4/bin/setup-web.sh
Sample output
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
- When the above script runs, enter email and password that you will use to log in into your dashboard.
Access pgAdmin 4 Web Interface on Ubuntu 22.04
- To access pgAdmin 4 web GUI on Ubuntu 22.04, open your favorite browser and enter the URL
http://127.0.0.1/pgadmin4
orhttp://server-IP/pgadmin4
as shown below. Enter email and password you created to log in.
- You will be redirected to the pgAdmin4 web dashboard after a successful login.
- Click Add New Server to connect to a database server.
- Then fill in all the required info.
- If the connection is successful, you will be redirected to the dashboard showing your database stats.
- You have reached the end of the article, Congratulations. You have learned how to Install pgAdmin on Ubuntu 22.04.
Other Tutorials
Install MariaDB 10.7 on CentOS 7
Instructions do not work for Ubuntu 22.04. PGAdmin 4 desktop faisl to start
pgAdmin Runtime Environment
——————————————————–
Python Path: “/usr/pgadmin4/venv/bin/python3”
Runtime Config File: “/home/bob/.config/pgadmin/runtime_config.json”
pgAdmin Config File: “/usr/pgadmin4/web/config.py”
Webapp Path: “/usr/pgadmin4/web/pgAdmin4.py”
pgAdmin Command: “/usr/pgadmin4/venv/bin/python3 -s /usr/pgadmin4/web/pgAdmin4.py”
Environment:
– LANGUAGE: en_GB:en
– USER: bob
– J2SDKDIR: /usr/lib/jvm/java-17-oracle
– XDG_SESSION_TYPE: x11
– J2REDIR: /usr/lib/jvm/java-17-oracle
– SHLVL: 0
– HOME: /home/bob
– DESKTOP_SESSION: ubuntu
– GIO_LAUNCHED_DESKTOP_FILE: /usr/share/applications/pgadmin4.desktop
– GTK_MODULES: gail:atk-bridge
– GNOME_SHELL_SESSION_MODE: ubuntu
– MANAGERPID: 2535
– SYSTEMD_EXEC_PID: 2798
– DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus
– GIO_LAUNCHED_DESKTOP_FILE_PID: 65318
– IM_CONFIG_PHASE: 1
– MANDATORY_PATH: /usr/share/gconf/ubuntu.mandatory.path
– LOGNAME: bob
– _: /usr/bin/dbus-update-activation-environment
– JOURNAL_STREAM: 8:47327
– DESKTOP_AUTOSTART_ID: 1047a6b51184fa4e63165113116898610600000027980019
– DEFAULTS_PATH: /usr/share/gconf/ubuntu.default.path
– XDG_SESSION_CLASS: user
– USERNAME: bob3
– GNOME_DESKTOP_SESSION_ID: this-is-deprecated
– WINDOWPATH: 2
– PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/lib/jvm/java-17-oracle/bin:/usr/lib/jvm/java-17-oracle/db/bin
– DERBY_HOME: /usr/lib/jvm/java-17-oracle/db
– INVOCATION_ID: be5f7f08fa0a4eb3b915ba7669d3308b
– SESSION_MANAGER: local/bob-laptop:@/tmp/.ICE-unix/2798,unix/bob-laptop:/tmp/.ICE-unix/2798
– XDG_RUNTIME_DIR: /run/user/1000
– XDG_MENU_PREFIX: gnome-
– GDK_BACKEND: x11
– DISPLAY: :1
– LANG: en_GB.UTF-8
– XDG_CURRENT_DESKTOP: ubuntu:GNOME
– XAUTHORITY: /run/user/1000/gdm/Xauthority
– XDG_SESSION_DESKTOP: ubuntu
– XMODIFIERS: @im=ibus
– SSH_AGENT_LAUNCHER: gnome-keyring
– SSH_AUTH_SOCK: /run/user/1000/keyring/ssh
– SHELL: /bin/bash
– QT_ACCESSIBILITY: 1
– GDMSESSION: ubuntu
– GPG_AGENT_INFO: /run/user/1000/gnupg/S.gpg-agent:0:1
– QT_IM_MODULE: ibus
– JAVA_HOME: /usr/lib/jvm/java-17-oracle
– PWD: /home/bob
– XDG_DATA_DIRS: /usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
– XDG_CONFIG_DIRS: /etc/xdg/xdg-ubuntu:/etc/xdg
– NO_AT_BRIDGE: 1
– PGADMIN_INT_PORT: 44747
– PGADMIN_INT_KEY: 4fafa50e-9176-47a5-b1b2-16e89a46e99d
– PGADMIN_SERVER_MODE: OFF
——————————————————–
Failed to launch pgAdmin4. Error:
Error: spawn /usr/pgadmin4/venv/bin/python3 ENOENT
How to restart pgadmin4 server?