Skip to content

Instantly share code, notes, and snippets.

@coder4web
Last active November 4, 2022 22:16
Show Gist options
  • Save coder4web/13419dbfe7c22dc5bad8bb4e135138bc to your computer and use it in GitHub Desktop.
Save coder4web/13419dbfe7c22dc5bad8bb4e135138bc to your computer and use it in GitHub Desktop.
PostgreSQL install and setup
# RHEL / CentOS 8
# https://www.postgresql.org/download/linux/redhat/
# https://www.postgresql.org/docs/current/runtime.html
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf install postgresql12 postgresql12-server
# Fedora 31
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-31-x86_64/pgdg-fedora-repo-latest.noarch.rpm
dnf install postgresql12 postgresql12-server
# RHEL / CentOS 7
#yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
#yum install postgresql12 postgresql12-server
echo 'LC_ALL="en_US.UTF-8"' >> /etc/locale.conf
#PGDATA='/srv/data/12/data'
#PGSETUP_INITDB_OPTIONS="-D ${PGDATA}"
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12
sed -i 's/^host\s*all\s*all\s*127\.0\.0\.1\/32\s*ident/host all all 127.0.0.1\/32 md5/' /var/lib/pgsql/12/data/pg_hba.conf
#msg "Set PGDATA to "${PGDATA}
#sed -i "s~^Environment=PGDATA=.*~Environment=PGDATA=\${PGDATA}/~" /usr/lib/systemd/system/postgresql-12.service
#systemctl daemon-reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment