DebianLinuxTutorials

How To Install pgAdmin on Debian 11

Install pgAdmin on Debian 11

In this tutorial, we will show you how to install pgAdmin on Debian 11. For those of you who didn’t know, pgAdmin is a free and open-source web-based tool that provides a friendly web interface to fully manage PostgreSQL databases, and it includes several features that can help you administer and maintain databases with ease. It’s written in Python and supports many operating systems such as Linux, Windows, and macOS.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of pgAdmin on a Debian 11 (Bullseye).

Prerequisites

  • A server running one of the following operating systems: Debian 11 (Bullseye).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install pgAdmin on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install wget software-properties-common apt-transport-https gnupg gnupg2

Step 2. Installing PostgreSQL.

Before installing pgAdmin5, the PostgreSQL server must be installed on your server. Now run the following command to install it:

sudo apt install postgresql

After installing PostgreSQL, start the PostgreSQL service and enable it to start at system reboot:

sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo systemctl status postgresql

For additional resources on installing PostgreSQL, read the post below:

Step 3. Installing pgAdmin on Debian 11.

By default, pgAdmin is not available to install directly from the Debian 11 base repository. Now we add the official pgAdmin repository to your system:

echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main"\
| sudo tee /etc/apt/sources.list.d/pgadmin4.list

Next, import the GPG key of the pgAdmin repository using the following command:

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

After that, install pgAdmin using the following command below:

sudo apt update
sudo apt install pgadmin4-web

Step 4. Configure pgAdmin.

Now we set up pgAdmin 4 before accessing it:

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

You will be asked to provide your Email and password to finish the configuration as shown below:

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: admin@idroot.us
Password: your-strong-passwd
Retype password: your-strong-passwd
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 << Type y and press Enter
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y << Type y and press Enter
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin

Step 5. Configure Firewall.

Before you can access the pgadmin4 web interface, if you have the UFW firewall running, you need to open port 80 (HTTP) to allow incoming traffic on the Apache service as follows:

sudo ufw allow 80
sudo ufw allow 443
sudo ufw status

Step 6. Access PgAdmin Web Interface.

Once successfully installed, open your web browser and type the URL http://your-server-ip/pgadmin4 to access the pgAdmin4 web interface. You will be redirected to the pgAdmin4 login page:

Install pgAdmin on Debian 11 Bullseye

Congratulations! You have successfully installed pgAdmin. Thanks for using this tutorial for installing the latest version of pgAdmin on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official pgAdmin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button