Rust学习笔记000 安装

安装命令

  • curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ 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:

  /home/ubuntu/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/ubuntu/.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:

  /home/ubuntu/.cargo/bin

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

  /home/ubuntu/.profile
  /home/ubuntu/.bash_profile
  /home/ubuntu/.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
>
$ curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path 
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:

  /home/ubuntu/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/ubuntu/.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:

  /home/ubuntu/.cargo/bin

This path needs to be in your PATH environment variable,
but will not be added automatically.

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: no

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

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'
info: latest update on 2023-12-28, rust version 1.75.0 (82e1608df 2023-12-21)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 61.4 MiB /  61.4 MiB (100 %)  41.1 MiB/s in  2s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 14.3 MiB /  14.3 MiB (100 %)   5.7 MiB/s in  2s ETA:  0s
info: installing component 'rust-std'
 23.6 MiB /  23.6 MiB (100 %)  10.4 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 61.4 MiB /  61.4 MiB (100 %)  11.5 MiB/s in  5s 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.75.0 (82e1608df 2023-12-21)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. This has not been done automatically.

To configure your current shell, run:
source "$HOME/.cargo/env"
  • 将 Rust 工具链目录添加到 PATH 环境变量中:
source "$HOME/.cargo/env"
  • 测试
$ rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)
$ vim test.rs
$ rustc test.rs 
$ ./test 
test

在这里插入图片描述

错误处理

curl: (1) Protocol “https” not supported or disabled in libcurl

相关推荐

  1. Rust学习笔记】ToString

    2023-12-31 23:52:04       47 阅读
  2. Rust学习笔记(下)

    2023-12-31 23:52:04       13 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-31 23:52:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-31 23:52:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-31 23:52:04       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-31 23:52:04       20 阅读

热门阅读

  1. 致最后【个人】

    2023-12-31 23:52:04       34 阅读
  2. Python面向对象-类与对象

    2023-12-31 23:52:04       39 阅读