Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install PostgreSQL and pgAdmin in RHEL 8 - DesignLinux

Oct 08 2020
designlinux 0 Comments

Pgadmin4 is an opensource web-based management tool for managing PostgreSQL databases. It’s a Python-based web-application developed using the flask framework at the backend and HTML5, CSS3, and Bootstrap on the frontend. Pgadmin4 is a rewrite of Pgadmin 3 which is written in C++ and ships with the following notable features:

Pgadmin4 Features

  • Sleek and revamped web interface with polished icons and panels.
  • Fully responsive web layout with dashboards for real-time monitoring.
  • Live SQL query tool/editor with syntax highlighting.
  • Powerful management dialogs and tools for common tasks.
  • Useful hints to get you started.
  • And so much more.

In this article, you will learn how to install PostgreSQL with pagAdmin4 in server mode running behind the Apache webserver using the WSGI module on RHEL 8.

Install PostgreSQL on RHEL 8

The first step in installing PgAdmin4 is to install the PostgreSQL database server. PostgreSQL is available in the Appstream repository in different versions. You can make your selection by enabling your preferred package using the dnf package manager.

To list the available modules for PostgreSQL, run the command:

# dnf module list postgresql
List Modules for Postgresql
List Modules for Postgresql

The output indicates that there are 3 versions available for download from the AppStream repository: version 9.6, 10, and 12. We can also see that the default version is Postgresql 10 as indicated by the [d] tag. This is what you would install by running the command below.

# dnf install postgresql-server

However, we want to install the latest version, which is PostgreSQL 12. Therefore, we will enable that module and override the default module stream. To do so, run the command:

# dnf module enable postgresql:12
Enable Module for PostgreSQL
Enable Module for PostgreSQL

Once you have enabled the module for Postgresql 12, proceed and install Postgresql 12 alongside its dependencies as shown.

# dnf install postgresql-server
Install PostgreSQL in RHEL 8
Install PostgreSQL in RHEL 8

Before anything else, you need to create a database cluster. A cluster comprises a collection of databases that are managed by a server instance. To create a database cluster, invoke the command:

# postgresql-setup --initdb

If everything went well, you should get the output below.

Initialize PostgreSQL Database
Initialize PostgreSQL Database

Once the cluster is created, you can now start and enable your PostgreSQL instance as shown:

# systemctl start postgresql
# systemctl enable postgresql

To confirm that Postgresql is up and running, execute:

# systemctl status postgresql
Verify PostgreSQL Status
Verify PostgreSQL Status

Installing Pgadmin4 in RHEL 8

To install Pgadmin4, first, add the external repository shown below.

# rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-1-1.noarch.rpm

Next, run the command below to install pgadmin4 in server mode.

# dnf install pgadmin4-web  
Install Pgadmin4 in RHEL 8
Install Pgadmin4 in RHEL 8

Next, install the policycoreutils packages which provide the core utilities needed by SELinux.

$ sudo dnf install policycoreutils-python-utils
Install Python Policycoreutils in RHEL 8
Install Python Policycoreutils in RHEL 8

Once installed, run the Pgadmin4 setup script as shown. This is going to create a pgadmin user account, storage and log directories, configure SELinux and spin up the Apache webserver on which pgAdmin4 will run on.

# /usr/pgadmin4/bin/setup-web.sh

When prompted, provide the required information and hit 'Y' to start the Apache webserver.

Run Pgadmin Setup Script
Run Pgadmin Setup Script

If you have a firewall running, open port 80 to allow web service traffic.

# firewall-cmd --add-port=80/tcp --permanent
# firewall-cmd --reload

Next, configure SELinux as shown:

# setsebool -P httpd_can_network_connect 1

To access pgadmin4, launch your browser and browse the URL shown.

http://server-ip/pgadmin4

Be sure to log in using the email address and the password that you provided when running the setup script.

pgadmin4 Login
pgadmin4 Login

This ushers you to the Pgadmin4 dashboard as shown below.

pgadmin4 Dashboard
pgadmin4 Dashboard

And that’s how you install Pgadmin4 in server mode. You can now create and manage PostgreSQL databases using the SQL editor and monitor their performance using the dashboards provided. This brings us to the end of this guide.

Related

Tags: pgAdmin, PostgreSQL Tips, RHEL Tips

Pkill Command in Linux

Prev Post

How to List Cron Jobs in Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 608
  • 1,055,380

DesignLinux.com © All rights reserved

Go to mobile version