select version in $(curl -s https://www.postgresql.org/ftp/source/ | rg -o 'v\d+\.\d+\.\d+' | uniq | sed 's|v||g'); do
  break
done

reset

curl -sO https://ftp.postgresql.org/pub/source/v$version/postgresql-$version.tar.bz2

reset

bunzip2 postgresql-$version.tar.bz2
tar xvf postgresql-$version.tar

mv postgresql-9.6.24 /usr/local/pgsql

cd /usr/local/pgsql

bash configure --with-tcl --with-perl --with-python --with-gssapi --with-ldap --with-bonjour --with-openssl --with-selinux --with-systemd --without-readline --with-libedit-preferred --with-ossp-uuid --with-libxml --with-libxslt --without-zlib --with-gnu-ld

make install