在Debian上配置Rust开发工具可按以下步骤操作:
安装依赖包
sudo apt update  
sudo apt install curl build-essential gcc make -y  
安装Rustup(官方工具链管理工具)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh  
按提示完成安装,安装过程中会自动配置环境变量。
验证安装
rustc --version  # 查看Rust编译器版本  
cargo --version  # 查看Cargo版本  
若显示版本号,则安装成功。
配置环境变量(可选)
若安装时未自动配置,可手动添加:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' | sudo tee -a /etc/profile.d/rust.sh  
source /etc/profile  
(可选)配置镜像加速
编辑~/.cargo/config.toml,添加国内镜像源(如清华源):
[source.crates-io]  
replace-with = "tuna"  
[source.tuna]  
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"  
创建并运行Rust项目
cargo new hello_world  # 创建新项目  
cd hello_world  
cargo build  # 编译项目  
cargo run    # 运行项目  
安装额外工具(可选)
如需代码格式化、静态检查等,可安装组件:
rustup component add rustfmt clippy  
配置IDE(可选)
以上步骤参考自,可根据需求选择安装方式。