Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created March 30, 2018 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenmazaika/7739236e54e99d7f764aed30a3c9bfcf to your computer and use it in GitHub Desktop.
Save kenmazaika/7739236e54e99d7f764aed30a3c9bfcf to your computer and use it in GitHub Desktop.
sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo service postgresql initdb
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/1beee173b4b9172c27b165a722edb849/raw/7bf8880d9ae32e80c08f79a22713b5c68b1ddece/postgres.conf
echo -e "\n\nhost all postgres 127.0.0.1/0 trust" >> /var/lib/pgsql9/data/pg_hba.conf
sudo service postgresql restart
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
sudo sudo -u postgres psql -c "CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';"
echo "good to go!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment