Table of Contents | ||||
---|---|---|---|---|
|
Requirements
You will need a running Postgres server.A quick web search will show you how to install one.
You basically need a dedicated server running where everybody has access to over the network. It’s also possible to host the database in the Cloud or at you web host.
Table of Contents | ||||
---|---|---|---|---|
|
...
webhost. A quick web search will show you how to install one or see operating system depended installation instructions below.
Creating a new library
When you create a new library the software will automatically create the new database for you.
All you have to provide is the login information (user & password), the database server (server name or IP address) and the database name - how you want to call the new database (Example: das_element). The software will setup all the tables for you. Nothing that you have to do.
Optional: You can use a SSL certificate.
...
Install Postgres Server
Setup Server
Linux
MacOS
Windows
with Docker ComposeConfigure Server
Create User
Setup Postgres Server - Linux
Installation guide for Debian:
https://linuxize.com/post/how-to-install-postgresql-on-debian-10/
Make sure to setup the postgresql.conf and pg_hba.conf correctly.
Setup Postgres Server - MacOS
It’s recommended to use Homebrew to install Postgres
https://www.sqlshack.com/setting-up-a-postgresql-database-on-mac/
Code Block |
---|
brew install postgres |
Make sure to setup the postgresql.conf and pg_hba.conf correctly.
Setup Postgres Server - Windows
On a machine that’s accessible by everybody on the network (e.g. Virtual Machine) install the Postgres Software.
Download the installer:
https://www.postgresql.org/download/windows/
Setup Postgres Server -
...
Docker Compose
A easy way to create a new database server is to use Docker Compose
Please make sure to install Docker and Docker Compose first.
create a new folder: database_postgres
create a new text file inside the folder called: docker-compose.yml
add this code snipped into the file …
Code Block |
---|
version: '3' services: postgres: image: postgres:14.4 restart: always ports: - 5432:5432 environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password volumes: - ./postgres-data:/var/lib/postgresql/data |
...
run this command to start the database:
Code Block |
---|
docker-compose up -d |
Setup Postgres Server - Linux
Installation guide for Debian:
https://linuxize.com/post/how-to-install-postgresql-on-debian-10/
Make sure to setup the postgresql.conf and pg_hba.conf correctly.
Setup Postgres Server - MacOS
It’s recommended to use Homebrew to install Postgres
https://www.sqlshack.com/setting-up-a-postgresql-database-on-mac/
Code Block |
---|
brew install postgres |
Setup Postgres Server - Windows
On a machine that’s accessible by everybody on the network (e.g. Virtual Machine) install the Postgres Software.
Download the installer:
https://www.postgresql.org/download/windows/
...
Configure Postgres Server
After the setup of the Postgres Server you need to configure the server to allow access from a remote workstation. There are two files that need changes:
configure access to the database
edit the file:
postgresql.conf
Linux:/etc/postgresql/{version}/main/postgresql.conf
MacOS:/usr/local/var/postgresql.conf
Windows:C:\Program Files\PostgreSQL\{version}\data\postgresql.conf
remove the # before the line:
listen_addresses = '*'
This allows access from all IP addresses.save the file
allow access from remote workstation
edit the file:
pg_hba.conf
Linux:/etc/postgresql/{version}/main/pg_hba.conf
MacOS:/usr/local/var/pg_hba.conf
Windows:C:\Program Files\PostgreSQL\{version}\data\pg_hba.conf
add this line to the block IPV4:
Code Block |
---|
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 trust |
Create Database User
You will need to create a User that can read/write the library information to the database.
Use the tool pgAdmin4 to view & edit your Database.
Set
When you start the application set an master password - it’s only for your local workstation to access pgAdmin4.
Dashboard → Add New Server → input information (Host name/address, Username, Password)
Create a database user Database User to allow access the database.
The User needs permission to:
login
create databases
...
Troubleshooting
no pg_hba.conf entry for host
Edit pg_hba.conf and allow Users access the database.
File location pg_hba.conf
...
Windows: C:\Program Files\PostgreSQL\14\data\pg_hba.conf
MacOS: /usr/local/var/pg_hba.conf
configure access to the database
...
.conf
...
MacOS: /usr/local/var/
...
edit line: listen_addresses = '*'
allow User access
...
pg_hba.conf
...
edit block:
...