Install pgAdmin 4 on CentOS 7 & Fedora 36/35/34/33/32

Posted on 123 views

pgAdmin is the leading Open Source feature-rich PostgreSQL administration and development platform that runs on Linux, Unix, Mac OS X, and Windows. pgAdmin can be used to manage PostgreSQL 9.2 and above. With the release of pgAdmin 4, there was migration from Bootstrap 3 to Bootstrap 4. In this article we will be installing pgAdmin 4 on CentOS 7 & Fedora 36/35/34/33/32.

For CentOS 8: How To Install pgAdmin 4 on CentOS 8 Linux

Consider system update before the installation of pgAdmin 4 on CentOS 7 & Fedora.

sudo yum -y update

Install pgAdmin4 on CentOS 7 / Fedora 36/35/34/33/32

You need to have PostgreSQL installed on your system before you can install pgAdmin 4.

Step 1: Add pgAdmin 4 repository

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

CentOS 7:

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

Fedora 36:

sudo tee /etc/yum.repos.d/pgadmin4.repo<

Fedora 35/34/33/32/31/30:

sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-fedora-repo-2-1.noarch.rpm

Successful installation message:

.....
Total size: 4.0 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.noarch 0:2-1

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 2: Install pgAdmin4 on CentOS 7 / Fedora 36/35/34/33/32

Then install the pgAdmin4 packageon CentOS 7 / Fedora.

Install for web mode only, suitable for server:

sudo yum install pgadmin4-web

Install for both desktop and web modes.

sudo yum install pgadmin4

Install for desktop mode only, suitable for Desktop:

sudo yum install pgadmin4-desktop

Review installation dependency tree then proceed:

Dependencies resolved.
======================================================================================================================================================================================================
 Package                                              Architecture                               Version                                           Repository                                    Size
======================================================================================================================================================================================================
Installing:
 pgadmin4                                             noarch                                     6.9-1.fc35                                        pgAdmin4                                     6.2 k
Installing dependencies:
 libatomic                                            x86_64                                     12.1.1-1.fc36                                     updates                                       37 k
 pgadmin4-desktop                                     x86_64                                     6.9-1.fc35                                        pgAdmin4                                      82 M
 pgadmin4-server                                      x86_64                                     6.9-1.fc35                                        pgAdmin4                                      92 M
 pgadmin4-web                                         noarch                                     6.9-1.fc35                                        pgAdmin4                                     8.7 k
 python3-mod_wsgi                                     x86_64                                     4.9.0-2.fc36                                      fedora                                       959 k

Transaction Summary
======================================================================================================================================================================================================
Install  6 Packages

Total download size: 176 M
Installed size: 596 M
Is this ok [y/N]: y

Step 3: Configure pgAdmin 4 on CentOS 7 / Fedora

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

1. 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.example.com systemd[1]: Starting The Apache HTTP Server...
Oct 24 22:34:22 centos.example.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.example.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: 
Password: 
Retype 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 4: 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://[serverip_or_hostname]/pgadmin4 to log in to the pgAdmin with the credentials created step 6 above.

pgAdmin-centos-7-fedora-29-login-1024x623

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-1024x202

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

pgAdmin-centos-7-fedora-29-addd-server-02-1024x777

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

pgAdmin-centos-7-fedora-29-add-server-03-1013x1024

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-1024x444

I hope our article was helpful in installing pgAdmin 4 on CentOS 7 and Fedora server/Desktop.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.