Linux - Cardano DB Sync Installation

Komplett Uleedung fir Cardano DB Sync op Debian 12 ze installéieren mat PostgreSQL-Datebank a NIX-Paketmanager, inklusiv Service-Konfiguratioun

Debian 12Cardano DB SyncPostgreSQLNIXBlockchainDatabase

Wichteg Hiweiser

Bedenkt dës wichteg Punkten virum Setup

Cardano Node

Eng lafend Cardano-Node ass erfuerderlech fir DB Sync

Späicherplaz

Op d'mannst 700GB fräie Späicherplaz (Cardano Node: 203GB, DB Sync: 10GB, PostgreSQL: 438GB)

RAM-Bedarf

Op d'mannst 48GB RAM (Cardano Node: 24GB, DB Sync: 21GB, System: 3GB)

Synchronisatiounszäit

Éischt Synchronisatioun kann e puer Deeg daueren

Root-Zougang

Root-Zougang oder sudo-Berechtegung erfuerderlech

Setup Schrëtt

Install PostgreSQL and additional extensions
sudo apt install postgresql postgresql-contrib
Enable PostgreSQL service for automatic startup
sudo systemctl enable postgresql
Start PostgreSQL service
sudo systemctl start postgresql
Connect to PostgreSQL console as postgres user
sudo -u postgres psql
Create Cardano database user with password
CREATE USER cardano WITH PASSWORD 'PASSWORD';
Note: Use a strong, secure password
Create Cardano Explorer database
CREATE DATABASE cexplorer OWNER cardano;
Grant all privileges for the database
GRANT ALL PRIVILEGES ON DATABASE cexplorer TO cardano;
Exit PostgreSQL console
\q
Switch to cardano user account
sudo -i -u cardano
Clone Cardano DB Sync repository
git clone https://github.com/IntersectMBO/cardano-db-sync.git
List files in cardano directory
ls -al
Change to cardano-db-sync directory
cd cardano-db-sync/
List available version tags
git tag | sort -V
Switch to specific version tag
git switch -d tags/13.6.0.5
Install Cardano DB Sync with NIX
nix profile install .
Note: This installation may take some time
Verify installation by checking version
cardano-db-sync --version
List installed NIX profiles
nix profile list
.pgpass
localhost:5432:cexplorer:cardano:PASSWORD
Set file permissions for security
chmod 600 ~/cardano-config/.pgpass
Exit cardano user account
exit
Create system-wide symbolic link
sudo ln -sf /home/cardano/.nix-profile/bin/cardano-db-sync /usr/local/bin/cardano-db-sync
Test symbolic link by checking version
cardano-db-sync --version
cardano-db-sync.service
[Unit]
Description=Cardano DB Sync
After=network.target cardano-node.service
Requires=cardano-node.service

[Service]
User=cardano
Group=cardano
WorkingDirectory=/home/cardano/cardano-config
Environment="PGPASSFILE=/home/cardano/cardano-config/.pgpass"
ExecStart=/usr/local/bin/cardano-db-sync \
  --config /home/cardano/cardano-config/db-sync-config.json \
  --socket-path /home/cardano/cardano-db/node.socket \
  --state-dir /home/cardano/cardano-db-sync-state \
  --schema-dir /home/cardano/cardano-db-sync/schema

Restart=on-failure
RestartSec=10
LimitNOFILE=32768

[Install]
WantedBy=multi-user.target
Reload systemd for new service
sudo systemctl daemon-reload
Enable service for automatic startup
sudo systemctl enable cardano-db-sync
Start Cardano DB Sync service
sudo systemctl start cardano-db-sync
Check service status
sudo systemctl status cardano-db-sync
Follow service logs in real-time
journalctl -u cardano-db-sync -f

Zousätzlech Tipps

Nëtzlech Kommandoen an Tipps fir besser Gestioun

Cardano DB Sync Installation ofgeschloss!

Är Cardano DB Sync leeft elo a synchroniséiert Blockchain-Donnéeën an d'PostgreSQL-Datebank. Iwwerwaacht reegelméisseg d'Logs an de Synchronisatiounsfortschrëtt.