frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

How To Install pgAdmin 4 on Ubuntu and Debian

Introduction

pgAdmin 4 is a powerful web-based tool for managing PostgreSQL databases. This guide provides step-by-step instructions for installing and configuring pgAdmin 4 on Ubuntu (version 22.04 and later) and Debian 11/12.

Prerequisites

Apache: pgAdmin requires a web server like Apache. If Apache is not installed, you can install it using our guide.

Installation Guide

1. Update the system

Update package lists:

apt update

2. Add the pgAdmin repository key

Run this command to add the repository key:

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

3. Add the pgAdmin repository

Add the pgAdmin repository by running the following command:

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'

4. Install pgAdmin 4

Now you can install pgAdmin 4:

apt install pgadmin4 -y

5. Run the pgAdmin 4 setup script

Nest run the pgAdmin 4 installation script:

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

6. Open Ports 80 and 443

To allow web traffic to pgAdmin, open the necessary ports based on your firewall setup.

Using IPtables

If you use IPtables, run:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT

To save the changes, install iptables-persistent (if not installed):

apt install iptables-persistent -y

Then save the rules:

iptables-save | tee /etc/iptables/rules.v4

Using UFW

If you use UFW (Uncomplicated Firewall), run:

ufw allow 'Apache Full'

Reload UFW:

ufw reload

7. Access pgAdmin 4

Once installed, access pgAdmin 4 via:

http://SERVER_IP/pgadmin4

Replace SERVER_IP with your server's actual IP address.

On the Login page, enter the email address and password you set during the installation process.

After logging in, you will see the pgAdmin dashboard. Now you can start working with pgAdmin:

Conclusion

PgAdmin 4 has been installed and set up successfully on your server. You can now use its web interface to manage your PostgreSQL databases efficiently.

Sign In or Register to comment.

Time4VPS

Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2025 Time4VPS. All rights reserved.

Get In Touch