How To Install pgAdmin 4 on Debian 11|10|9

Posted on 26 views

How to Install pgAdmin4 on Debian 11 / Debian 10 / Debian 9 Linux system?. pgAdmin is a feature-rich and open source PostgreSQL administration and development platform that runs on Linux, Unix, Mac OS X, and Windows. pgAdmin allows you to manage PostgreSQL 9.2 and above from a web interface.

Install pgAdmin4 on Debian 11/10/9

You need to have PostgreSQL installed on your system before you can install pgAdmin 4. Refer to the guide below:

After the installation of PostgreSQL database server on Debian 11/10/9, proceed to install pgAdmin4 packages.

Step 1: And pgAdmin repository to Debian 11/10/9

The pgAdmin DEBs for Debian are available from the pgAdmin APT repository. Start the repository setup process by installing the public key for the repository:

sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

Then create the repository configuration file:

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'

You can check the contents of the repository file created using the following command:

$ cat /etc/apt/sources.list.d/pgadmin4.list
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bullseye pgadmin4 main

Step 2: Install pgAdmin4 on Debian 11/10/9

With the repository added you can now install pgAdmin 4 on Debian 11/10/9 Linux system:

sudo apt update
sudo apt install pgadmin4

During installation a number of packages are also installed as dependencies:

...
The following NEW packages will be installed:
  adwaita-icon-theme apache2 apache2-bin apache2-data apache2-utils at-spi2-core bzip2 cpp cpp-10 dbus-user-session dconf-gsettings-backend dconf-service fontconfig fontconfig-config
  fonts-dejavu-core glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme libapache2-mod-wsgi-py3 libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatomic1 libatspi2.0-0 libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3
  libcairo-gobject2 libcairo2 libclone-perl libcolord2 libcups2 libdata-dump-perl libdatrie1 libdconf1 libdeflate0 libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2
  libencode-locale-perl libepoxy0 libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libfont-afm-perl libfontconfig1 libfontenc1 libfribidi0
  libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgtk-3-0 libgtk-3-bin libgtk-3-common
  libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libice6 libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libisl23 libjansson4 libjbig0 libjpeg62-turbo libjson-glib-1.0-0
  libjson-glib-1.0-common liblcms2-2 liblua5.3-0 liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libmpc3 libmpfr6 libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl
  libnet-ssleay-perl libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpixman-1-0 libproxy1v5 libpython3.9 librest-0.7-0 librsvg2-2 librsvg2-common libsm6 libsoup-gnome2.4-1
  libsoup2.4-1 libtext-iconv-perl libthai-data libthai0 libtie-ixhash-perl libtiff5 libtimedate-perl libtry-tiny-perl liburi-perl libvte-2.91-0 libvte-2.91-common libvulkan1 libwayland-client0
  libwayland-cursor0 libwayland-egl1 libwebp6 libwww-perl libwww-robotrules-perl libx11-6 libx11-data libx11-protocol-perl libx11-xcb1 libxau6 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
  libxcb-present0 libxcb-randr0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxft2 libxi6
  libxinerama1 libxkbcommon0 libxkbfile1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxmuu1 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1
  libxxf86dga1 libxxf86vm1 mailcap mesa-vulkan-drivers mime-support perl-openssl-defaults pgadmin4 pgadmin4-desktop pgadmin4-server pgadmin4-web shared-mime-info termit x11-common x11-utils
  x11-xserver-utils xdg-utils xkb-data
0 upgraded, 193 newly installed, 0 to remove and 0 not upgraded.
Need to get 244 MB of archives.
After this operation, 242 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

If you wanted to install the desktop mode only, run the commands below:

sudo apt install pgadmin4-desktop

For web mode only use:

sudo apt install pgadmin4-web

Step 3: Configure Web Server for pgAdmin4

For guys who installed web mode, you need to configure the webserver by running the command:

sudo /usr/pgadmin4/bin/setup-web.sh

You’ll be asked to provide email address for the initial pgAdmin user account:

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: 
Password: 
Retype password: 
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...

Agree for the configuration of Apache Web server.

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

Step 4: Access pgAdmin 4 Web interface

If you have UFW firewall configured, allow http and https traffic.

sudo ufw allow http
sudo ufw allow https

Open your web browser and access pgAdmin 4 dashboard:

 http://[ServerIP_or_domain]/pgadmin4

You should see pgAdmin4 login dashboard which has a look similar to this:

install-pgadmin-debian-10-9-8-04-1024x497

Use the set email address and password.

install-pgadmin-debian-10-9-8-05-1024x419

On the first page of pgAdmin, add a PostgreSQL server to administer with pgAdmin by clicking on “Add New Server”. This can be local or a remote PostgreSQL server.

pgAdmin-centos-7-fedora-29-add-server-01-1024x202

Under the “General” section, give the server a name & description.

pgAdmin-centos-7-fedora-29-addd-server-02-1024x777

Under “Connection” tab, provide access details – DB host, DB user and Password.

pgAdmin-centos-7-fedora-29-add-server-03-1013x1024

When done, Click Save button to save the configurations. If you were successful adding the server, the name will appear in the left sidebar. Select the server to see database summary information and make changes.

install-pgadmin-debian-10-9-8-06-1024x297

You now have pgAdmin 4 installed on Debian 11/10/9 server or Desktop. Learn to use pgAdmin from the documentation page.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.