phpPgAdmin es una interfaz web para administrar PostgreSQL. Permite crear bases de datos, ejecutar consultas y gestionar usuarios sin depender solo de la línea de comandos.
Requisitos
- Servidor Ubuntu 20.04.
- Usuario con sudo.
- Conexión a internet.
Actualizar e instalar PostgreSQL
$ sudo apt-get update -y $ sudo apt install postgresql postgresql-contrib -y
Inicia el servicio si hace falta:
$ sudo systemctl start postgresql.service $ sudo systemctl enable postgresql.service
Crear base de datos y usuario
$ sudo su - postgres $ psql
CREATE USER jerry WITH PASSWORD 'mystrongpassword'; CREATE DATABASE pgadmindb; GRANT ALL PRIVILEGES ON DATABASE pgadmindb TO jerry; \q
Instalar phpPgAdmin
$ sudo apt-get install phppgadmin -y
Por defecto, Apache solo sirve phpPgAdmin desde localhost. Para acceder desde otro equipo, edita:
$ sudo nano /etc/apache2/conf-available/phppgadmin.conf
Cambia:
Require local
Por:
Require all granted
Valida y reinicia Apache:
$ sudo apachectl configtest $ sudo systemctl restart apache2
Configurar UFW
$ sudo ufw allow http $ sudo ufw allow https $ sudo ufw status verbose
Acceder a phpPgAdmin
Abre:
https://server-ip/phppgadmin
Expande Servers, selecciona PostgreSQL e inicia sesión con el usuario creado. Restringe el acceso si el servidor es accesible desde redes no confiables.