diff --git a/README.md b/README.md index 842d55be..14212f24 100644 --- a/README.md +++ b/README.md @@ -640,6 +640,74 @@ ________________________________________________________________________________ +
+ 🔸PostgreSQL LXC + +

+ +

PostgreSQL LXC

+ +To create a new Proxmox PostgreSQL LXC, run the following in the Proxmox Shell. + +```yaml +bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/postgresql-v3.sh)" +``` + +

⚡ Default Settings: 1GB RAM - 4GB Storage - 1vCPU ⚡

+ +To make sure our PostgreSQL is secured with a strong password, set a password for its system user and then change the default database admin user account + +Change user password +```yaml +passwd postgres +``` +Login using Postgres system account + +``` +su - postgres +``` +Now, change the Admin database password +``` +psql -c "ALTER USER postgres WITH PASSWORD 'your-password';" +``` +Create a new user. +```yaml +psql +``` +```yaml +CREATE USER admin WITH PASSWORD 'your-password'; +``` +Create a new database: +```yaml +CREATE DATABASE homeassistant; +``` +Grant all rights or privileges on created database to the user +```yaml +GRANT ALL ON DATABASE homeassistant TO admin; +``` +To exit psql +```yaml +\q +``` +Then type exit to get back to root + +Change the recorder: `db_url:` in your HA configuration.yaml + +Example: `db_url: postgresql://admin:your-password@192.168.100.20:5432/homeassistant?client_encoding=utf8` + +⚙️ **To Update PostgreSQL** + +Run in the LXC console +```yaml +apt update && apt upgrade -y +``` +⚙️ [**Adminer**](https://raw.githubusercontent.com/tteck/Proxmox/main/misc/images/adminer.png) (formerly phpMinAdmin) is a full-featured database management tool + + `http://your-PostgreSQL-lxc-ip/adminer/` + +____________________________________________________________________________________________ + +
Zigbee2MQTT LXC