Professional Documents
Culture Documents
Instalar PGADMIN4 en Centos 7
Instalar PGADMIN4 en Centos 7
https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-pgadmin-4-on-centos-
7-rhel-7-fedora-29-fedora-28.html
pgAdmin is a free and open source management tool for PostgreSQL and derivative relation
databases such as EDB Advanced Server. It can be installed on multiple OS platforms such as
Linux, Unix, Mac OS X, and Windows to manager PostgreSQL 9.2 and above.
Deployment Mode
Server Deployment
Desktop Deployment
In this guide, we will install pgAdmin 4 on CentOS 7 / RHEL 7 & Fedora 29 / Fedora
28 as a web application (server deployment).
Prerequisites
Install PostgreSQL Server
This post assumes that you already have PostgreSQL 9.2 and above installed on your
system. Otherwise, follow the post: How To Install PostgreSQL 11 / 10 on CentOS 7 /
RHEL 7.
We would need to enable the EPEL repository to download dependent packages for
pgAdmin.
pgAdmin 4 is available in PostgreSQL repository and your system should have the
PostgreSQL repository by now if you have already completed the installation of
PostgreSQL. If not, add the PostgreSQL repository using the below command.
# CentoS 7 #
yum install
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-
x86_64/pgdg-centos11-11-2.noarch.rpm
# Fedora 29 #
dnf install
https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-29-
x86_64/pgdg-fedora11-11-2.noarch.rpm
# Fedora 28 #
dnf install
https://download.postgresql.org/pub/repos/yum/11/fedora/fedora-28-
x86_64/pgdg-fedora11-11-2.noarch.rpm
### PostgreSQL 10 ##
# RHEL 7 #
yum install
https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-
x86_64/pgdg-redhat10-10-2.noarch.rpm
# CentoS 7 #
yum install
https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-
x86_64/pgdg-centos10-10-2.noarch.rpm
# Fedora 29 #
dnf install
https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-29-
x86_64/pgdg-fedora10-10-4.noarch.rpm
# Fedora 28 #
dnf install
https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-28-
x86_64/pgdg-fedora10-10-4.noarch.rpm
Install pgAdmin 4
Once you have PostgreSQL repository configured on your system, run the following
command to install pgAdmin 4.
cp /etc/httpd/conf.d/pgadmin4.conf.sample
/etc/httpd/conf.d/pgadmin4.conf
mkdir /var/log/pgadmin4/
mkdir /var/lib/pgadmin4/
vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_local.py
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'
Change permissions of directories so that Apache can write data into it.
Output:
Enter the email address and password to use for the initial pgAdmin
user account:
Set up the firewall so that we can access pgAdmin 4 from external machines.
Access pgAdmin 4
Open a web browser and go to the following URL to access the pgAdmin 4 interface.
http://ip.add.re.ss/pgadmin4
Log in to pgAdmin 4 web interface using the email address and password you have
created earlier.
To manage a PostgreSQL server, you will need to add a new server. Click on Add New
Server.
General Tab:
Connection Tab:
If the connection to PostgreSQL server is successful, you should see the following page.
Troubleshooting
You may get a Fatal: Ident authentication failed for user error.
Install pgAdmin 4 on CentOS 7 – PostgreSQL Error
vi /var/lib/pgsql/11/data/pg_hba.conf
vi /var/lib/pgsql/11/data/pg_hba.conf
PgAdmin4 is a easy to use web interface for managing PostgreSQL databases. It can be
used on multiple platforms such as Linux, Windows and Mac OS X. In pgAdmin 4
there is migration from bootstrap 3 to bootstrap 4.
Note: This tutorial assumes that you already have PostgreSQL 9.2 or above installed on
your CentOS 7. For instructions how to install it, you can follow our guide: How to
install PostgreSQL 10 on CentOS and Fedora.
This step should have been completed upon the installation of PostgreSQL, but if you
haven’t, you can complete it with:
# yum -y install
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-
x86_64/pgdg-centos11-11-2.noarch.rpm
During the installation, due to dependencies, the following two will be installed as well
– pgadmin4-web and httpd web server.
There are few minor configuration changes that need to be done to have pgAdmin4
running. First we will rename the sample conf file from pgadmin4.conf.sample to
pgadmin4.conf:
# mv /etc/httpd/conf.d/pgadmin4.conf.sample
/etc/httpd/conf.d/pgadmin4.conf
<VirtualHost *:80>
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /pgadmin4 /usr/lib/python2.7/site-packages/pgadmin4-
web/pgAdmin4.wsgi
<Directory /usr/lib/python2.7/site-packages/pgadmin4-web/>
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
</VirtualHost>
Next we will create logs and lib directories for pgAdmin4 and set their ownership:
# mkdir -p /var/lib/pgadmin4/
# mkdir -p /var/log/pgadmin4/
# chown -R apache:apache /var/lib/pgadmin4
# chown -R apache:apache /var/log/pgadmin4
# vi /usr/lib/python2.7/site-packages/pgadmin4-web/config_distro.py
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'
Finally we will create our user account, with which we will authenticate in the web
interface. To do this, run:
# python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py
PgAdmin4 Login
If you receive 403 error while accessing PgAdmin4 interface, you need to set the
correct SELinux context on the following files.
To authenticate, use the email address and password that you have used earlier. Once
authenticate, you should see the pgAdmin4 interface:
PgAdmin4 Dashboard
At your first login, you will need to add a new server to manage. Click on “Add New
Server”. You will need to configure the PostgresQL connection. In the first tab
“General”, enter the following settings:
The second tab “Connection” is more important one, as you will have to enter:
When you have filled everything, Save the changes. If the connection was successful,
you should see the following page: