Aller au contenu

Linux - Installation du Nœud Cardano

Guide complet pour installer un Nœud Cardano sur Debian 12 avec le gestionnaire de paquets NIX, incluant la configuration du service et la surveillance.

Debian 12CardanoNIXBlockchainCryptocurrencyNode

Étapes d'Installation

1

Install System Dependencies

Installation of required system packages for the NIX package manager installation.

Install system dependencies

sudo apt update && sudo apt install -y git tmux curl
2

Install NIX Package Manager

Installation of the NIX package manager for managing Cardano Node dependencies.

Install NIX package manager

sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon

Restart system

reboot

A restart is required after NIX installation

3

Configure NIX for Cardano

Configuration of the NIX package manager with official IOHK binary caches for optimized downloads.

Edit NIX configuration

nix.conf
1
2
3
build-users-group = nixbldexperimental-features = nix-command flakestrusted-users = root cardano

Restart NIX daemon

systemctl restart nix-daemon.service
4

Create Cardano User

Creating a dedicated user for Cardano Node operation.

Create Cardano user

sudo useradd -m -s /bin/bash cardano
5

Install Cardano Node

Installation of Cardano Node and CLI tools via the NIX system.

Switch to Cardano user

sudo -i -u cardano

Clone Cardano Node repository

git clone https://github.com/IntersectMBO/cardano-node

Change to Cardano Node directory

cd cardano-node

Display available versions

git tag | sort -V

Checkout current stable version

git switch -d tags/10.4.1

Install Cardano Node and CLI in NIX profile

nix profile install .#cardano-node .#cardano-cli

This can take 30-60 minutes as all dependencies are compiled

6

Create System Symlinks

Creating symlinks for system-wide access to Cardano tools.

Create symlink for Cardano Node

sudo ln -sf /home/cardano/.nix-profile/bin/cardano-node /usr/local/bin/cardano-node

Create symlink for Cardano CLI

sudo ln -sf /home/cardano/.nix-profile/bin/cardano-cli /usr/local/bin/cardano-cli

Adjust the path according to your NIX profile

7

Download Node Configuration

Download of official Cardano network configuration files.

Switch to Cardano user

sudo -i -u cardano

Create configuration directories

mkdir -p ~/cardano-config ~/cardano-db

Change to configuration directory

cd ~/cardano-config

Download official configuration files

curl -O -J "https://book.play.dev.cardano.org/environments/mainnet/{config,db-sync-config,submit-api-config,topology,byron-genesis,shelley-genesis,alonzo-genesis,conway-genesis,checkpoints}.json"
8

Setup Systemd Service

Configuration of Cardano Node as systemd service for automatic startup.

Create systemd service file

cardano-node.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[Unit]Description=Cardano NodeAfter=network.target [Service]User=cardanoGroup=cardanoWorkingDirectory=/home/cardano/cardano-configExecStart=/usr/local/bin/cardano-node run \  --topology /home/cardano/cardano-config/topology.json \  --database-path /home/cardano/cardano-db \  --socket-path /home/cardano/cardano-db/node.socket \  --host-addr 0.0.0.0 \  --port 3001 \  --config /home/cardano/cardano-config/config.jsonRestart=on-failureRestartSec=10LimitNOFILE=32768 [Install]WantedBy=multi-user.target

Reload systemd manager

systemctl daemon-reload

Enable Cardano Node service

systemctl enable cardano-node

Start Cardano Node service

systemctl start cardano-node
9

Setup Node Monitoring

Monitoring node logs and synchronization process.

Follow service logs

journalctl -u cardano-node -f

Check synchronization progress

cardano-cli query tip --socket-path /home/cardano/cardano-db/node.socket --mainnet

Initial blockchain synchronization can take 24-48 hours

Conseils Supplémentaires

Commandes et conseils utiles pour une meilleure gestion

Synchronization Monitoring

Check synchronization status

systemctl status cardano-node

Display current blockchain size

du -sh /home/cardano/cardano-db

Service Management

Restart Cardano Node service

systemctl restart cardano-node

Stop Cardano Node service

systemctl stop cardano-node

Troubleshooting

Display full logs

journalctl -u cardano-node --no-pager -l

Check Cardano Node process

ps aux | grep cardano

Ressources Supplémentaires

Documentation officielle et liens utiles

NIX Download

Official NIX package manager website with installation guides

Cardano Installation Guide

Official Cardano Node installation documentation

Running a Node

Official guide for operating a Cardano Node