Quick Setup Step 3¶
Configure a Database¶
This step installs and prepares your database for SmallBlock CMS. SmallBlock supports PostgreSQL and MariaDB.
Tip
For development, either backend works fine. For production, PostgreSQL is recommended for reliability and advanced features.
—
Debian / Ubuntu (22.04+)¶
Install PostgreSQL:
sudo apt update
sudo apt install -y postgresql postgresql-contrib
Enable and start the service:
sudo systemctl enable --now postgresql
Create database and user:
sudo -u postgres psql <<'SQL'
CREATE DATABASE smallblock;
CREATE USER sb_user WITH PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE smallblock TO sb_user;
SQL
—
RHEL / CentOS / AlmaLinux / Rocky / Stream 9–10¶
Install PostgreSQL server package:
sudo dnf install -y postgresql-server
sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql
Then create database and user:
sudo -u postgres psql <<'SQL'
CREATE DATABASE smallblock;
CREATE USER sb_user WITH PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE smallblock TO sb_user;
SQL
—
Fedora¶
sudo dnf install -y postgresql-server
sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql
sudo -u postgres createuser -P sb_user
sudo -u postgres createdb -O sb_user smallblock
—
openSUSE Leap / Tumbleweed¶
sudo zypper install -y postgresql-server
sudo systemctl enable --now postgresql
sudo -u postgres createuser -P sb_user
sudo -u postgres createdb -O sb_user smallblock
—
Arch Linux¶
sudo pacman -Syu --noconfirm postgresql
sudo -iu postgres initdb --locale=en_US.UTF-8 -D /var/lib/postgres/data
sudo systemctl enable --now postgresql
sudo -u postgres createuser -P sb_user
sudo -u postgres createdb -O sb_user smallblock
—
MariaDB Alternative¶
If you prefer MariaDB:
# Debian/Ubuntu
sudo apt install -y mariadb-server
# RHEL/Fedora/CentOS
sudo dnf install -y mariadb-server
# openSUSE
sudo zypper install -y mariadb
# Arch
sudo pacman -Syu --noconfirm mariadb
Enable and secure the service:
sudo systemctl enable --now mariadb
sudo mysql_secure_installation
Create database and user:
CREATE DATABASE smallblock CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'sb_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON smallblock.* TO 'sb_user'@'localhost';
FLUSH PRIVILEGES;
—
Configure SmallBlock¶
Set the connection string in your project’s environment file (.env):
# PostgreSQL
DATABASE_URL=postgresql://sb_user:secure_password@localhost/smallblock
# MariaDB
DATABASE_URL=mysql://sb_user:secure_password@localhost/smallblock
Test the connection:
smallblock check
If successful, you’ll see:
✔ Database connection OK (PostgreSQL 13)
—
Next Step¶
Continue to Step 4 — Run the Development Server.