Rust 安装

curl 方式
bash 复制代码
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
bash 复制代码
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /root/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /root/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /root/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /root/.profile
  /root/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
712.1 KiB / 712.1 KiB (100 %) 247.7 KiB/s in  2s ETA:  0s
info: latest update on 2024-02-08, rust version 1.76.0 (07dca489a 2024-02-04)
info: downloading component 'cargo'
  8.5 MiB /   8.5 MiB (100 %)   1.0 MiB/s in 12s ETA:  0s
info: downloading component 'clippy'
  2.1 MiB /   2.1 MiB (100 %)   1.4 MiB/s in  2s ETA:  0s
info: downloading component 'rust-docs'
 14.7 MiB /  14.7 MiB (100 %)   1.5 MiB/s in 10s ETA:  0s
info: downloading component 'rust-std'
 23.9 MiB /  23.9 MiB (100 %)   1.6 MiB/s in 16s ETA:  0s
info: downloading component 'rustc'
 62.3 MiB /  62.3 MiB (100 %)   4.0 MiB/s in 27s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 14.7 MiB /  14.7 MiB (100 %) 854.4 KiB/s in 55s ETA:  0s
info: installing component 'rust-std'
 23.9 MiB /  23.9 MiB (100 %)   8.0 MiB/s in  7s ETA:  0s
info: installing component 'rustc'
 62.3 MiB /  62.3 MiB (100 %)   9.0 MiB/s in  7s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.76.0 (07dca489a 2024-02-04)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"

apt 方式
bash 复制代码
apt install rustc cargo
bash 复制代码
# apt install rustc cargo
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
建议安装:
  cargo-doc llvm-17 lld-17 clang-17
下列【新】软件包将被安装:
  cargo rustc
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 9,685 kB 的归档。
解压缩后会消耗 30.7 MB 的额外空间。
获取:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 rustc amd64 1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [3,341 kB]
获取:2 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 cargo amd64 1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04 [6,345 kB]
已下载 9,685 kB,耗时 50秒 (192 kB/s)                                                 
正在选中未选择的软件包 rustc。
(正在读取数据库 ... 系统当前共安装有 117222 个文件和目录。)
准备解压 .../rustc_1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb  ...
正在解压 rustc (1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
正在选中未选择的软件包 cargo。
准备解压 .../cargo_1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04_amd64.deb  ...
正在解压 cargo (1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
正在设置 rustc (1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
正在设置 cargo (1.73.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04) ...
正在处理用于 man-db (2.10.2-1) 的触发器 ...
相关推荐
秃头佛爷35 分钟前
Python学习大纲总结及注意事项
开发语言·python·学习
待磨的钝刨36 分钟前
【格式化查看JSON文件】coco的json文件内容都在一行如何按照json格式查看
开发语言·javascript·json
XiaoLeisj3 小时前
【JavaEE初阶 — 多线程】单例模式 & 指令重排序问题
java·开发语言·java-ee
paopaokaka_luck3 小时前
【360】基于springboot的志愿服务管理系统
java·spring boot·后端·spring·毕业设计
励志成为嵌入式工程师4 小时前
c语言简单编程练习9
c语言·开发语言·算法·vim
捕鲸叉4 小时前
创建线程时传递参数给线程
开发语言·c++·算法
A charmer4 小时前
【C++】vector 类深度解析:探索动态数组的奥秘
开发语言·c++·算法
码农小旋风4 小时前
详解K8S--声明式API
后端
Peter_chq4 小时前
【操作系统】基于环形队列的生产消费模型
linux·c语言·开发语言·c++·后端
Yaml45 小时前
Spring Boot 与 Vue 共筑二手书籍交易卓越平台
java·spring boot·后端·mysql·spring·vue·二手书籍