19.6 C
Texas
angeloma
Senior Writer and partner

How to install PgAdmin 4 on Debian 10?

It is said that a database is the brain and heart of a system or even an organization. That’s why administering the database server is quite an important task nowadays. But it’s not always an easy task, so there are tools that help with this task. And if the database manager is PostgreSQL then it’s even more important to use a quality tool at the height of this program. So, in this post, I will show you how to install PgAdmin 4 on Debian 10. 

PgAdmin 4 is a new major version of an application written in several languages that provides a friendly web interface to fully manage a PostgreSQL server. If you use PostgreSQL for your projects and work, you will most likely need PgAdmin 4 as well.

So let’s get started.

Install PgAdmin 4 on Debian 10 

Install PostgreSQL 12 on Debian 10

PgAdmin 4 is for managing a PostgreSQL server, so it requires that it be installed correctly on a server. 

- Advertisement -

For this, we will take the opportunity to install PostgreSQL 12 and if you want to know how to install it, read our post about it:

How to install PostgreSQL 12 on Debian 10?

In this post, we will assume that PostgreSQL and PgAdmin 4 are on the same computer. But don’t worry, in case you don’t just add the PostgreSQL 12 repository on the client (explained in the previous post) and move on. 

Getting PgAdmin 4 on Debian 10

If you have installed PostgreSQL 12 with our guide, then you already have the repository added correctly, so to install PgAdmin 4 just use this command:

:~$ sudo apt install pgadmin4 pgadmin4-apache2
Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following additional packages will be installed:
   adwaita-icon-theme alembic apache2 apache2-bin apache2-data apache2-utils at-spi2-core fontconfig fonts-font-awesome fonts-open-sans fonts-roboto-unhinted
   glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme javascript-common
   libapache2-mod-wsgi-py3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libbrotli1
   libcairo-gobject2 libcroco3 libcurl4 libdatrie1 libdouble-conversion1 libegl-mesa0 libegl1 libepoxy0 libevdev2 libfribidi0 libgbm1 libgdk-pixbuf2.0-0
   libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgraphite2-3 libgtk-3-0 libgtk-3-bin libgtk-3-common libharfbuzz0b libinput-bin libinput10 libjansson4 libjs-jquery
   libjs-sphinxdoc libjs-underscore libjson-glib-1.0-0 libjson-glib-1.0-common liblua5.2-0 libmtdev1 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpcre2-16-0
   libproxy1v5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5svg5 libqt5widgets5 librest-0.7-0 librsvg2-2 librsvg2-common libsodium23 libsoup-gnome2.4-1
   libsoup2.4-1 libthai-data libthai0 libwacom-bin libwacom-common libwacom2 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libxcb-icccm4
   libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-util0 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcursor1 libxkbcommon-x11-0 libxkbcommon0
   pgadmin4-common pgadmin4-doc python-babel-localedata python3-alembic python3-asn1crypto python3-babel python3-bcrypt python3-blinker python3-cffi-backend
   python3-click python3-colorama python3-cryptography python3-dateutil python3-distutils python3-editor python3-flask python3-flask-babelex python3-flask-compress
   python3-flask-gravatar python3-flask-login python3-flask-mail python3-flask-migrate python3-flask-paranoid python3-flask-principal python3-flask-security
   python3-flask-sqlalchemy python3-flaskext.wtf python3-itsdangerous python3-jinja2 python3-lib2to3 python3-mako python3-markupsafe python3-nacl python3-openssl
   python3-paramiko python3-passlib python3-psutil python3-psycopg2 python3-pyasn1 python3-pyinotify python3-simplejson python3-sqlalchemy python3-sqlalchemy-ext
   python3-sqlparse python3-sshtunnel python3-tz python3-werkzeug python3-wtforms qt5-gtk-platformtheme qttranslations5-l10n
 Suggested packages:
   apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser gvfs qt5-image-formats-plugins qtwayland5 librsvg2-bin python-blinker-doc
   python-cryptography-doc python3-cryptography-vectors python-flask-doc python-flask-login-doc python-jinja2-doc python3-beaker python-mako-doc python-nacl-doc
   python-openssl-doc python3-openssl-dbg python3-gssapi python-psutil-doc python-psycopg2-doc python-pyinotify-doc python-sqlalchemy-doc python3-mysqldb python3-fdb
   python-sqlparse-doc ipython3 python-werkzeug-doc python3-lxml python3-termcolor python3-watchdog python3-django python3-django-localflavor
 The following NEW packages will be installed:
   adwaita-icon-theme alembic apache2 apache2-bin apache2-data apache2-utils at-spi2-core fontconfig fonts-font-awesome fonts-open-sans fonts-roboto-unhinted
   glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas gtk-update-icon-cache hicolor-icon-theme javascript-common
   libapache2-mod-wsgi-py3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libbrotli1
   libcairo-gobject2 libcroco3 libcurl4 libdatrie1 libdouble-conversion1 libegl-mesa0 libegl1 libepoxy0 libevdev2 libfribidi0 libgbm1 libgdk-pixbuf2.0-0
   libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgraphite2-3 libgtk-3-0 libgtk-3-bin libgtk-3-common libharfbuzz0b libinput-bin libinput10 libjansson4 libjs-jquery
   libjs-sphinxdoc libjs-underscore libjson-glib-1.0-0 libjson-glib-1.0-common liblua5.2-0 libmtdev1 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpcre2-16-0
   libproxy1v5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5svg5 libqt5widgets5 librest-0.7-0 librsvg2-2 librsvg2-common libsodium23 libsoup-gnome2.4-1
   libsoup2.4-1 libthai-data libthai0 libwacom-bin libwacom-common libwacom2 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libxcb-icccm4
   libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-util0 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcursor1 libxkbcommon-x11-0 libxkbcommon0
   pgadmin4 pgadmin4-apache2 pgadmin4-common pgadmin4-doc python-babel-localedata python3-alembic python3-asn1crypto python3-babel python3-bcrypt python3-blinker
   python3-cffi-backend python3-click python3-colorama python3-cryptography python3-dateutil python3-distutils python3-editor python3-flask python3-flask-babelex
   python3-flask-compress python3-flask-gravatar python3-flask-login python3-flask-mail python3-flask-migrate python3-flask-paranoid python3-flask-principal
   python3-flask-security python3-flask-sqlalchemy python3-flaskext.wtf python3-itsdangerous python3-jinja2 python3-lib2to3 python3-mako python3-markupsafe python3-nacl
   python3-openssl python3-paramiko python3-passlib python3-psutil python3-psycopg2 python3-pyasn1 python3-pyinotify python3-simplejson python3-sqlalchemy
   python3-sqlalchemy-ext python3-sqlparse python3-sshtunnel python3-tz python3-werkzeug python3-wtforms qt5-gtk-platformtheme qttranslations5-l10n
 0 upgraded, 147 newly installed, 0 to remove and 51 not upgraded.
 Need to get 75.7 MB of archives.
 After this operation, 252 MB of additional disk space will be used.
 Do you want to continue? [Y/n]
1.- Installing PgAdmin 4 on Debian 10
1.- Installing PgAdmin 4 on Debian 10

During the installation of the package, the installer will ask you to set up an email and password that will be used for the initial login to access the application. This can be changed but it is recommended that it be a strong password.

2.- Set a new login account
2.- Set a new login account

Then you need to open ports 80 and 443 which are the ports that apache uses to serve the web interface. I also remind you that you have to open port 5432 for remote communication with PostgreSQL.

Now if you have not set a password for the default PostgreSQL database, PgAdmin will not be able to connect. So this needs to be changed.

On the computer where PostgreSQL is installed run the following command:

:~$ sudo -i -u postgres

Then, access the PostgreSQL 12 console.

:~# psql

And now execute the following command to set a new password for access to the database by the postgres user.

postgres password  
3.- Configuring PostgreSQL 12 to work with PgAdmin 4
3.- Configuring PostgreSQL 12 to work with PgAdmin 4

Enter the desired password and exit the shell.

Using PgAdmin on Debian 10

Now yes, open your favorite web browser and go to http://your-server/pgadmin4 and you will see the following:

4.- PgAdmin 4 log in screen
4.- PgAdmin 4 login screen

Once you have entered your credentials (created during the installation), you will be able to access the PgAdmin 4 home page.

5.- PgAdmin main screen
5.- PgAdmin main screen

Click on the Add new Server button to add a new PostgreSQL connection. In the General tab assign a name and in the connection tab the connection parameters to the server.

6.- Adding a new server
6.- Adding a new server

In case the PostgreSQL server is on another server in the Host name / Address field you have to change localhost to the necessary one.

If everything went well, then you will have a new connection on the left side available.

7.- PgAdmin 4 working on Debian 10
7.- PgAdmin 4 working on Debian 10

So, enjoy PgAdmin 4 on Debian 10.

Conclusion

PgAdmin 4 is a very important version of this application to manage a PostgreSQL server. And today you have learned how to install it in Debian 10 without major problems. However, this application becomes very necessary when we work with a lot of data or several connections.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article