๐ How to Install pgAdmin 4 Web on a Remote Ubuntu Server via SSH (With Full Error Fixes)
Managing PostgreSQL via the command line is powerful — but sometimes, you need a graphical interface. pgAdmin 4 in web mode is a top-tier choice for PostgreSQL management. In this guide, you'll learn how to install pgAdmin 4 on a remote Ubuntu server via SSH, and fix every common error along the way.
๐ฏ By the end, you’ll have pgAdmin 4 running in your browser, ready to manage any PostgreSQL server — local or remote.
๐งฐ Prerequisites
Make sure you have:
-
โ Ubuntu 20.04 or later on your server
-
โ SSH access (user or root)
-
โ PostgreSQL already installed (optional, but recommended)
๐ฅ Step 1: SSH Into Your Server
First, connect to your Ubuntu server:
ssh your-user@your-server-ip
Example using a username:
ssh devlop@103.206.13.xxx
๐ Step 2: Update Packages and Install Dependencies
Update your package list and install essential dependencies, including Apache (required for pgAdmin web mode):
sudo apt update && sudo apt upgrade -y
sudo apt install curl ca-certificates gnupg apache2 -y
Make sure Apache is installed before you install pgAdmin.
๐ฆ Step 3: Add the pgAdmin Repository
Add the official pgAdmin APT repository securely using GPG:
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/pgadmin.gpg
echo "deb [signed-by=/usr/share/keyrings/pgadmin.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" | sudo tee /etc/apt/sources.list.d/pgadmin4.list
sudo apt update
๐งฑ Step 4: Install pgAdmin 4 Web Mode
Now install the web version of pgAdmin 4:
sudo apt install pgadmin4-web -y
โ๏ธ Step 5: Run the Setup Script
Initialize pgAdmin:
sudo /usr/pgadmin4/bin/setup-web.sh
You should see:
"Enter the email address and password to use for the pgAdmin user account:"
If you don’t see this, no worries — a fix is below.
Say yes (y) to restarting Apache when prompted.
๐ Common Errors & Fixes
โ Didn’t Get Prompted for Email/Password?
This means pgAdmin was already initialized without a user.
โ Fix it:
sudo rm -rf /var/lib/pgadmin
sudo /usr/pgadmin4/bin/setup-web.sh
You’ll now be prompted to set the email and password.
โ Apache Fails to Start?
Check Apache status:
sudo systemctl status apache2
If you see:
apache2: Could not open configuration file /etc/apache2/apache2.conf: No such file or directory
โ Fix it by reinstalling Apache:
sudo apt purge apache2 apache2-utils apache2-bin apache2.2-common -y
sudo rm -rf /etc/apache2
sudo apt install apache2 -y
Then rerun the setup:
sudo /usr/pgadmin4/bin/setup-web.sh
โ Port 80 Already in Use?
Check what’s using port 80:
sudo lsof -i :80
If it's another service (like nginx or tor):
โ Stop it:
sudo systemctl stop nginx
Then restart Apache:
sudo systemctl restart apache2
๐ Step 6: Access pgAdmin in Your Browser
Now head to your browser and go to:
http://your-server-ip/pgadmin4
Or, for local access:
http://103.206.13.xxx/pgadmin4
Log in using the email and password you set earlier.
๐๏ธ Step 7: Connect to Your PostgreSQL Server
Once logged in:
-
Click “Add New Server”
-
Go to the Connection tab and enter:
-
Save the server, and you're in!
| Field | Value |
|---|---|
| Hostname/address | localhost (or your server IP address) |
| Port | 5432 (default for PostgreSQL) |
| Maintenance DB | postgres |
| Username | postgres or the DB user you created |
| Password | Your PostgreSQL password |
๐งฉ Step-by-Step: Register a New Server in pgAdmin
๐ 1. Open pgAdmin
-
Open your browser and go to:
https://admin.imvickykumar999.online/
๐ 2. Click "Add New Server"
-
On the pgAdmin welcome dashboard, find "Quick Links" → "Add New Server"
-
Alternatively, right-click on "Servers" in the Object Explorer panel (left sidebar), then click "Create → Server..."
๐ 3. In the "Create - Server" Dialog
๐ธ General Tab
-
Name: Give any name (e.g.,
Chatbot DB,Local PostgreSQL, etc.)
๐ธ Connection Tab
Here’s where you enter your actual database details:
| Field | Value |
|---|---|
| Host name/address | localhost (if pgAdmin is on the same machine as PostgreSQL) or use 127.0.0.1 or server IP |
| Port | 5432 (default PostgreSQL port) |
| Maintenance database | chatbot |
| Username | bol7user |
| Password | Your password (e.g., bol3452&^$&(124)) |
| Save Password? | โ Check this for convenience |
โ๏ธ 4. Advanced (Optional)
If you want to customize the connection timeout or SSL settings, use the Advanced or SSL tabs.
๐พ 5. Save and Connect
-
Click the Save button.
-
pgAdmin will now attempt to connect to the PostgreSQL server using the credentials you provided.
-
If successful, you’ll see the new server listed under Servers on the left panel, with expandable objects like databases, schemas, tables, etc.
โ Final Test
After successful connection:
-
Expand:
-
Servers → [Your Server] → Databases → chatbot → Schemas → public → Tables
-
-
Right-click
Tables → View/Edit Data → All Rowsto browse content. -
Or go to
Tools → Query Tooland run:
SELECT * FROM users;
๐ ๏ธ Troubleshooting
| Issue | Fix |
|---|---|
| โ "Connection refused" | Make sure PostgreSQL is running, and that port 5432 is open |
| โ "Password authentication failed" | Double-check the bol7user credentials |
| โ "No such table" | Ensure you're connecting to the correct database (chatbot) |
โ Final Summary
By now, you’ve successfully:
-
Installed pgAdmin 4 Web Mode on Ubuntu
-
Handled all common Apache and pgAdmin setup issues
-
Connected to your PostgreSQL server via GUI
pgAdmin 4 is now running on your server, available in any browser — and ready to manage all your databases.
๐ฌ Questions? Comments? Let me know below or reach out — happy to help troubleshoot!
1 Comments
Vicky Kumar
If you forget passowrd, you can reset using: ALTER USER youruser WITH PASSWORD 'NewSecurePasswordHere';