#!/bin/bash # INSTALL POSTGRES 14 yum -y remove pgdg-redhat-repo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum-config-manager --disable pgdg* yum-config-manager --enable pgdg-common pgdg14 dnf -y module disable postgresql # modules were provding up to ver 13 so disable them dnf -y install postgresql14-server postgresql14-contrib postgresql14-devel libpq-devel readline-devel pglogical_14 postgis31_14 perl-File-Touch perl-IO-All --disableexcludes=all /usr/pgsql-14/bin/postgresql-14-setup initdb systemctl enable --now postgresql-14 PGPASS=`openssl rand -base64 9` && echo $PGPASS sudo -i -u postgres psql -c "CREATE ROLE root WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD '$PGPASS';" psql -d template1 -c "CREATE DATABASE root" echo "localhost:5432:*:root:$PGPASS" > /root/.pgpass chmod 600 /root/.pgpass sudo -i -u postgres /usr/pgsql-14/bin/pg_ctl reload sed -i -r 's|^(local\s+all\s+all\s+.*peer)$|#\1|g' /var/lib/pgsql/14/data/pg_hba.conf sed -i -r 's|^(host\s+all\s+all\s+.*scram-sha-256)$|#\1|g' /var/lib/pgsql/14/data/pg_hba.conf cat>>/var/lib/pgsql/14/data/pg_hba.conf<> /var/lib/pgsql/14/data/postgresql.conf echo -e "password_encryption = md5\nlisten_addresses = '*'\n" > /var/lib/pgsql/14/data/pg_custom.conf chown postgres: /var/lib/pgsql/14/data/pg_custom.conf sudo -i -u postgres /usr/pgsql-14/bin/pg_ctl reload # INSTALL pgsql PHP module for the default PHP cd /usr/local/directadmin/custombuild DEFAULT_PHP_CONF=`./build used_configs | grep -P 'PHP .* configuration file:' | awk -F'/' '{print $NF}'` && echo $DEFAULT_PHP_CONF mkdir -p /usr/local/directadmin/custombuild/custom/php \cp -fp /usr/local/directadmin/custombuild/configure/php/$DEFAULT_PHP_CONF /usr/local/directadmin/custombuild/custom/php perl -0777 -i.bak -pe 's|^(\./configure \\)$(?!\s*--with-pgsql)|$1\n\t--with-pgsql=/usr/pgsql-14 --with-pdo-pgsql=/usr/pgsql-14 \\|ms' /usr/local/directadmin/custombuild/custom/php/$DEFAULT_PHP_CONF da build php `grep php1_release /usr/local/directadmin/custombuild/options.conf | cut -d= -f2` echo "Install the plugin in DirectAdmin UI and copy the licence file to /usr/local/directadmin/plugins/postgres" echo "You can then optionally configure phpPgAdmin one click login"