Saturday, November 16, 2024
Google search engine
HomeData Modelling & AIHow To Install pgAdmin 4 on CentOS 8 | RHEL 8

How To Install pgAdmin 4 on CentOS 8 | RHEL 8

PostgreSQL a popular powerful, and open source object-relational database system with more than 15 years of active development and strong reputation for reliability. pgAdmin is the leading Open Source feature-rich PostgreSQL administration and development platform that runs on Linux, Unix, Mac OS X, and Windows. This tutorial will show you how to install pgAdmin 4 on CentOS 8 Linux.

Features of pgAdmin 4 include:

  • auto-detection and support for objects discovered at run-time
  • a live SQL Query Tool with direct data editing
  • support for administrative queries
  • a syntax-highlighting SQL editor
  • redesigned graphical interfaces
  • powerful management dialogs and tools for common tasks
  • responsive, context-sensitive behavior
  • supportive error messages
  • helpful hints
  • online help and information about using pgAdmin dialogs and tools.

Step 1: Install PostgreSQL database

You need to have PostgreSQL installed on your system before you can install pgAdmin 4. Below are the guides to help you install PostgreSQL:

Step 2: Add pgAdmin 4 repository

After installing PostgreSQL, you can begin the installation of pgAdmin 4 on CentOS 8|RHEL 8. You need to add pgAdmin 4 RPM:

sudo dnf install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-redhat-repo-2-1.noarch.rpm

Successful installation message:

.....
Total size: 6.6 k
Installed size: 4.0 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgadmin4-redhat-repo-2-1.noarch                                                                                                                                                    1/1
  Verifying  : pgadmin4-redhat-repo-2-1.noarch                                                                                                                                                    1/1

Installed:
  pgadmin4-redhat-repo-2-1.noarch

Complete!

You can check the contents of the repository file created using the following command:

$ cat /etc/yum.repos.d/pgadmin4.repo
[pgAdmin4]
name=pgadmin4
baseurl=https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/redhat/rhel-$releasever-$basearch
enabled=1
repo_gpgcheck=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/PGADMIN_PKG_KEY

Step 3: Install pgAdmin4 packages

There are there modes of installation:

  • Web mode
  • Desktop mode
  • Web & Desktop mode

To install for web mode only, suitable for server, use the commands::

sudo dnf install pgadmin4-web policycoreutils-python-utils

For desktop mode only, this is fit for Desktop Environment:

sudo dnf install pgadmin4-desktop policycoreutils-python-utils

Install for both desktop and web modes, if you need both:

sudo yum install pgadmin4 policycoreutils-python-utils

Review installation dependency tree then proceed:

....
Transaction Summary
================================================================================================================================================================================================
Install  12 Packages

Total download size: 98 M
Installed size: 267 M
Is this ok [y/N]: y

Step 4: Configure pgAdmin 4

Now that we have pgAdmin 4 installed, let’s configure it.

Start and enable httpd service to start on boot

sudo systemctl start httpd && sudo systemctl enable httpd

You can confirm service status by running:

$ systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-10-24 22:34:22 UTC; 10s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 6377 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─6377 /usr/sbin/httpd -DFOREGROUND
           ├─6378 /usr/sbin/httpd -DFOREGROUND
           ├─6379 /usr/sbin/httpd -DFOREGROUND
           ├─6380 /usr/sbin/httpd -DFOREGROUND
           ├─6381 /usr/sbin/httpd -DFOREGROUND
           ├─6382 /usr/sbin/httpd -DFOREGROUND
           └─6383 /usr/sbin/httpd -DFOREGROUND

Oct 24 22:34:22 centos.hirebestengineers.com systemd[1]: Starting The Apache HTTP Server...
Oct 24 22:34:22 centos.hirebestengineers.com httpd[6377]: [Sun Oct 24 22:34:22.727756 2021] [so:warn] [pid 6377] AH01574: module wsgi_module is already loaded, skipping
Oct 24 22:34:22 centos.hirebestengineers.com systemd[1]: Started The Apache HTTP Server.

Finally, if you have installed pgadmin4 or pgadmin4-web, run the web setup script to configure the system to run in web mode:

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

This will require you to input pgadmin4 user email address and set the password:

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: <input-email-address>
Password: <input-password>
Retype password: <Reenter-password>
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...

Agree for the configuration of Apache Web server.

Configuring SELinux...
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: Access pgAdmin 4 Web Interface

if you have an active firewall service, allow http port:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Open http://servername_or_ip/pgadmin4 to log in to the pgAdmin with the credentials created step 6 above.

pgAdmin centos 7 fedora 29 login

On the first page of pgAdmin, add a PostgreSQL server to administer with pgAdmin by clicking on “Add New Server”. This can be local or a remote PostgreSQL server.

pgAdmin centos 7 fedora 29 add server 01

Under the “General” section, give the server a name & description.

pgAdmin centos 7 fedora 29 addd server 02

Under “Connection” tab, provide access details – DB host, DB user and Password.

pgAdmin centos 7 fedora 29 add server 03

When done, Click Save button to save the
configurations. If you were successful adding the server, the name will
appear in the left sidebar. Select the server to see database summary
information and make changes.

pgAdmin centos 7 fedora 29 dashboard

I hope our article was helpful in installing pgAdmin 4 on CentOS 8.

Other guides on installing pgAdmin 4:

RELATED ARTICLES

Most Popular

Recent Comments