This step should have been completed upon the installation of PostgreSQL, but if you haven’t, you can complete it with:

Install Repository

 

yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

 

Now you are ready to install pgAdmin with:

 

Install Dependencies

# yum install -y epel-release

# yum install -y python3-pip

# yum install -y httpd

 

Install Pgadmin4

# yum install -y pgadmin4

 

Firewall Configuration

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

firewall-cmd --reload

 

Webserver Configuration

# mv /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf

systemctl restart httpd

PgAdmin Configuration

# mkdir -p /var/lib/pgadmin4

# mkdir -p /var/log/pgadmin4

# find / -name pgadmin4-web # cd $(find / -name pgadmin4-web)

# vi /usr/lib/python3.6/site-packages/pgadmin4-web/config_distro.py

HELP_PATH = '/usr/share/doc/pgadmin4-docs/en_US/html'

UPGRADE_CHECK_ENABLED = False LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'

SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'

SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'

STORAGE_DIR = '/var/lib/pgadmin4/storage'

python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py

Linux Filesystem Permission

chown -R apache:apache /var/lib/pgadmin4/

chown -R apache:apache /var/log/pgadmin4/

chmod -R 755 /var/log/pgadmin4/

chmod -R 755 /var/lib/pgadmin4/

SeLinux Configuration

chcon -R -h -t httpd_sys_script_rw_t /var/lib/pgadmin4

chcon -R -h -t httpd_sys_script_rw_t /var/log/pgadmin4

setsebool -P httpd_can_network_connect 1

systemctl restart httpd

 

Now you can able to access pgadmin4

   http://<Your Server IP>/pgadmin4

 

Technology