Database Configuration

SmallBlock CMS supports both PostgreSQL and MariaDB as production-grade database backends. This page provides installation and configuration steps across major Linux distributions, mirroring the cross-platform approach used in the Quick Setup documentation.

You may choose either backend. PostgreSQL is recommended for most deployments due to its robustness, JSON support, and consistency across platforms.

Supported Backends

SmallBlock CMS supports:

  • PostgreSQL 13+

  • MariaDB 10.5+

SQLite may be used for local testing but is not recommended for production.

Choosing a Backend

Use PostgreSQL if you want:

  • better JSON features

  • predictable indexing behavior

  • advanced query capabilities

  • stronger community ecosystem

Use MariaDB if you:

  • prefer a MySQL-compatible system

  • rely on existing infrastructure or tooling around MySQL/MariaDB

Both work seamlessly with SmallBlock CMS.

Installing PostgreSQL

RHEL / CentOS Stream 9 & 10

Enable the PostgreSQL module and install:

sudo dnf module reset postgresql
sudo dnf module enable postgresql:15
sudo dnf install -y postgresql-server postgresql-contrib

Initialize and enable the service:

sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql

Rocky Linux / AlmaLinux

Same as RHEL/CentOS:

sudo dnf module reset postgresql
sudo dnf module enable postgresql:15
sudo dnf install -y postgresql-server postgresql-contrib

sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql

Ubuntu / Debian

sudo apt update
sudo apt install -y postgresql postgresql-contrib

The PostgreSQL service starts automatically.

Fedora

sudo dnf install -y postgresql-server postgresql-contrib
sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql

Arch Linux

sudo pacman -S postgresql
sudo su - postgres -c "initdb --locale=en_US.UTF-8 -D /var/lib/postgres/data"
sudo systemctl enable --now postgresql

Create the Database and User (PostgreSQL)

sudo -u postgres psql

Inside the psql shell:

CREATE DATABASE smallblock;
CREATE USER sb_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE smallblock TO sb_user;

Exit:

\q

Installing MariaDB

RHEL / CentOS Stream 9 & 10

sudo dnf install -y mariadb-server
sudo systemctl enable --now mariadb

Secure the installation:

sudo mysql_secure_installation

Rocky Linux / AlmaLinux

Same commands as above:

sudo dnf install -y mariadb-server
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Ubuntu / Debian

sudo apt update
sudo apt install -y mariadb-server
sudo mysql_secure_installation

Fedora

sudo dnf install -y mariadb-server
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Arch Linux

sudo pacman -S mariadb
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Create the Database and User (MariaDB)

sudo mysql

Inside the MariaDB shell:

CREATE DATABASE smallblock CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'sb_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON smallblock.* TO 'sb_user'@'localhost';
FLUSH PRIVILEGES;

Exit:

EXIT;

Configure SmallBlock CMS

Edit your project’s configuration file:

Example (config/settings.ini):

[database]
ENGINE = postgresql          # or: mariadb
NAME = smallblock
USER = sb_user
PASSWORD = your_password
HOST = localhost
PORT = 5432                  # MariaDB default: 3306

Restart your development server:

smallblock runserver

Verify Connectivity

Test that SmallBlock can reach the database:

smallblock checkdb

Expected output:

Database connection successful.

Next Steps