Install PostgreSQL on Windows
To install PostgreSQL on Windows:
- Download and run the Windows PostgreSQL one click installer. When the wizard prompts you to choose where to install PostgreSQL, point it to the apps subdirectory of your <LABKEY_ROOT>, i.e. C:\labkey\apps\postgresql-10.6\
- Keep track of the PostgreSQL Windows Service account name and password. LabKey Server needs to ask for it so that we can pass it along to the PostgreSQL installer.
- Keep track of the database superuser name and password. You'll need these to initially create the LabKey database, the LabKey database user, and grant that user the owner role.
- We recommend that you install the graphical tool pgAdmin 4.x for easy database administration. Leave the default settings as they are on the "Installation Options" page to include pgAdmin.
- Create the database. Only for binary installs. Using superuser permissions, do the following:
- Create an empty database.
- Create a PostgreSQL user named 'labkey'.
- Grant the owner role to the labkey user over the database.
- Revoke public permissions from the database.
See the following example PostgreSQL commands:
Connect to the DB server as the Postgres Super User using the psql command:
psql -h <host_Name> -U <Super_username> -d postgres
Issue the following SQL commands to create the user, database and revoke public permissions from the database
create user labkey password 'PASSWORD_HERE' ;
create database "<labkey_db_name>" with owner labkey;
revoke all on database "<labkey_db_name>" from public;
Please read the notes below to forestall any difficulties with the PostgreSQL installation.