Skip to content

Instantly share code, notes, and snippets.

@mik786
Last active November 29, 2024 08:58
Show Gist options
  • Save mik786/0a50cad074107bd1497dc3d020bc5a82 to your computer and use it in GitHub Desktop.
Save mik786/0a50cad074107bd1497dc3d020bc5a82 to your computer and use it in GitHub Desktop.
Install PostgreSQL 12.5 on Amazon Linux 1 AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
sudo yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-libs-12.5-1PGDG.rhel6.x86_64.rpm
sudo yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-12.5-1PGDG.rhel6.x86_64.rpm
sudo yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-server-12.5-1PGDG.rhel6.x86_64.rpm
sudo yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-devel-12.5-1PGDG.rhel6.x86_64.rpm
sudo yum -y install https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-contrib-12.5-1PGDG.rhel6.x86_64.rpm
sudo service postgresql-12 initdb
# Use MD5 Authentication
sudo sed -i.bak -e 's/ident$/md5/' -e 's/peer$/md5/' /var/lib/pgsql/12/data/pg_hba.conf
#start
sudo /sbin/chkconfig --levels 235 postgresql-12 on
sudo service postgresql-12 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment