本指南提供在各种平台上安装和设置 Stable 节点的详细说明。
前提条件
在开始安装之前,请确保你已:
- 满足所有系统要求
- 拥有服务器的 root 或 sudo 访问权限
- 具备基本的 Linux 命令行知识
安装方法
使用适用于你的平台的预编译二进制文件。Stable 目前不支持从源码构建。
主网
Linux AMD64
# Download the latest binary for AMD64 architecture
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/binary/stabled-latest-linux-amd64-mainnet.tar.gz
# Extract the archive
tar -xvzf stabled-latest-linux-amd64-mainnet.tar.gz
# Move binary to system path
sudo mv stabled /usr/bin/
# Verify installation
stabled versionLinux ARM64
# Download the binary for ARM64 architecture
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/binary/stabled-latest-linux-arm64-mainnet.tar.gz
# Extract and install
tar -xvzf stabled-latest-linux-arm64-mainnet.tar.gz
sudo mv stabled /usr/bin/
# Verify installation
stabled version测试网
Linux AMD64
# Download the latest binary for AMD64 architecture
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/testnet/binary/stabled-latest-linux-amd64-testnet.tar.gz
# Extract the archive
tar -xvzf stabled-latest-linux-amd64-testnet.tar.gz
# Move binary to system path
sudo mv stabled /usr/bin/
# Verify installation
stabled versionLinux ARM64
# Download the binary for ARM64 architecture
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/testnet/binary/stabled-latest-linux-arm64-testnet.tar.gz
# Extract and install
tar -xvzf stabled-latest-linux-arm64-testnet.tar.gz
sudo mv stabled /usr/bin/
# Verify installation
stabled version节点初始化
安装二进制文件后,初始化你的节点:
步骤 1:设置节点名称
# Set your node's moniker (choose a unique name)
export MONIKER="your-node-name"步骤 2:初始化节点
主网
# Initialize with the mainnet chain ID
stabled init $MONIKER --chain-id stable_988-1
# This creates the configuration directory at ~/.stabled/注意:有关包括 chain ID 在内的当前网络参数,请参阅主网信息
测试网
# Initialize with the testnet chain ID
stabled init $MONIKER --chain-id stabletestnet_2201-1
# This creates the configuration directory at ~/.stabled/注意:有关包括 chain ID 在内的当前网络参数,请参阅测试网信息
步骤 3:下载创世文件
Mainnet
# Create backup of default genesis
mv ~/.stabled/config/genesis.json ~/.stabled/config/genesis.json.backup
# Download mainnet genesis
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/configuration/genesis.zip
unzip genesis.zip
# Move genesis to config directory
cp genesis.json ~/.stabled/config/genesis.json
# Verify genesis checksum
sha256sum ~/.stabled/config/genesis.json
# Expected: e1ceda79a3cc48a1028ca8646a2e9e2d156f610637cfb8b428ca8354277921f1步骤 4:配置节点
下载配置文件
Mainnet
# Download optimized configuration (choose one based on your node type)
# For RPC/Full nodes:
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/configuration/rpc_node_config.zip
unzip rpc_node_config.zip
# For Archive nodes:
# wget https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/configuration/archive_node_config.zip
# unzip archive_node_config.zip
# Backup original config
cp ~/.stabled/config/config.toml ~/.stabled/config/config.toml.backup
# Apply new configuration
cp config.toml ~/.stabled/config/config.toml
# Update moniker in config
sed -i "s/^moniker = \".*\"/moniker = \"$MONIKER\"/" ~/.stabled/config/config.toml必要的配置更新
编辑 ~/.stabled/config/app.toml:
# Enable JSON-RPC for EVM compatibility
[json-rpc]
enable = true
address = "0.0.0.0:8545"
ws-address = "0.0.0.0:8546"
allow-unprotected-txs = true编辑 ~/.stabled/config/config.toml:
Mainnet
# P2P Configuration
[p2p]
# Maximum number of peers
max_num_inbound_peers = 50
max_num_outbound_peers = 30
# Seed nodes
seeds = "9aa181b20248e948567cb47a15eae35d58cd549d@seed1.stable.xyz:46656"
# Persistent peers (mainnet seed nodes)
persistent_peers = "b896f6f8ca5a4d1cc40de09407df0c96e76df950@peer1.stable.xyz:26656"
# Enable peer exchange
pex = true
# RPC Configuration
[rpc]
# Listen address
laddr = "tcp://0.0.0.0:26657"
# Maximum number of simultaneous connections
max_open_connections = 900
# CORS settings (adjust for production)
cors_allowed_origins = ["*"]Systemd 服务设置
创建一个 systemd 服务以实现自动管理:
步骤 1:创建服务文件
Mainnet
sudo tee /etc/systemd/system/stabled.service > /dev/null <<EOF
[Unit]
Description=Stable Daemon Service
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/bin/stabled start --chain-id stable_988-1
Restart=always
RestartSec=3
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal
SyslogIdentifier=stabled
[Install]
WantedBy=multi-user.target
EOF步骤 2:启用并启动服务
# Reload systemd configuration
sudo systemctl daemon-reload
# Enable service to start on boot
sudo systemctl enable stabled
# Start the service
sudo systemctl start stabled
# Check service status
sudo systemctl status stabled
# View logs
sudo journalctl -u stabled -fCosmovisor 设置(推荐用于自动升级)
Cosmovisor 是一个进程管理器,可自动处理链升级。这是生产节点的推荐设置。
步骤 1:安装 Cosmovisor
# Install Cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
# Or download pre-built binary
wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.7.0/cosmovisor-v1.7.0-linux-amd64.tar.gz
tar -xvzf cosmovisor-v1.7.0-linux-amd64.tar.gz
sudo mv cosmovisor /usr/bin/
# Verify installation
cosmovisor version步骤 2:设置环境变量
# Add to ~/.bashrc or ~/.profile
echo "# Cosmovisor Configuration" >> ~/.bashrc
echo "export DAEMON_NAME=stabled" >> ~/.bashrc
echo "export DAEMON_HOME=$HOME/.stabled" >> ~/.bashrc
echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.bashrc
echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.bashrc
echo "export DAEMON_LOG_BUFFER_SIZE=512" >> ~/.bashrc
echo "export UNSAFE_SKIP_BACKUP=true" >> ~/.bashrc
# Load variables
source ~/.bashrc步骤 3:设置 Cosmovisor 目录结构
# Create cosmovisor directory structure
mkdir -p ~/.stabled/cosmovisor/genesis/bin
mkdir -p ~/.stabled/cosmovisor/upgrades
# Copy current binary to genesis
cp /usr/bin/stabled ~/.stabled/cosmovisor/genesis/bin/
# Create current symlink
ln -s ~/.stabled/cosmovisor/genesis ~/.stabled/cosmovisor/current
# Verify setup
ls -la ~/.stabled/cosmovisor/
cosmovisor run version步骤 4:设置环境变量
# Set service name (default: stable)
export SERVICE_NAME=stable步骤 5:创建服务文件
Mainnet
sudo tee /etc/systemd/system/${SERVICE_NAME}.service > /dev/null <<EOF
[Unit]
Description=Cosmovisor daemon
After=network-online.target
[Service]
Environment="DAEMON_NAME=stabled"
Environment="DAEMON_HOME=$HOME/.stabled"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
User=$USER
ExecStart=$(which cosmovisor) run start --chain-id stable_988-1
Restart=always
RestartSec=3
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal
SyslogIdentifier=${SERVICE_NAME}
[Install]
WantedBy=multi-user.target
EOF步骤 6:启用并启动服务
# Reload systemd
sudo systemctl daemon-reload
# Enable service
sudo systemctl enable ${SERVICE_NAME}
# Start the service
sudo systemctl start ${SERVICE_NAME}
# Check status
sudo systemctl status ${SERVICE_NAME}
# View logs
sudo journalctl -u ${SERVICE_NAME} -f准备升级
当链升级公布时:
# Example: Preparing for v0.8.0 upgrade
UPGRADE_NAME="v0.8.0"
mkdir -p ~/.stabled/cosmovisor/upgrades/$UPGRADE_NAME/bin
# Download new binary
wget https://stable-data-dist.s3.us-east-1.amazonaws.com/testnet/binary/stabled-0.8.0-linux-amd64-testnet.tar.gz
tar -xvzf stabled-0.8.0-linux-amd64-testnet.tar.gz
# Place in upgrade directory
mv stabled ~/.stabled/cosmovisor/upgrades/$UPGRADE_NAME/bin/
# Verify the binary
~/.stabled/cosmovisor/upgrades/$UPGRADE_NAME/bin/stabled version
# Cosmovisor will automatically switch to this binary at the upgrade height监控 Cosmovisor
# Check current binary version
cosmovisor run version
# View upgrade info
ls -la ~/.stabled/cosmovisor/upgrades/
# Check service logs for upgrade status
sudo journalctl -u ${SERVICE_NAME} | grep -i upgrade
# Monitor real-time logs during upgrade
sudo journalctl -u ${SERVICE_NAME} -f手动 Systemd 服务设置(替代方案)
如果你不想使用 Cosmovisor,可以创建一个标准的 systemd 服务:
步骤 1:设置环境变量
# Set service name (default: stable)
export SERVICE_NAME=stable步骤 2:创建服务文件
Mainnet
sudo tee /etc/systemd/system/${SERVICE_NAME}.service > /dev/null <<EOF
[Unit]
Description=Stable Daemon Service
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/bin/stabled start --chain-id stable_988-1
Restart=always
RestartSec=3
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal
SyslogIdentifier=${SERVICE_NAME}
[Install]
WantedBy=multi-user.target
EOF步骤 3:启用并启动服务
# Reload systemd configuration
sudo systemctl daemon-reload
# Enable service to start on boot
sudo systemctl enable ${SERVICE_NAME}
# Start the service
sudo systemctl start ${SERVICE_NAME}
# Check service status
sudo systemctl status ${SERVICE_NAME}
# View logs
sudo journalctl -u ${SERVICE_NAME} -f快速同步选项
如需更快的同步,请参阅快照与同步指南,了解:
- 归档节点快照
- 修剪节点快照
安装后验证
检查节点状态
# Check if node is running
sudo systemctl status stabled
# Check sync status
curl -s localhost:26657/status | jq '.result.sync_info'
# Check connected peers
curl -s localhost:26657/net_info | jq '.result.n_peers'
# Check latest block
curl -s localhost:26657/status | jq '.result.sync_info.latest_block_height'监控日志
# Follow service logs
sudo journalctl -u stabled -f
# Check for errors
sudo journalctl -u stabled --since "1 hour ago" | grep -i error
# Check for peer connections
sudo journalctl -u stabled --since "10 minutes ago" | grep -i "peer"安全加固
安装后,保护你的节点:
防火墙配置
# Configure UFW
sudo ufw allow 22/tcp # SSH
sudo ufw allow 26656/tcp # P2P
sudo ufw allow 26657/tcp # RPC (only if needed externally)
sudo ufw enable后续步骤
故障排除
如果你在安装过程中遇到问题:
- 查看故障排除指南
- 验证是否满足系统要求
- 确保端口未被防火墙阻止
- 检查磁盘空间和权限
- 查看 systemd 日志中的错误

