pgAdmin è uno strumento open source di gestione per PostgreSQL e database derivati. Può essere eseguito come applicazione web o desktop. In questa guida lo installeremo in modalità server su CentOS 7, RHEL 7, Fedora 29 e Fedora 28.
Prerequisiti
È necessario avere PostgreSQL già installato e configurato il repository EPEL:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Configura il repository PostgreSQL
Esempio per PostgreSQL 11 su RHEL 7:
yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-redhat11-11-2.noarch.rpm
Su Fedora usa il pacchetto dnf corrispondente alla versione di Fedora.
Installa pgAdmin 4
# RHEL/CentOS yum -y install pgadmin4 # Fedora dnf -y install pgadmin4
Avvia Apache:
systemctl start httpd systemctl enable httpd
Configura pgAdmin 4
cp /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf mkdir /var/log/pgadmin4/ mkdir /var/lib/pgadmin4/
Modifica il file di configurazione locale:
vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_local.py
Aggiungi:
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log' SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db' SESSION_DB_PATH = '/var/lib/pgadmin4/sessions' STORAGE_DIR = '/var/lib/pgadmin4/storage'
Imposta i permessi:
chown -R apache:apache /var/lib/pgadmin4/* chown -R apache:apache /var/log/pgadmin4/*
Crea l'utente web di pgAdmin:
python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py
Riavvia Apache:
systemctl restart httpd
Firewall e accesso
firewall-cmd --permanent --add-service=http firewall-cmd --reload
Accedi a:
https://INDIRIZZO_IP/pgadmin4
Risoluzione problemi
Se compare Ident authentication failed, modifica pg_hba.conf e imposta il metodo md5:
host all all all md5
Riavvia PostgreSQL:
systemctl restart postgresql-11