Installguide: PostgreSQL 9.x 64-Bit and hMailServer 5.x

This section contains user-submitted tutorials.
Post Reply
User avatar
Dravion
Senior user
Senior user
Posts: 2071
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Installguide: PostgreSQL 9.x 64-Bit and hMailServer 5.x

Post by Dravion » 2017-08-30 14:02

There is no Installation guide for Postgres on Windows with hMailServer in our User Tutorial Section, so i decided to provide one because Postgres is a awsome Database and needs some attention. This Guide will try to provide the easiest possible steps to get the Job done in easymode.

Lets begin:

Download:
Latest hMailServer:
https://www.hmailserver.com/download_ge ... loadid=256
PostgreSQL 9.6.4-1 64-Bit for Windows
https://get.enterprisedb.com/postgresql ... ws-x64.exe

1) Run and Install PostgreSQL first, setup a PostgreSQL Adminpassword (you need it later)
2) Run and Install hMailServer 5.x setup, enter a hMailServer Admin password and proceed.
3) Wait until the Database Wizzard is shown

Now we need to run PostgreSQL PgAdmin4 Admin tool GUI (part of you Postgres installation)

1) Start pgAdmin4
2) Expand Servers and then Expand PostgreSQL
3) In Dialog "Connect to Server" enter your PostgreSQL Admin password.
4) After successful login, rightclick on Login/Group Roles and click "Create/Login/Group Role..."
5) In Tab General click into input field 'Name' and provide a new PostgreSQL Database Username (for example: hmsdbusr)
6) Click Tab "Definition" and click into input field 'Password' and provide a new Password (for example: hmsdbusrpwd)
7) Click Tab "Privileges", change "Can login?" , "Superuser" and "Create databases" from "No to Yes"

In hMailServer Database Setup - Step 4 of 7 provide the following settings:
Database server address: localhost / Port 5432
Database name: hmsmailserverdb
Authentication: Use server authentication (Windows authentication isnt avaiable for Postgres)
Username: hmsdbusr
Password: hmsdbusrpwd

In hMailServer Database Wizard- Step 5 of 7 Select the PostgreSQL System Service (for example)
postgresql-x64-9.6 (postgresql-x64-9.6) and click Next, but DONT Click Next from Step 6 of 7 to 7 of 7 right now! because you need to change you PostgreSQL Configfile pg_hba.conf

1) Click Windows Start menu
2) Type in: C:\Program Files\PostgreSQL\9.6\data\pg_hba.conf into "Search Program and files" input field
2) Hit Enter or Click ok, you should see a opened Notepad with loaded ph_hba.conf config file
3) Scroll down to the bottom of the file and change the following entry:


# IPv4 local connections:

FROM:

host     all             all             127.0.0.1/32            md5
TO:
host     all             all             127.0.0.1/32            password

4) In Notepad, save the file and exit Notepad
5) In Windows Start menu goto "All Programs" > PostgreSQL 9.6 > Expand
6) Rightclick "Run as administrator" on "Reload Configuration"

Now switch Back to hMailServers DBSetup Wizard and click next on (Step 6 of 7) and finish the hMailServers
setup.

DONE.
Now login to hMailServer Admin and check your DB-Settings, it should look like this Screenshot:

Screenshot:
Attachments
VirtualBox_Win7_64_30_08_2017_13_44_27.png

User avatar
jimimaseye
Moderator
Moderator
Posts: 10053
Joined: 2011-09-08 17:48

Re: Installguide: PostgreSQL 9.x 64-Bit and hMailServer 5.x

Post by jimimaseye » 2017-08-30 14:43

Thanks Dravion.
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

praveen_jobs
New user
New user
Posts: 1
Joined: 2021-12-31 13:56

Re: Installguide: PostgreSQL 9.x 64-Bit and hMailServer 5.x

Post by praveen_jobs » 2021-12-31 14:30

Hi Dravion,

I am unable to create a database.
I am using PostgreSQL 14, OS: Windows 10.

I followed the above steps as described.

I changed the password encryption in pg_hba.conf and pg_sql.conf from scram-sha-256 to md5, password,trust,peer.

Please guide.

The below is the error:

Authentication type 10 is not supported in the hmailserver popup.
hmailserver_Pssql_Authenication Error.JPG

User avatar
Dravion
Senior user
Senior user
Posts: 2071
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Installguide: PostgreSQL 9.x 64-Bit and hMailServer 5.x

Post by Dravion » 2022-02-03 12:24

You need to set auth method to trust and have a user password setup for your PostgreSQL user.

hMailServer can only connect to PostgreSQL by using password authentication.

Remember also:

You need to enable socket_listen in postgresql.conf or postgres will reject any TCP/IP connection which is not localhost!

Post Reply