Using Postgresql in non-daemon way

I don't like to install servers on my local and run these as service. This is why i am a big fan of Docker.

But sometimes i just want to use servers as an ordinary apps. Without install system-wide.

You know that, as instance; when you install postgresql, its creating a user, installing files to you root directories, changing ownerships and creating service files bla bla.

Today, i wanted to run postgresql as not a service. Its easier than you think.

adduser postgres
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.

talk soon.

#en #postgresql