pgAdmin is the leading graphical Open Source management, development and administration tool for PostgreSQL. pgAdmin4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL database.
In this tutorial, we are going to show you how to install pgAdmin4 in Server Mode as a web application using httpd and Wsgi module on CentOS 8.
Install pgAdmin4 on CentOS 8
01-To install pgAdmin4 on CentOS 8 we need to add an external repository, so execute the following command:
$ sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-1-1.noarch.rpm
02- After we add the pgAdmin4 repository, let’s use the below command to install pgAdmin4 as server mode:
$ sudo dnf install pgadmin4-web
03- Before proceeding with the configuration of pgAdmin4, we need to install policycoreutils
tool:
$ dnf install policycoreutils-python-utils
04- Once we done installing pgAdmin4, we need to configure the pgAdmin4 by setting up the initial pgAdmin user account and the Apache Web server as below:
$ sudo /usr/pgadmin4/bin/setup-web.sh Setting up pgAdmin 4 in web mode on a Redhat platform... Creating configuration database... NOTE: Configuring authentication for SERVER mode. Enter the email address and password to use for the initial pgAdmin user account: Email address: [email protected] Password: Retype password: pgAdmin 4 - Application Initialisation ====================================== Creating storage and log directories... Configuring SELinux... The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. Would you like to continue (y/n)? y Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. Apache successfully enabled. Apache successfully started. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4
05- If you have firewalld configured, allow http traffic by running the following command :
$ sudo firewall-cmd --permanent --add-service=http $ sudo firewall-cmd --reload
06- To allow HTTPD Wsgi module to connect to the network, we need to configure Selinux as below:
$ setsebool -P httpd_can_network_connect 1
07- To verify the pgAdmin4 has been installed successfully, open your web browser and go to the following address: http://your-server_ip/pgadmin4/
or http://localhost/pgadmin4/
Now, enter the email address and password you created during the installation and you will see the following screen:
Conclusion
You have successfully installed pgAdmin4 on your CentOS 8 machine. You might want to check the following guides: