If you’re looking for a lightweight, single-file database admin tool for PostgreSQL that’s easier to host than phpPgAdmin, Adminer is your best bet. Here’s how to set it up behind Apache on Ubuntu.
Step 1: Update Your System and Install Required Packages
Make sure your system is up to date, and install Apache, PHP, PostgreSQL client tools, and Adminer:
sudo apt-get update
sudo apt-get install -y apache2 php libapache2-mod-php postgresql-client adminer
Check your PHP version:
php -v
Note the version (e.g., 8.1) — you’ll need it in the next step.
Step 2: Enable the Apache PHP Module
Enable the PHP module in Apache. Replace php8 with the actual version you found:
sudo a2enmod php8.1
Step 3: Serve Adminer from Apache
Rather than spinning up a new virtual host, just add Adminer to your default Apache site.
-
Create a symbolic link so Adminer is accessible from your web directory:
sudo ln -s /usr/share/adminer/adminer /var/www/html/adminer
-
Edit the default site config:
sudo nano /etc/apache2/sites-available/000-default.conf
Add this inside the <VirtualHost *:80> block:
Alias /adminer /usr/share/adminer
<Directory "/usr/share/adminer">
Require all granted
DirectoryIndex adminer.php
</Directory>
<Location /adminer>
ProxyPass !
</Location>
Make sure permissions are set correctly:
sudo chown -R www-data:www-data /usr/share/adminer
sudo chmod -R 755 /usr/share/adminer
Step 4: Restart Apache and Enable the Config
Restart the web server to apply changes:
sudo a2ensite 000-default
sudo systemctl restart apache2
To debug errors:
sudo tail -f /var/log/apache2/error.log
Quick Recap
-
Adminer is now available at
http://your-server-ip/adminer -
It’s a great lightweight alternative to phpMyAdmin
-
You can manage PostgreSQL (and MySQL, SQLite, etc.) easily
-
It plays nicely with Apache + PHP with minimal config
Got feedback? Ping me on LinkedIn.