In this article, we will have explained the necessary steps to install pgAdmin 4 on Rocky Linux 8. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
pgAdmin is a feature-rich PostgreSQL administration tool with a simple interface and easy to use and supports PostgreSQL 9.6 and above. It allows one to manage the PostgreSQL database from the web interface by providing all the required features. If you are not a fan of managing databases on the PostgreSQL shell, then PgAdmin4 is the go-to management tool.
Install pgAdmin 4 on Rocky Linux 8
Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.
sudo dnf install epel-release sudo dnf update sudo dnf upgrade
Step 2. Install PostgreSQL.
Add the PostgreSQL repository to your Rocky Linux system:
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo dnf -qy repolist sudo dnf module -qy disable postgresql
With the latest PostgreSQL repository in place, now install the PostgreSQL server using the following command:
sudo dnf install postgresql13-server
Then, you’ll need to initialize database instance before starting the service:
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
Once complete installation, start and enable the PostgreSQL service using the command:
sudo systemctl enable postgresql-13 sudo systemctl start postgresql-13
You can confirm the version of PostgreSQL installed using the command below:
$ psql -V psql (PostgreSQL) 13.4
Step 3. Install pgAdmin 4 on Rocky Linux system.
Run the following command to add the repository and GPG key of the pgAdmin4:
rpm --import https://www.pgadmin.org/static/packages_pgadmin_org.pub sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm
Now update the system repositories using
dnf and install PgAdmin4:
sudo dnf update sudo dnf install pgadmin4-web
Once PgAdmin4 is installed, you need to configure it using the below script:
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: [email protected] Password: Enter Your Strong Password here Retype password: Re-enter Strong Password here pgAdmin 4 - Application Initialisation ====================================== Creating storage and log directories... Configuring SELinux... The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4
Step 4. Configuring Firewall.
You also need to modify your firewall rules to allow HTTP traffic:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --reload
Step 5. Access pgAdmin 4.
Finally, access the PgAdmin4 interface from the browser using the URL indicated:
Provide the login credentials, i.e. the email and the password that you configured, and click on ‘Login’.
That’s all you need to do to install pgAdmin on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on pgAdmin, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.