5

Install pgAdmin 4 on CentOS 7 & Fedora 34/33/32/31/30

 2 years ago
source link: https://computingforgeeks.com/how-to-install-pgadmin-on-centos-fedora/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Install pgAdmin 4 on CentOS 7 & Fedora 34/33/32/31/30
Search

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 34/33/32/31/30.

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 34/33/32/31/30

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 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:

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

Then install the pgAdmin4 packageon CentOS 7 / Fedora.

Install for web mode only, suitable for server:

sudo yum install pgadmin4-web

Install for desktop mode only, suitable for Desktop:

sudo yum install pgadmin4-desktop

Install for both desktop and web modes.

sudo yum install pgadmin4

Review installation dependency tree then proceed:

....
Dependencies Resolved

======================================================================================================================================================================================================
 Package                                                Arch                                Version                                                    Repository                                Size
======================================================================================================================================================================================================
Installing:
 pgadmin4                                               noarch                              6.1-1.el7                                                  pgAdmin4                                 2.8 k
Installing for dependencies:
 apr                                                    x86_64                              1.4.8-7.el7                                                base                                     104 k
 apr-util                                               x86_64                              1.5.2-6.el7                                                base                                      92 k
 centos-logos                                           noarch                              70.0.6-3.el7.centos                                        base                                      21 M
 desktop-file-utils                                     x86_64                              0.23-2.el7                                                 base                                      67 k
 emacs-filesystem                                       noarch                              1:24.3-23.el7                                              base                                      58 k
 httpd                                                  x86_64                              2.4.6-97.el7.centos.1                                      updates                                  2.7 M
 httpd-tools                                            x86_64                              2.4.6-97.el7.centos.1                                      updates                                   93 k
 libatomic                                              x86_64                              4.8.5-44.el7                                               base                                      51 k
 libpq5                                                 x86_64                              14.0-42PGDG.rhel7                                          pgdg-common                              440 k
 mailcap                                                noarch                              2.1.41-2.el7                                               base                                      31 k
 pgadmin4-desktop                                       x86_64                              6.1-1.el7                                                  pgAdmin4                                  87 M
 pgadmin4-python3-mod_wsgi                              x86_64                              4.7.1-2.el7                                                pgAdmin4                                 780 k
 pgadmin4-server                                        x86_64                              6.1-1.el7                                                  pgAdmin4                                  90 M
 pgadmin4-web                                           noarch                              6.1-1.el7                                                  pgAdmin4                                 5.4 k
 python3                                                x86_64                              3.6.8-18.el7                                               updates                                   70 k
 python3-libs                                           x86_64                              3.6.8-18.el7                                               updates                                  6.9 M
 python3-pip                                            noarch                              9.0.3-8.el7                                                base                                     1.6 M
 python3-setuptools                                     noarch                              39.2.0-10.el7                                              base                                     629 k
 xdg-utils                                              noarch                              1.1.0-0.17.20120809git.el7                                 base                                      70 k

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package (+19 Dependent packages)

Total download size: 212 M
Installed size: 625 M
Is this ok [y/d/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.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 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://pgadmin.example.com/pgadmin4 to log in to the pgAdmin with the credentials created step 6 above.

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.

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

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

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.

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

Best Video courses to Learn PostgreSQL Database:

Other guides on installing pgAdmin 4:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK