Install PostgreSQL¶
If you need expert help with this or any other issue, please see our terms and conditions technical support
When operating in production environments with a large number of cameras (more than 10) and with motion detection enabled, we recommend using PostgreSQL as a database, as it is more productive. There are many ways to install the PostgreSQL DBMS, we will describe 2 in our opinion the easiest and fastest. You need to choose the most suitable one for you.
A simple password is used in the examples, it is desirable to change it!
Install PostgreSQL from packages on a host¶
To install, use the official instructions from the developer's website https://www.postgresql.org/download/
Quick installation in Debian or Ubuntu:
sudo apt install postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install postgresql-14 -y
After installation and launch, you need to create a database and a role to connect.
sudo -u postgres psql -c "CREATE DATABASE yucca;"
sudo -u postgres psql -c "CREATE USER yucca WITH PASSWORD 'yucca';"
sudo -u postgres psql -c 'GRANT ALL PRIVILEGES ON DATABASE yucca TO yucca;'
Install PostgreSQL in docker¶
Launch the official container with the necessary parameters:
docker run -d \
--name yucca-postgres \
--net host \
--restart always \
-e POSTGRES_USER=yucca \
-e POSTGRES_PASSWORD=yucca \
-e POSTGRES_DB=yucca \
postgres:14.4-alpine
Setting up the Yucca connection to the database¶
Stop the server:
sudo systemctl stop yucca
Specify the type postgres
in the parameter database.type, as well as other connection details:
example of the final configuration via a file:
[database]
host = "127.0.0.1:5432"
name = "yucca"
password = "postgres"
type = "postgres"
user = "postgres"
Start the server:
sudo systemctl start yucca
Upon successful connection, the following messages can be seen in the log(debug):
sudo journalctl -o short --no-pager -n 100 -f -u yucca
2022-08-12T12:10:44.865+0500 DEBUG server/server.go:366 postgres ORM engine initialization successful
PostgreSQL 14 and older¶
Supported since Yucca version 0.7.0, read more here https://gitlab.com/yuccastream/yucca/-/issues/820