Skip to content

Instantly share code, notes, and snippets.

@emersonliuuu
Last active September 5, 2024 08:07
Show Gist options
  • Save emersonliuuu/81f1ce90bbaeef8bdb22b6e65f56b3b7 to your computer and use it in GitHub Desktop.
Save emersonliuuu/81f1ce90bbaeef8bdb22b6e65f56b3b7 to your computer and use it in GitHub Desktop.
Solana Anchor Installation Guide (0.30.1)

Solana Anchor Installation Guide

Version Overview

$ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
$ solana --version
solana-cli 1.18.17 (src:b685182a; feat:4215500110, client:SolanaLabs)
$ yarn --version
1.22.19
$ anchor --version
anchor-cli 0.30.1
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ sh -c "$(curl -sSfL https://release.solana.com/v1.18.17/install)"
# Generate a new keypair for later testing purpose
$ solana-keygen new
# Airdrop 5 Devnet SOL to your wallet
$ solana airdrop 5 -ud

If you don’t have node installed yet, install nvm here: Link. And run nvm install --lts after installation.

# Node.js >=16.10
# Corepack is included by default with all Node.js installs, but is currently opt-in.
$ corepack enable

# Node.js <16.10
# npm i -g corepack
# Install avm (Anchor Version Manager), similar to npm
$ cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

# Linux user only
$ sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev

# Use avm to install version 0.30.1 of anchor
$ avm install 0.30.1
$ avm use 0.30.1

# Check the anchor cli version
$ anchor --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment