Sidehistorik
Install postgres via Docker (with data in /opt/pgdata)
Kodeblok |
---|
mkdir /opt/pgdata
docker run -d \
--name postgres \
--restart always \
-p 5432:5432 \
-e POSTGRES_PASSWORD=****** \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v /opt/pgdata:/var/lib/postgresql/data \
postgres |
Add Install the Postgres client on Ubuntu and add the User and Database
Kodeblok |
---|
sudo apt-get install postgresql-client
psql -U postgres -h 10.0.0.183 |
In the PSQL Console
Kodeblok |
---|
CREATE ROLE hauser WITH LOGIN PASSWORD '******' VALID UNTIL 'infinity'; CREATE DATABASE homeassistant WITH ENCODING 'UTF-8' OWNER=hauser CONNECTION LIMIT=-1; |
...
Add the configuration to the Home Assistant secrets file
Kodeblok |
---|
hadbconfig: postgresql://hauser:*****@10.0.0.183/homeassistant |
...