RealACJoshua
Posted on November 26, 2024
Hello and welcome! In this guide, we'll explore how to set up a development environment for Solana. Whether you're diving into blockchain for the first time or transitioning from another platform, this guide will help you get started. Let's go!
Step 1: Setting Up WSL
To get started, we’ll use Windows Subsystem for Linux (WSL). WSL lets you run Linux commands directly on your Windows machine, which is essential for Solana development.
Install WSL:
- Open PowerShell and run:
wsl --install
- If WSL is already installed, update it:
wsl --update
- Install Ubuntu (or any Linux distribution you prefer):
wsl --install -d Ubuntu
- Reboot your computer and open Ubuntu:
wsl ubuntu
- Set up your Ubuntu environment by creating a username and password.
Step 2: Installing Rust
Rust is the primary language for Solana development. Let's install it:
- Run the following commands:
sudo apt update
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- Reload the PATH environment variable:
. "$HOME/.cargo/env"
- Verify the installation:
rustc --version
You should see something like rustc 1.80.1.
Step 3: Installing the Solana CLI
The Solana CLI is essential for building and deploying Solana programs.
- Install the Solana CLI tool suite:
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
- Add the PATH environment variable:
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
- Verify the installation:
solana --version
Example output: solana-cli 1.18.22.
Step 4: Installing Anchor CLI
Anchor simplifies Solana program development.
- Install required dependencies:
sudo apt-get install -y build-essential pkg-config libudev-dev llvm libclang-dev protobuf-compiler libssl-dev
- Install the Anchor Version Manager (AVM):
cargo install --git https://github.com/coral-xyz/anchor avm --force
- Use AVM to install the latest Anchor CLI:
avm install latest
avm use latest
- Verify the installation:
anchor --version
Example output: anchor-cli 0.30.1.
Step 5: Installing Node.js and Yarn
Node.js and Yarn are required for running default Anchor project tests.
- Install Node Version Manager (nvm):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
- Restart your terminal and confirm the installation:
command -v nvm
- Install Node.js:
nvm install node
Verify the installation:
node --version
- Install Yarn:
npm install --global yarn
Verify the installation:
yarn --version
Conclusion
Congratulations! You’ve successfully set up your Solana development environment. If you’re using Linux, skip Step 1. Ready to dive deeper into Solana? Subscribe and check out my upcoming posts for project ideas and advanced tips.
Posted on November 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.