阅读量:2
在Debian上配置Rust环境步骤如下:
-
更新系统并安装依赖包
sudo apt update sudo apt install curl build-essential gcc make -y -
使用rustup安装Rust
wget -qO - https://sh.rustup.rs | sudo bash -s -- --no-modify-path -y(安装到
/opt/rust目录,避免修改系统路径) -
配置环境变量
echo 'export RUSTUP_HOME=/opt/rust' | sudo tee -a /etc/profile.d/rust.sh echo 'export PATH=$PATH:/opt/rust/bin' | sudo tee -a /etc/profile.d/rust.sh source /etc/profile验证:
echo $RUSTUP_HOME和echo $PATH确认路径正确。 -
验证安装
rustc --version # 查看Rust编译器版本 cargo --version # 查看包管理器版本 -
(可选)配置工具链补全
rustup completions bash > /usr/share/bash-completion/completions/rustup source /etc/profile.d/bash_completion.sh -
(可选)配置国内镜像加速
编辑~/.cargo/config.toml,添加:[source.crates-io] replace-with = "tuna" [source.tuna] registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
完成以上步骤后,即可使用cargo创建、构建Rust项目。如需打包为Debian包,可安装cargo-deb工具:cargo install cargo-deb。
以上就是关于“Rust在Debian上如何配置环境”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm