#! /bin/bash . /usr/src/m2/framework/bash_functions.sh . /usr/src/m2/framework/settings.sh #read_m2_settings #mysql_connect_data_v3 # ---- VARS ----- VERSION="1.0.2" SCRIPT_NAME="PostgreSQL Admin (pgAdmin) install" TEST=0 # 1 - do not execute changes # ---- FUNCTIONS ----- # ---- MAIN ----- k_start if [ "$TEST" == "1" ]; then report "***** TEST MODE ON. Changes will not be applied *****" 8 fi _centos_version if (( centos_version != 8 )); then report "Centos 8 is necessary. Current: $centos_version" 1 k_exit 1 fi if postgres -V | grep -q 12; then report "PostgreSQL 12 installed" 0 else report "PostgreSQL 12 is not installed" 1 k_exit 1 fi report "Installing pgAdmin" 3 dnf -y install epel-release dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm dnf -qy module disable postgresql dnf -y install pgadmin4 report "Configuring pgAdmin" 3 cp -fr /etc/httpd/conf.d/pgadmin4.conf.sample /etc/httpd/conf.d/pgadmin4.conf mkdir -p /var/log/pgadmin4 mkdir -p /var/lib/pgadmin4 echo "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'" >> /usr/lib/python3.6/site-packages/pgadmin4-web/config_distro.py report "Creating access to the web site" 3 python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py chown -R apache:apache /var/lib/pgadmin4 chown -R apache:apache /var/log/pgadmin4 report "Opening firewall" 3 firewall-cmd --add-service={http,https} --permanent firewall-cmd --reload systemctl restart httpd report "Access: http://IP/pgadmin4/" 3 k_exit 0