I have had problem previously installing pgAdmin4 on CentOS 7, so I wanted to document my steps this most recent time.
Step 1: Install Packages
Install yum repo, you can the correct one at https://yum.postgresql.org/:
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
Install the actual packages:
yum install pgadmin4-web
Step 2: Create system user
The packages do not create a user to run the web application now, so take some time to do so now:
useradd --create-home --home-dir /var/pgadmin --system --shell /sbin/nologin pgadmin
Step 3: Run setup.py
It’s necessary to run setup.py
to create the appropriate environement under the system user’s HOMEDIR
:
su –shell /bin/sh -c “python /usr/lib/python2.7/site-packages/pgadmin4-web/setup.py” pgadmin
Step 4: Configure Apache HttpD
<VirtualHost *> ServerName pgadmin.example.com CustomLog "logs/pgadmin-access_log" combined ErrorLog "logs/pgadmin-error_log" LogLevel error WSGIDaemonProcess pgadmin processes=1 threads=25 user=pgadmin group=pgadmin 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>
This article has 2 comments
September 25, 2018
Step 2 is missing “pgadmin” at the end of the string.
http://pgadmin-support.postgresql.narkive.com/vwg7j1Id/consider-default-server-mode-true-for-pgadmin4-v1-web
September 25, 2018
Thank you, you’re correct. I have gone ahead and corrected it.