Here’s a way to quickly set up a postgres server on a ubuntu 21.10 desktop machine.

  • Install podman, runit, and runit-systemmd.
  • Create a one line run script to run postgres in a podman container.

That’s all. The server should start immediately and on reboot.

Here’s a script that does this.

  • Takes a couple of minutes to start the first time due to image download time.
  • Use podman ps to query podman
  • To disable the server, remove the run script.
  • Use sv to monitor/start/stop/restart the service:

As configured the database served is not stored anywhere permanent. You can fix this by changing the run script to suit your needs.