开始学习Rust的首步便是安装Rust环境,打开命令行终端并且输入命令:

curl https://sh.rustup.rs -sSf | sh

由于一些众所周知的🛜网络原因,执行后出现了以下情况,下载进度一点也没有🥲

root@VM-24:~# curl https://sh.rustup.rs -sSf | sh
info: downloading installer

这里采用的是清华大学的镜像加速,以提升下载速度

export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup
export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup

然后再次执行安装命令,将能够看到如下所示的输出:

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
...... 此处省略几行字

Rust is installed now. Great!

至此,大功告成✌️。上述安装过程会自动将Rust工具链添加到环境变量PATH中,此更改将在下一次登录终端时生效。如果你希望立即开始使用Rust,而无需重新启动终端,你可以在终端中执行以下命令,使配置立即生效:

source $HOME/.cargo/env

文章作者: 陆壹
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 陆壹笔记
Rust Rust
喜欢就支持一下吧