Step-by-Step Solana Setup on Windows Using WSL

This guide walks you through installing and configuring a Solana development environment on Windows using Windows Subsystem for Linux (WSL). It covers setting up WSL, installing Rust and Cargo, Solana CLI, Node.js, Yarn, and VS Code, and configuring the Anchor framework for Solana programming.


This content originally appeared on HackerNoon and was authored by hackernoon

Anchor the framework for Solana development, currently lacks support for Windows systems. Hence, a Linux environment is required for compatibility with Solana tools and technologies.

\ This article will guide you through installing Windows Subsystem for Linux (WSL) and other necessary dependencies and technologies, such as Rust, Solana CLI, Node.js, and Yarn, required for Solana development on your Windows system.

\

Prerequisites

Windows 10+ \n Good Internet connection \n Solana enthusiast

\

Installations

You will install Windows Subsystem for Linus (WSL), Rust and Cargo, Solana CLI, Node.js, Yarn, and Vs code.

1) Install Windows Subsystem for Linus (WSL)

WSL will allow you to run a Linux environment directly on your Windows system.

Open your Powershell in administrator mode and run this command.

wsl --install

\ The default wsl distribution, ubuntu, will be installed.

Once installation is complete, restart your machine.

Confirm your WSL version and distribution.

wsl -l -v

\ You should see this:

\ Set up your Linux distribution username and password

  1. Go to the search menu on your computer, type Ubuntu, then open it.
  2. You’ll be required to create a username and password. Follow the instructions to do so.

Be sure to save your password somewhere else.

\

:::info If you run into installation errors or want to install another distribution other than Ubuntu, check WSL's complete installation guide

:::

\


2) Install Rust and Cargo

Rust is the language for writing Solana programs.

Cargo is a Rust package manager for managing dependencies, building, testing, and deploying Rust codes.

\ To install Rust and Cargo, run this command on your Ubuntu

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

\ Then, Press 1 or enter to complete the installation

Once installation is complete, confirm your Rust and Cargo version with the following commands

rustc --version

cargo --version

\


3) Install Solana Cl

To install Solana, run this command on your Ubuntu

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

\ After the installation is complete, confirm the Solana version using this command

solana --version

\ \ Create your Solana wallet and generate your keypairs.

Create a default Solana wallet, generate your keypairs, and request free devnet tokens for your wallet.

To create your Solana wallet use this command

solana-keygen new

\ create a passphrase

\ Ensure to save your public key(a.k.a wallet address) and passphrase(highlighted below in yellow) in a secure location. \n Your private key is stored locally on your PC.

\ Request for devnets to deploy your Solana programs.

To get 10 Solana devnet tokens for your wallet, run this command

Solana airdrop 10

This will send devnet to the default wallet you just created. \n To send to a different wallet, useSolana airdrop 10 <wallet address>

\


4) Install node.js

If you’ve previously installed Node.js on your Windows, you should consider installing Node.js again specifically within your WSL to ensure compatibility.

\ To Install Node.js using Node Version Manager (NVM)

\ Run this nvm command on your Ubuntu

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

confirm NVM installation

command -v nvm 

you should see this

Otherwise, close and reopen your Ubuntu and rerun the command.

\ Install the stable LTS version of Node Js with this command

nvm install - lts

Confirm the installations of Node.js and npm versions

node --version
npm --version

\


5) Install yarn

yarn official documentation highlighted corepackas one of the two preferred methods of installing Yarn. \n npm yarn global installation is not recommended.

\ To install yarn, enable core pack and initialize a yarn project using the following commands

npm install -g corepack
corepack enable
yarn init

6) Install VS Code

Download VScode directly from the official website

To enable support for the WSL environment in your VSCode, install the WSL extension.

To do so, open VScode, click on the marketplace or “Ctrl + shift + x “, then search for and install the Remote — WSL Extension.

Additionally, install the ‘rust-analyzer’ extension for Rust language support.

\


7) Install Anchor

Anchor is the Solana framework for writing secure Solana programs.

\ Install Anchor using Anchor Version Manager (AVM) with this command

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

\ Install the latest Anchor version and set it as the default, using the following commands:

avm install latest
avm use latest

\ Confirm Anchor installation

Anchor –version

If you encounter any installation error check Anchor's official docs

\


Congratulations 🥳 you are all set to develop on Solana Blockchain \n \n


This content originally appeared on HackerNoon and was authored by hackernoon


Print Share Comment Cite Upload Translate Updates
APA

hackernoon | Sciencx (2024-08-14T12:55:52+00:00) Step-by-Step Solana Setup on Windows Using WSL. Retrieved from https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/

MLA
" » Step-by-Step Solana Setup on Windows Using WSL." hackernoon | Sciencx - Wednesday August 14, 2024, https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/
HARVARD
hackernoon | Sciencx Wednesday August 14, 2024 » Step-by-Step Solana Setup on Windows Using WSL., viewed ,<https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/>
VANCOUVER
hackernoon | Sciencx - » Step-by-Step Solana Setup on Windows Using WSL. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/
CHICAGO
" » Step-by-Step Solana Setup on Windows Using WSL." hackernoon | Sciencx - Accessed . https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/
IEEE
" » Step-by-Step Solana Setup on Windows Using WSL." hackernoon | Sciencx [Online]. Available: https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/. [Accessed: ]
rf:citation
» Step-by-Step Solana Setup on Windows Using WSL | hackernoon | Sciencx | https://www.scien.cx/2024/08/14/step-by-step-solana-setup-on-windows-using-wsl/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.