Using Postgresql in non-daemon way
I don't like to install servers on my local and run these as a systemd service. This is why i am a big fan of the Docker.
But sometimes i just want to use servers as a specific app. Without install system-wide.
You know that, as instance; when you install #postgresql, it is create a user, installs files to your root directories, changes the ownerships and creates service files bla bla bla.
Today, i wanted to run postgresql as not a systemd service. Its easier than you think.
- Download executable (i used nix)
- Create a directory for postgres datas
- Give correct permissions to folders
adduser postgres #create user from ui in macos su postgres mkdir ./var/data ./psql/initdb ./var/data -U postgres -W #write password ./bin/postgres -D var/pgsql/data -k . ./bin/psql -h 127.0.0.1 #its ok now, let create a db ./bin/createdb hedefim -h 127.0.0.1 #you can create another super user ./bin/createuser -s hedefim_user -W -h 127.0.0.1 #write new password #you can now connect the database with your new user ./bin/psql -U hedefim_user -W hedefim -h 127.0.0.1
how its easy, right.