Table of Contents
In this tutorial we will go through the different possible methods to install pgadmin4 in Rocky Linux 9. But before that let's get some overview about pgadmin4
What is PgAdmin4?
PgAdmin4 is released for free under the PostgreSQL license. PgAdmin4 is installed and be used on Linux, Unix, macOS and Windows operating systems to manage PostgreSQL. In this article, we will explain how to install Rocky Linux 9, which is a Redhat based distribution.
Steps to Install PgAdmin4
Step-1: Setup Repository
You can install and use PgAdmin4 both as a web browser and as a desktop application. Run the following command in terminal to add the PgAdmin4 repository to the server:
[root@rocky9 foc]# rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
Step-2: Install pgadmin4 package
You can install pgadmin4 with 3 different options:
// Install for both desktop and web modes. dnf -y install pgadmin4 // Install for desktop mode only. dnf -y install pgadmin4-desktop // Install for web mode only. dnf -y install pgadmin4-web
Let's install it for both desktop and web modes:
[root@rocky9 foc]# dnf -y install pgadmin4
Step-3: Set master password
After this command, if you are using the operating system with a graphical interface (Gnome, KDE etc), you can access PgAdmin4 from the menu. Set a master password at the first login.
Then you can use PgAdmin4 Desktop.
Step-4: Configure pgadmin4 web mode
Let's continue with the installation for PgAdmin4 web mode. Let's run the setup-web.sh script in the terminal. Enter Email address and Password:
[root@rocky9 foc]# /usr/pgadmin4/bin/setup-web.sh Setting up pgAdmin 4 in web mode on a Redhat based 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: firstname.lastname@example.org Password: Retype password: pgAdmin 4 - Application Initialisation ====================================== Creating storage and log directories... Configuring SELinux... /usr/pgadmin4/bin/setup-web.sh: line 98: semanage: command not found /usr/pgadmin4/bin/setup-web.sh: line 100: semanage: command not found The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. 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
Step-5: Configure Firewall
Installation is complete. Set the firewall accesses for access from port 80:
[root@rocky9 foc]# firewall-cmd --add-service=http --permanent success [root@rocky9 foc]# firewall-cmd --reload success
Let's disable selinux:
[root@rocky9 foc]# setenforce 0
Let's open the config file with a text editor(nano, vim etc):
[root@rocky9 foc]# nano /etc/selinux/config
Let's switch from enforcing mode to disabled mode:
Let's reboot the server for the selinux changes to take effect:
[root@rocky9 foc]# reboot
Step-6: Access pgadmin4 GUI
You can access PgAdmin4 by typing
http://server_ip_address/pgadmin4 in a web browser. For our example:
- Enter the email address you entered during setup.
- Enter the password you entered during setup.
- Press Login button
Now the PgAdmin4 web mode is ready to use.
We have shared the PgAdmin4 installation steps for both web and desktop mode. Web mode allows access to PgAdmin4 only via browser, without the need for additional setup on the server. However, you may encounter problems with the browser itself.
In desktop mode, you cannot access it from anywhere other than the server it is installed on, an extra GUI interface is needed on the server, but it provides a more stable use compared to web mode.
As with any opensource application, you have the freedom to choose the mod you want for installation and use.
www.pgadmin.org - pgAdmin 4 (RPM)