Skip to content

Module 0: Prerequisites & Environment Setup

This module guides you through setting up a complete development environment for Solana DApp development. By the end, you'll have all tools installed and verified.

Overview

Tool Purpose Required
Rust Smart contract development Yes
Solana CLI Blockchain interaction Yes
Anchor Framework for Solana programs Yes
Node.js + pnpm Frontend development Yes
Python + Poetry Backend services Yes
Docker Containerization Yes
Kubernetes tools Deployment Optional*

*Required for Modules 12-13

1. Rust Installation

Rust is the primary language for Solana smart contracts.

# Download and run rustup-init.exe from https://rustup.rs
# Or use winget:
winget install Rustlang.Rustup

# Restart your terminal, then verify:
rustc --version
cargo --version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

rustc --version
cargo --version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

rustc --version
cargo --version

Expected Output

rustc 1.75.0 (or newer)
cargo 1.75.0 (or newer)

2. Solana CLI Installation

The Solana CLI allows you to interact with Solana clusters.

# Open PowerShell as Administrator
cmd /c "curl -sSfL https://release.solana.com/v1.18.0/solana-install-init-x86_64-pc-windows-msvc.exe --output solana-install-init.exe"
.\solana-install-init.exe v1.18.0

# Add to PATH (adjust version if needed):
$env:PATH += ";$HOME\.local\share\solana\install\active_release\bin"

# Make permanent by adding to system environment variables
sh -c "$(curl -sSfL https://release.solana.com/v1.18.0/install)"

# Add to PATH (add to .bashrc/.zshrc):
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

Configure Solana CLI

# Generate a new keypair (for development only)
solana-keygen new --no-bip39-passphrase

# Set to devnet for development
solana config set --url devnet

# Verify configuration
solana config get

Expected Output

Config File: /home/user/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/
Keypair Path: /home/user/.config/solana/id.json
Commitment: confirmed

Get Devnet SOL

# Airdrop 2 SOL for testing (devnet only)
solana airdrop 2

# Check balance
solana balance

3. Anchor Framework

Anchor provides high-level abstractions for Solana program development.

Install Anchor Version Manager (AVM)

cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latest

# Verify
anchor --version

Expected Output

anchor-cli 0.30.0

4. Node.js and pnpm

Node.js is required for frontend development and Anchor testing.

# Using winget
winget install OpenJS.NodeJS.LTS

# Install pnpm
npm install -g pnpm

# Verify
node --version
pnpm --version
# Using Homebrew
brew install node
npm install -g pnpm

node --version
pnpm --version
# Using nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install --lts
npm install -g pnpm

node --version
pnpm --version

Expected Output

v20.x.x (LTS version)
8.x.x or newer

5. Python and Poetry

Python is used for FastAPI backend services.

# Using winget
winget install Python.Python.3.11

# Install Poetry
pip install poetry

# Verify
python --version
poetry --version
# Using pyenv (recommended)
curl https://pyenv.run | bash

# Add to shell config (.bashrc/.zshrc):
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"

# Install Python
pyenv install 3.11
pyenv global 3.11

# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -

python --version
poetry --version

Expected Output

Python 3.11.x
Poetry 1.7.x or newer

6. Docker

Docker is required for local development and Kubernetes deployment.

Download and install Docker Desktop for Windows

# After installation
docker --version
docker compose version

Download and install Docker Desktop for Mac

docker --version
docker compose version
# Install Docker Engine
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Add user to docker group
sudo usermod -aG docker $USER
newgrp docker

docker --version
docker compose version

7. Kubernetes Tools (Optional)

Required for Modules 12-13 (deployment).

kubectl

winget install Kubernetes.kubectl
kubectl version --client
brew install kubectl
kubectl version --client
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client

Minikube

winget install Kubernetes.minikube
minikube version
brew install minikube
minikube version
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube version

Helm

winget install Helm.Helm
helm version
brew install helm
helm version
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version

8. IDE Setup

VS Code Extensions

Install these extensions for the best development experience:

Extension ID Purpose
rust-analyzer rust-lang.rust-analyzer Rust language support
Anchor nickcuthbert.anchor Anchor syntax highlighting
Solana piotrminkowski.solana-suite Solana development tools
ESLint dbaeumer.vscode-eslint JavaScript/TypeScript linting
Prettier esbenp.prettier-vscode Code formatting
Python ms-python.python Python support
Docker ms-azuretools.vscode-docker Docker integration
# Install via command line
code --install-extension rust-lang.rust-analyzer
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension ms-python.python
code --install-extension ms-azuretools.vscode-docker

VS Code Settings

Add to your .vscode/settings.json:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer"
  },
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },
  "rust-analyzer.check.command": "clippy"
}

9. Environment Validation Script

Create and run this script to verify your entire setup:

#!/usr/bin/env python3
"""Validate Solana DApp development environment."""

import subprocess
import sys
import shutil
from dataclasses import dataclass

@dataclass
class Tool:
    name: str
    command: str
    min_version: str = ""
    required: bool = True

TOOLS = [
    Tool("Rust", "rustc --version", "1.70"),
    Tool("Cargo", "cargo --version", "1.70"),
    Tool("Solana CLI", "solana --version", "1.16"),
    Tool("Anchor", "anchor --version", "0.29"),
    Tool("Node.js", "node --version", "18"),
    Tool("pnpm", "pnpm --version", "8"),
    Tool("Python", "python --version", "3.10"),
    Tool("Poetry", "poetry --version", "1.5"),
    Tool("Docker", "docker --version", "24", required=False),
    Tool("kubectl", "kubectl version --client", "", required=False),
    Tool("minikube", "minikube version", "", required=False),
    Tool("Helm", "helm version --short", "3", required=False),
]

def check_tool(tool: Tool) -> tuple[bool, str]:
    """Check if a tool is installed and return version."""
    try:
        result = subprocess.run(
            tool.command.split(),
            capture_output=True,
            text=True,
            timeout=10
        )
        output = result.stdout.strip() or result.stderr.strip()
        return True, output.split('\n')[0]
    except (subprocess.SubprocessError, FileNotFoundError):
        return False, "Not installed"

def main():
    print("=" * 60)
    print("Solana DApp Development Environment Validator")
    print("=" * 60 + "\n")

    all_required_ok = True

    for tool in TOOLS:
        ok, version = check_tool(tool)
        status = "[OK]" if ok else ("[WARN]" if not tool.required else "[FAIL]")
        print(f"{status:8} {tool.name:15} {version}")

        if not ok and tool.required:
            all_required_ok = False

    print("\n" + "=" * 60)

    if all_required_ok:
        print("All required tools are installed!")
        print("You're ready to start the course.")
        sys.exit(0)
    else:
        print("Some required tools are missing.")
        print("Please install them before proceeding.")
        sys.exit(1)

if __name__ == "__main__":
    main()

Save as scripts/validate-env.py and run:

python scripts/validate-env.py

Expected Output

============================================================
Solana DApp Development Environment Validator
============================================================

[OK]     Rust            rustc 1.75.0
[OK]     Cargo           cargo 1.75.0
[OK]     Solana CLI      solana-cli 1.18.0
[OK]     Anchor          anchor-cli 0.30.0
[OK]     Node.js         v20.10.0
[OK]     pnpm            8.12.0
[OK]     Python          Python 3.11.6
[OK]     Poetry          Poetry 1.7.1
[OK]     Docker          Docker version 24.0.7
[WARN]   kubectl         Not installed
[WARN]   minikube        Not installed
[WARN]   Helm            Not installed

============================================================
All required tools are installed!
You're ready to start the course.

Troubleshooting

Common Issues

Rust not found after installation

Ensure you've sourced the Rust environment:

source $HOME/.cargo/env
Or restart your terminal.

Solana CLI installation fails on Windows

Try running PowerShell as Administrator, or use WSL2 for a Linux environment.

Anchor build fails with 'program not found'

Ensure Solana CLI is in your PATH and you've run:

solana config set --url localhost

Permission denied when running Docker

On Linux, add your user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

Next Steps

With your environment ready, proceed to:

Module 1: Blockchain Fundamentals


Need Help?

If you encounter issues not covered here, please open an issue on the GitHub repository.