Skip to content

Instantly share code, notes, and snippets.

@maka-io
Last active August 31, 2021 15:59
Show Gist options
  • Save maka-io/9396103407f52c61b91841c270413160 to your computer and use it in GitHub Desktop.
Save maka-io/9396103407f52c61b91841c270413160 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Install netcdf"
brew reinstall netcdf
echo "Stop postgres if installed"
pg_ctl -D /usr/local/var/postgres stop -s -m fast
echo "Remove previous verion of postgis"
brew uninstall --force postgis
echo "Remove previous version of postgres"
brew uninstall --force postgresql
echo "Delete all files associated with postgres"
rm -rf /usr/local/var/postgres || true
echo "Reinstall new version of postgres"
brew install postgis
echo "Install postgis"
brew install postgis
echo "start the postgres server"
pg_ctl -D /usr/local/var/postgres -l logfile start
echo "sleep 5 seconds for the service to start"
sleep 5
#echo "create database file"
#initdb /usr/local/var/postgres
echo "restart postgres"
pg_ctl -D /usr/local/var/postgres stop -s -m fast
pg_ctl -D /usr/local/var/postgres -l logfile start
echo "Sleeping for 5 to allow the database to start up"
sleep 5
echo "create new database for logged in user"
createdb
echo "create default postgres user"
psql -c "CREATE USER postgres"
psql -c "CREATE DATABASE postgres"
psql -c "ALTER USER postgres WITH SUPERUSER"
echo "enable postgis on default database"
psql -c "CREATE EXTENSION postgis" -U postgres
echo "install java jdk for nco"
brew cask install adoptopenjdk
echo "install previous versions of nco"
brew reinstall nco
echo "remove old netcdf"
pip3 uninstall -y netcdf4
echo "install python-netcdf"
pip3 install netcdf4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment