1. First step update repository
# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm -y
# yum install epel-release
2. Install pgqdmin4-v2 with command below
# yum install pgadmin4-v2
3. edit and add the following line
# 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'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
4. 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
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: user@domain
Password:Type the Password
Retype password:Retype the Password
pgAdmin 4 - Application Initialisation
======================================
Enter the email address and password to use for the initial pgAdmin user account:
Email address: user@domain
Password:Type the Password
Retype password:Retype the Password
pgAdmin 4 - Application Initialisation
======================================
5. Set ownership from directory
# chown -R apache:apache /var/lib/pgadmin4
# chown -R apache:apache /var/log/pgadmin4
# chcon -R -t httpd_sys_content_rw_t "/var/log/pgadmin4/"
# chcon -R -t httpd_sys_content_rw_t "/var/lib/pgadmin4/"
6. Edit and change file pgadmin4.conf
# vi /etc/httpd/conf.d/pgadmin4.conf
<VirtualHost *>
ServerName pgadmin.yallalabs.local
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias / /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
<Directory "/usr/lib/python2.7/site-packages/pgadmin4-web/">
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
ServerName pgadmin.yallalabs.local
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias / /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
<Directory "/usr/lib/python2.7/site-packages/pgadmin4-web/">
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>
7. Running command below to test apache running well
# apachectl configtest
Syntax OK
Syntax OK
8. Restart service web server
# systemctl restart httpd
# setsebool -P httpd_can_network_connect 1
9. Open port and reload the configuration.
# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload