发布于2026-07-13 阅读(0)
扫一扫,手机访问

在Debian上部署Rust开发环境,其实没有想象中那么复杂。关键路径有两条:一条是用官方推荐的rustup,灵活可控,适合日常折腾;另一条是走系统仓库的apt安装,省心但版本偏老。下面咱们就逐个拆解。
sudo apt install rustc cargo就完事,版本虽然旧一点,但跑通基础项目绰绰有余,适合不想折腾的场合。sudo apt update && sudo apt install -y curl build-essential gcc make,把编译器和依赖工具备齐。curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh。装完后记得加载环境:source "$HOME/.cargo/env"。rustc --version和cargo --version,能看到版本号就说明成了。rustup default stable;再装上常用组件:rustup component add rustfmt clippy rust-src。cargo new hello && cd hello,然后cargo run跑起来,或者cargo build编译。看到“Hello, world!”就算开局成功。sudo apt update && sudo apt install -y rustc cargo。rustc --version 和 cargo --version。export PATH="$HOME/.cargo/bin:$PATH"。rustup updaterustup default stable|beta|nightlyrustup target add armv7-unknown-linux-gnueabihfcargo build --target armv7-unknown-linux-gnueabihf 构建。cargo install cargo-debcargo deb,生成的 .deb 在 target/debian/ 下。用 sudo dpkg -i target/debian/*.deb 安装即可。source "$HOME/.cargo/env",或者检查 ~/.bashrc / ~/.zshrc 里是否包含 $HOME/.cargo/bin 在 PATH 中。build-essential 等基础开发包,问题多半能解决。
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
8