1. Ubuntu の初期設定¶
まず Ubuntu Server の構築手順 をおこなってください。
2. プレビューノードインストール¶
インストールバージョン
| Node | CLI | GHC | Cabal | CNCLI |
|---|---|---|---|---|
| 10.5.3 | 10.11.0.0 | 9.6.7 | 3.12.1.0 | 6.6.0 |
2-1. 依存関係インストール¶
パッケージ情報の更新とアップデート
依存するパッケージをインストール
3-1. バイナリをダウンロード¶
バイナリをダウンロード
mkdir -p $HOME/git/cardano-node2
cd $HOME/git/cardano-node2
wget -q https://github.com/IntersectMBO/cardano-node/releases/download/10.5.3/cardano-node-10.5.3-linux.tar.gz
解凍する
バージョン確認
$(find $HOME/git/cardano-node2 -type f -name "cardano-cli") version
$(find $HOME/git/cardano-node2 -type f -name "cardano-node") version
cardano-cli 10.11.0.0 - linux-x86_64 - ghc-9.6
git rev 6c034ec038d8d276a3595e10e2d38643f09bd1f2cardano-node 10.5.3 - linux-x86_64 - ghc-9.6
git rev 6c034ec038d8d276a3595e10e2d38643f09bd1f2
バイナリファイルをインストールする
インストールされたノードバージョンを確認する
cardano-cli 10.11.0.0 - linux-x86_64 - ghc-9.6
git rev 6c034ec038d8d276a3595e10e2d38643f09bd1f2cardano-node 10.5.3 - linux-x86_64 - ghc-9.6
git rev 6c034ec038d8d276a3595e10e2d38643f09bd1f2
環境変数を設定しパスを通します
echo PATH="$HOME/.local/bin:$PATH" >> $HOME/.bashrc
echo export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc
echo export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $HOME/.bashrc
echo export NODE_HOME=$HOME/cnode >> $HOME/.bashrc
環境変数にネットワークを指定する
echo export NODE_CONFIG=preview >> $HOME/.bashrc
echo export NODE_NETWORK='"--testnet-magic 2"' >> $HOME/.bashrc
echo export CARDANO_NODE_NETWORK_ID=2 >> $HOME/.bashrc
.bashrcを再読み込みする
ノード構成ファイルを取得する
mkdir $NODE_HOME
cd $NODE_HOME
wget -q https://book.play.dev.cardano.org/environments/preview/byron-genesis.json -O byron-genesis.json
wget -q https://book.play.dev.cardano.org/environments/preview/topology.json -O topology.json
wget -q https://book.play.dev.cardano.org/environments/preview/shelley-genesis.json -O shelley-genesis.json
wget -q https://book.play.dev.cardano.org/environments/preview/alonzo-genesis.json -O alonzo-genesis.json
wget -q https://book.play.dev.cardano.org/environments/preview/conway-genesis.json -O conway-genesis.json
wget -q https://book.play.dev.cardano.org/environments/preview/peer-snapshot.json -O peer-snapshot.json
環境変数を追加し、.bashrcファイルを再読み込みする
リレーノードが使用するポート番号を指定して実行する
起動スクリプトファイルを作成する
cat > $NODE_HOME/startRelayNode1.sh << EOF
#!/bin/bash
DIRECTORY=$NODE_HOME
PORT=${PORT}
HOSTADDR=0.0.0.0
TOPOLOGY=\${DIRECTORY}/topology.json
DB_PATH=\${DIRECTORY}/db
SOCKET_PATH=\${DIRECTORY}/db/socket
CONFIG=\${DIRECTORY}/${NODE_CONFIG}-config.json
/usr/local/bin/cardano-node +RTS -N --disable-delayed-os-memory-return -I0.1 -Iw300 -A16m -F1.5 -H2500M -RTS run --topology \${TOPOLOGY} --database-path \${DB_PATH} --socket-path \${SOCKET_PATH} --host-addr \${HOSTADDR} --port \${PORT} --config \${CONFIG}
EOF
BPノードが使用するポート番号を指定して実行する
起動スクリプトファイルを作成する
cat > $NODE_HOME/startBlockProducingNode.sh << EOF
#!/bin/bash
DIRECTORY=$NODE_HOME
PORT=${PORT}
HOSTADDR=0.0.0.0
TOPOLOGY=\${DIRECTORY}/topology.json
DB_PATH=\${DIRECTORY}/db
SOCKET_PATH=\${DIRECTORY}/db/socket
CONFIG=\${DIRECTORY}/${NODE_CONFIG}-config.json
/usr/local/bin/cardano-node +RTS -N --disable-delayed-os-memory-return -I0.1 -Iw300 -A16m -F1.5 -H2500M -RTS run --topology \${TOPOLOGY} --database-path \${DB_PATH} --socket-path \${SOCKET_PATH} --host-addr \${HOSTADDR} --port \${PORT} --config \${CONFIG}
EOF
起動スクリプトに実行権限を付与し、ブロックチェーンとの同期を開始する
サービスユニットファイルを作成する
cat > $NODE_HOME/cardano-node.service << EOF
# The Cardano node service (part of systemd)
# file: /etc/systemd/system/cardano-node.service
[Unit]
Description = Cardano node service
Wants = network-online.target
After = network-online.target
[Service]
User = ${USER}
Type = simple
WorkingDirectory= ${NODE_HOME}
ExecStart = /bin/bash -c '${NODE_HOME}/startRelayNode1.sh'
KillSignal=SIGINT
RestartKillSignal=SIGINT
TimeoutStopSec=300
LimitNOFILE=32768
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cardano-node
[Install]
WantedBy = multi-user.target
EOF
cat > $NODE_HOME/cardano-node.service << EOF
# The Cardano node service (part of systemd)
# file: /etc/systemd/system/cardano-node.service
[Unit]
Description = Cardano node service
Wants = network-online.target
After = network-online.target
[Service]
User = ${USER}
Type = simple
WorkingDirectory= ${NODE_HOME}
ExecStart = /bin/bash -c '${NODE_HOME}/startBlockProducingNode.sh'
KillSignal=SIGINT
RestartKillSignal=SIGINT
TimeoutStopSec=300
LimitNOFILE=32768
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cardano-node
[Install]
WantedBy = multi-user.target
EOF
systemdにユニットファイルをコピーする
権限を付与するOS起動時にサービスの自動起動を有効にする
ログを確認する
Mithrilによる同期¶
mithril-clientをダウンロード¶
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/input-output-hk/mithril/refs/heads/main/mithril-install.sh | sh -s -- -c mithril-client -d latest -p $HOME/git/
mithril-clientをインストール¶
バージョン確認¶
環境変数を設定¶
export AGGREGATOR_ENDPOINT=https://aggregator.testing-preview.api.mithril.network/aggregator
export GENESIS_VERIFICATION_KEY=$(curl -fsSL https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/genesis.vkey)
export ANCILLARY_VERIFICATION_KEY=$(curl -fsSL https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/ancillary.vkey)
既存DBフォルダを削除¶
最新スナップショットのダウンロード¶
mithril-client cardano-db download \
--backend v2 \
--run-mode testing-preview \
--download-dir "$NODE_HOME" \
--include-ancillary \
latest
cardano-node を起動する¶
journalctl でログを確認する¶
Guild LiveView¶
glive のインストール¶
curl -s -o gLiveView.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/gLiveView.sh
curl -s -o env https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/env
chmod 755 gLiveView.sh
sed -i $NODE_HOME/scripts/env \
-e '1,73s!#CNODE_HOME="/opt/cardano/cnode"!CNODE_HOME=${NODE_HOME}!' \
-e '1,73s!#CNODE_PORT=6000!CNODE_PORT='${b_PORT}'!' \
-e '1,73s!#UPDATE_CHECK="Y"!UPDATE_CHECK="N"!' \
-e '1,73s!#CONFIG="${CNODE_HOME}/files/config.json"!CONFIG="${CNODE_HOME}/'${NODE_CONFIG}'-config.json"!' \
-e '1,73s!#SOCKET="${CNODE_HOME}/sockets/node.socket"!SOCKET="${CNODE_HOME}/db/socket"!' \
-e '1,73s!#PROM_HOST=127.0.0.1!PROM_HOST=127.0.0.1!' \
-e '1,73s!#PROM_PORT=12798!PROM_PORT=12798!'