0g Storage Node Installation Guide
This guide provides a simple installation process for setting up a 0g-Storage-Node.
Installation Steps
1. Install Dependencies
sudo apt-get update
sudo apt-get install -y cargo git clang cmake build-essential openssl pkg-config libssl-dev
2. Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
3. Download Source Code
git clone -b v1.0.0 https://github.com/0glabs/0g-storage-node.git
cd $HOME/0g-storage-node
git fetch --all --tags
git checkout 347cd3e
git submodule update --init
4. Build the Source Code
cargo build --release
5. Configure Node
# Download pre-configured turbo mode settings
rm -rf $HOME/0g-storage-node/run/config.toml
curl -o $HOME/0g-storage-node/run/config.toml https://raw.githubusercontent.com/zstake-xyz/test/refs/heads/main/0g_storage_turbo.toml
6. Set Your Miner Key
# Replace YOUR_MINER_KEY with your Private Key
read -p "Please enter your Miner Key: " miner_key
sed -i "s|^miner_key = .*|miner_key = \"$miner_key\"|g" ~/0g-storage-node/run/config.toml
7. Select RPC Endpoint (optional)
# Example: Set RPC endpoint to testnet
sed -i "s|^blockchain_rpc_endpoint = .*|blockchain_rpc_endpoint = \"https://evmrpc-testnet.0g.ai\"|g" ~/0g-storage-node/run/config.toml
8. Create System Service (for automatic startup)
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF
[Unit]
Description=ZGS Node
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-node/run
ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
9. Enable and Start the Service
sudo systemctl daemon-reload
sudo systemctl enable zgs
sudo systemctl start zgs
10. Check Node Status and Logs
sudo systemctl status zgs
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
Important Configuration
If you prefer to edit the configuration file manually:
nano ~/0g-storage-node/run/config.toml
Key settings to check:
blockchain_rpc_endpoint: RPC endpoint (default: "https://evmrpc-testnet.0g.ai")miner_key: Your private key (without '0x' prefix)
Additional Notes
- Security: Keep your private key (
miner_key) safe and secure - Snapshots: When using snapshots, only include
flow_dband deletedata_dbunder thedbfolder - Updates: To update your node, stop the service, pull the latest code, rebuild, and restart