win11 本地 Solana & Anchor开发环境搭建(1)基础安装

solana官方安装文档链接:https://solana.com/zh/docs/intro/installation/dependencies (支持中文,没那么完善) anchor官方安装文档链接:https://www.anchor-lang.com/docs/installation#fish (相对完善,英文)

整体要求:魔法,需要基本的linux shell操作,vs code,前端环境安装。 主要流程:

  1. rust安装
  2. Solana CLI安装
  3. Anchor CLI安装
  4. 测试环境安装node ,yarn
  5. windows前置需要wsl,Windows PowerShell 中运行wsl --install,会默认安装 ubuntu。后续都在ubuntu中执行安装,然后vscode 通过wsl 连接ubuntu系统进行开发。

开始中直接搜索ubuntu,打开ubuntu,ubuntu不支持复制粘贴问题:打开一下 terminal(cmd),然后重先进入ubnutu窗口就可以了

执行官方提供的一键脚本:

curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bash

如果失败就一步一步来,先安装rust,再安装 solana CLI,再安装Aanchor CLI。注意安装时用户需要选择shell默认登录的用户,不要用root执行,环境依赖会安装到用户目录下面,请保持所有命令执行用户一致

rust安装

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

Solana CLI

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

Anchor CLI安装

有一个anchor AVM 管理器,类似node 的nvm管理器。 安装管理器

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

安装最新版本Anchor CLI

avm install latest
avm use latest

测试环境node yarn

这块Anchor默认采用ts进行测试,当然也支持rust进行测试。 node基于nvm安装 。

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

下一篇文章会介绍如何运行第一个程序

  • 原创
  • 学分: 3
  • 分类: Solana
  • 标签:
点赞 0
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论
asdtiang
asdtiang
0x9163...b293
江湖只有他的大名,没有他的介绍。