Installation

Step-by-step guide to install Anchor framework and set up your development environment

This guide will walk you through installing all the necessary tools to start building Solana programs. We'll install Rust, Solana CLI, and the Anchor framework.

Prerequisites

Before starting, make sure you have:

  • A Unix-based operating system (Linux, macOS, or WSL2 on Windows)
  • Basic knowledge of command line
  • At least 10GB of free disk space

Step 1: Install Rust

Rust is the primary programming language for Solana development. Install it using rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

After installation, configure your current shell:

source $HOME/.cargo/env

Verify the installation:

rustc --version

Step 2: Install Solana CLI

The Solana CLI provides the tools you need to interact with the Solana blockchain:

sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

Add Solana to your PATH (add this to your ~/.bashrc or ~/.zshrc):

export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"

Verify the installation:

solana --version

Step 3: Configure Solana CLI

Set the Solana CLI to use devnet (for development and testing):

solana config set --url devnet

Create a new keypair:

solana-keygen new

Check your wallet address:

solana address

Airdrop some SOL for testing (devnet only):

solana airdrop 2

Step 4: Install Anchor Framework

Anchor is the most popular framework for Solana development. It simplifies the development process significantly.

Prerequisites for Anchor:

Install required dependencies:

# Ubuntu/Debian
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev

# macOS
brew install pkg-config openssl@1.1

Install Anchor using avm (Anchor Version Manager):

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

Install the latest version of Anchor:

avm install latest
avm use latest

Verify Anchor installation:

anchor --version

Step 5: Install Node.js and Yarn

Node.js is required for front-end development and testing:

# Install Node.js (v18 or higher recommended)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

# Install Yarn
npm install -g yarn

Troubleshooting

Common Issues:

  • Permission denied errors: Try using sudo or check your PATH configuration
  • Anchor build fails: Make sure all dependencies are installed correctly
  • Solana CLI not found: Restart your terminal or source your shell configuration
  • Airdrop fails: Devnet might be congested, try again after a few minutes

Next Steps

Now that you have everything installed, you're ready to start building! Check out the Quickstart Guide to create your first Solana program.

🚀

Quickstart

Build your first Solana program with Anchor in minutes.

Get started →
📖

Documentation

Explore comprehensive documentation and guides.

Read docs →