English
 找回密码
 立即注册

Solana entrance (6)

Anatoly 2025-11-24 15:12 18580人围观 SOL

If the birds don't sing, kill them.If the birds don't sing, let them sing.If the birds don't sing, wait until they sing. Basic CMD on Windows WSLwsl --install Anso process session ...

If you don't cry, kill me, Tokitori.

If it doesn't chirp, let's chirp.

If the bird doesn't sing, wait until it does.

5. Installation of Solana development environment based on WSL (Windows Subsystem for Linux)

5. 1 Install WSL on Windows based on CMD

wsl --install
  • During the installation process, you will be asked to specify a username and password.
### 查询Ubuntu版本
### 查询结果为22.04
### 这个版本无法兼容Anchor框架,会导致后续anchor --version 执行失败
lsb_release -a



lsb_release -a execution result, Ubuntu version is 22.04





WSL installation successful and process interface

5.2 Install dependencies


install Pack
### 安装Rust及其编译、包管理工具
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  • rustc is a compilation tool for Rust source files (.rs)
  • In actual development, rustc is generally not called directly, but with the help of Rust’s official package management tool Cargo.



Rust installation success interface
### 重新加载PATH环境变量,包含Cargo的bin目录
. "$HOME/.cargo/env"
### 查询Rust版本判断是否安装成功
rustc --version



Rust version information

install Pack

[Note: This part of the installation is most likely to encounter network connection problems]
### 配置代理,代理地址为172.29.0.1,即主机的IP地址
export http_proxy="http://172.29.0.1:7890"
export https_proxy="http://172.29.0.1:7890"
export all_proxy="socks5://127.0.0.1:7891"





Configure network proxy
  • How to get the Host IP address
### Host IP就是WSL对应的网关,WSL中执行:
1. grep nameserver /etc/resolv.conf
2. ip route | grep default



Query Host IP
  • To ensure that the agent is functioning, it is also necessary
    • Open proxy software, such as Clash-Verge's allow LAN connection (allow_LAN) option
    • Turn off the Host firewall and ensure that the Host can receive WSL network requests.
### 在Host的Powershell中执行如下命令关闭防火墙
netsh advfirewall set allprofiles state off



Allow LAN access
### WSL中,利用curl -v命令测试代理是否生效
curl -v -x http://172.29.0.1:7890 http://google.com



The above result indicates that the proxy configuration is successful.
### 安装Solana CLI
1. sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
### 添加并更新PATH环境变量
2. export PATH="/Users/test/.local/share/solana/install/active_release/bin:$PATH"
3. echo 'export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"' >> ~/.bashrc
4. source ~/.bashrc
### 检查Solana CLI版本
5. solana --version



Solana-CLI installed successfully

install Pack
### 安装Node、npm、yarn
1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
### 如果代理配置失败,则上述命令将出现网络连接错误;可以拆分为两条命令:
2. curl -x http://172.29.0.1:7890 -o install.sh https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh
3. bash install.sh
  • Git is not friendly to the Socks proxy protocol, so choose http proxy
### 重启WSL终端,确认nvm命令运行成功
1. command -v nvm
### 安装node并检查版本
2. nvm install node
3. node --version
### 利用npm安装yarn并检查版本
4. npm install --global yarn
5. yarn --version
  • After restarting the WSL terminal, you need to reconfigure the proxy
  • Just install one with npm and yarn









nvm, Node, npm, yarn installed successfully
### 首先安装AVM,即Anchor Version Managment
1. cargo install --git https://github.com/solana-foundation/anchor avm --force
### 检查AVM是否安装成功
2. avm --version
  • Due to Ubuntu version issues, the avm --version command failed to execute.
  • The reason for failure is that the GLIBC version is incompatible
    • The GLIBC version of compiled AVM (2.39) is higher than the GLIBC version built in Ubuntu 22.04 (2.35)
### 查询WSL内置的GLIBC版本
ldd --version



View WSL built-in GLIBC version
### 解决方法就是将WSL系统版本更新至24.04
1. sudo apt update && sudo apt full-upgrade -y
2. sudo do-release-upgrade -d
  • [sudo do-release-upgrade -d] will fail to execute because WSL does not allow updates.
  • Modify the Prompt keyword in the WSL configuration file from never to lts
### 用nano编辑器打开WSL系统配置文件
sudo nano /etc/update-manager/release-upgrades



Use nano to view and modify WSL system configuration
### 执行WSL系统更新
1. sudo apt update && sudo apt full-upgrade -y
2. sudo do-release-upgrade





Updated system and its built-in GLIBC version
### 选择AVM版本
1. avm install latest
2. avm use latest
### 重新查看AVM版本
3. anchor --version



AVM installed successfully
### 安装surfpool
1. curl -sL https://run.surfpool.run/ | bash
### 检查版本
2. surfpool --version



surfpool installed successfully


精彩评论0
我有话说......
TA还没有介绍自己。