Skip to content

Instantly share code, notes, and snippets.

@jonathlt
Last active March 4, 2018 17:35
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 jonathlt/306674e67f4714f8d026c6ec7f80def8 to your computer and use it in GitHub Desktop.
Save jonathlt/306674e67f4714f8d026c6ec7f80def8 to your computer and use it in GitHub Desktop.
Get PostgreSQL/Postgis up and running quickly on any Raspberry Pi

Install Hypriot image on the pi as detailed at https://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/

Pull down the postgres image from here https://hub.docker.com/r/tobi312/rpi-postgresql/

This is probably not the best way, but it works! Create a file named start_pg.sh and make it executable:

docker rm postgis docker run --name postgis -d -p 5432:5432 -v /home/pirate/.local/share/postgresql:/var/lib/postgresql/data -e POSTGRES_PASSWORD=mysecretpassword tobi312/rpi-postgresql-postgis:9.6-2.3

Add the following crontab entry:

@reboot /home/pirate/start_pg.sh

This will start the postgres instance when the pi is rebooted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment