one question, is there a way to bypass firewalls like kaspersky to prevent closing of the port ?
I don't think so although probably some virus hacker would be able to do that
It is possible to run Postgres completely without it listening on a port. It will then only allow connections through Unix-domain sockets, but I don't believe this will work on Windows. Nor would I know how to use it.
Edit: I have a set of batch files that automatically initialize a Postgres database and start the server from the commandline without a service. I created them to quickly setup a development server ("Postgres to go"). They are using the binary ZIP distribution from EnterpriseDB and not the installer
If you are interested, I can post those files here.
but why only for developing, is there a problem to use them in customers pc ?
Well that was the use case for me
For a production environment with a dedicated Postgres server you will definitely want to have the service installation in order to make sure Postgres is always up and running.
And the startup through a batch file has the disadvantage that you'll have a console window open which is also not ideal for a production environment.
I have attached the batch files.
They assume that the ZIP distribution is unzipped into the folder where the files are located into a sub-directory called "server". The data directory will be created in the same folder
So the directory will be:
(unzipped binary archive)
The bare minimum to be extracted from the ZIP archive are the directories bin, lib and share
The other stuff (e.g pgAdmin) is optional and not required to run the server.
The batch file initialize.cmd is also adjusting some of the more conservative parameters in the postgresql.conf file.
For this it uses a tool called "Swiss File Knife" to replace the default values. You need to either comment those lines, or download sfk.exe from here.
If you want to run Postgres on a different port, you can either supply the parameter in the commandline for initdb (initialize.cmd, line 24) or extend the section that changes the postgresql.conf file to replace the default port with your desired one.