Dear all,
I’ve Fedora 32.(Silverblue), when install postgresql -server
$ sudo dnf install postgresql-server
$ sudo postgresql-setup --initdb
The Message Error
System has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down
FATAL: no db datadir (PGDATA) configured for ‘postgresql.service’ unit
You are inside a toolbox, right?
Yes l’m inside toolbox
This won’t work. There are limitations on systemd services inside Toolbox. sudo systemctl enable postgres
isn’t a thing inside the Toolbox image (or at least it’s limited in what it can do). I’m developing a Rails app, and I do all my local setup in a Toolbox and install everything there - except Postgresql. I run Postgresql as a separate Podman container. The app can talk to the container through the port, so the rest of the setup is transparent.
This oneliner downloads and runs the container (replace CONTAINERNAME and username, obviously):
podman run --name CONTAINERNAME -p 5432:5432 -dit -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=postgresuser -e POSTGRES_PASSWORD=postgres docker.io/postgres:12-alpine
If you need manual setup (role or db creation, psql commands, etc), run a bash session inside the container:
podman exec -it CONTAINERNAME bash
After this, start with podman start CONTAINERNAME
(or stop
or restart
or rm
(if you want to delete and start over)).
Thank you, this is very helpful @evenreven