当前位置: 首页 > article >正文

How to install rust in Ubuntu 24.04

How to install rust in Ubuntu 24.04

  • Install

Install

可以采用如下命令安装rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

具体如下:

lwk@qwfys:~$ 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/lwk/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/lwk/.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/lwk/.cargo/bin

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

  /home/lwk/.profile
  /home/lwk/.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 standard installation (default - just press enter)
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'
818.4 KiB / 818.4 KiB (100 %) 253.5 KiB/s in  3s ETA:  0s
info: latest update on 2024-10-17, rust version 1.82.0 (f6e511eec 2024-10-15)
info: downloading component 'cargo'
  8.5 MiB /   8.5 MiB (100 %)   1.3 MiB/s in  8s ETA:  0s
info: downloading component 'clippy'
  2.7 MiB /   2.7 MiB (100 %)   2.6 MiB/s in  1s ETA:  0s
info: downloading component 'rust-docs'
 16.3 MiB /  16.3 MiB (100 %)   1.7 MiB/s in  8s ETA:  0s
info: downloading component 'rust-std'
 26.0 MiB /  26.0 MiB (100 %)   1.8 MiB/s in 25s ETA:  0s 
info: downloading component 'rustc'
 70.8 MiB /  70.8 MiB (100 %)   2.3 MiB/s in 36s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 16.3 MiB /  16.3 MiB (100 %)   7.9 MiB/s in  1s ETA:  0s
info: installing component 'rust-std'
 26.0 MiB /  26.0 MiB (100 %)  12.8 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 70.8 MiB /  70.8 MiB (100 %)  14.3 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.82.0 (f6e511eec 2024-10-15)


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, you need to source
the corresponding env file under $HOME/.cargo.

This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env"            # For sh/bash/zsh/ash/dash/pdksh
source "$HOME/.cargo/env.fish"  # For fish
lwk@qwfys:~$

在当前终端中激活env环境

source "$HOME/.cargo/env"

这个时候就可以正常使用rust相关命令了。

lwk@qwfys:~$ cargo --help
Rust's package manager

Usage: cargo [+toolchain] [OPTIONS] [COMMAND]
       cargo [+toolchain] [OPTIONS] -Zscript <MANIFEST_RS> [ARGS]...

Options:
  -V, --version             Print version info and exit
      --list                List installed commands
      --explain <CODE>      Provide a detailed explanation of a rustc error message
  -v, --verbose...          Use verbose output (-vv very verbose/build.rs output)
  -q, --quiet               Do not print cargo log messages
      --color <WHEN>        Coloring: auto, always, never
  -C <DIRECTORY>            Change to DIRECTORY before doing anything (nightly-only)
      --locked              Assert that `Cargo.lock` will remain unchanged
      --offline             Run without accessing the network
      --frozen              Equivalent to specifying both --locked and --offline
      --config <KEY=VALUE>  Override a configuration value
  -Z <FLAG>                 Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
  -h, --help                Print help

Commands:
    build, b    Compile the current package
    check, c    Analyze the current package and report errors, but don't build object files
    clean       Remove the target directory
    doc, d      Build this package's and its dependencies' documentation
    new         Create a new cargo package
    init        Create a new cargo package in an existing directory
    add         Add dependencies to a manifest file
    remove      Remove dependencies from a manifest file
    run, r      Run a binary or example of the local package
    test, t     Run the tests
    bench       Run the benchmarks
    update      Update dependencies listed in Cargo.lock
    search      Search registry for crates
    publish     Package and upload this package to the registry
    install     Install a Rust binary
    uninstall   Uninstall a Rust binary
    ...         See all commands with --list

See 'cargo help <command>' for more information on a specific command.
lwk@qwfys:~$

http://www.kler.cn/a/402134.html

相关文章:

  • 创新租赁APP开发提升用户体验与业务效率
  • 微众银行申请专利:不过分丢失泛用能力,提高语音大模型对困难样本学习效率
  • C#桌面应用制作计算器
  • #define定义宏(3)
  • 优化 MFC CGridCtrl 的表格布局与功能
  • 笔记02----重新思考轻量化视觉Transformer中的局部感知CloFormer(即插即用)
  • NAT网络地址转换——Easy IP
  • git操作总结
  • 在Unity中实现电梯升降功能的完整指南
  • 关于selenium元素找不到的问题(Unable to locate element: {“method“:“xpath“,“selector“:“)
  • 使用GDB或Delve对已经运行起来的Go程序进行远程调试
  • 11.13机器学习_KNN和模型选择调优
  • 基于docker搭建mysql主从架构
  • 网络安全协议
  • git在创建分支时如何将默认分支名字设为master
  • Python 使用Django进行单元测试unittest
  • 活着就好20241120
  • I.MX6U 裸机开发12.主频修改和PLL配置
  • 用PHP实现一个简单的http服务器
  • 学习记录:js算法(九十八):课程表 II
  • 【Python数据可视化分析实战】数据爬取—京东手机品牌信息数据爬取和数据分析与可视化
  • 等保二级需要哪些安全设备?
  • openfoam中通过precice耦合的流固耦合案例如何单独运行流体这样可以防止报错float exception
  • 如何利用virtualenv和python命令创建Python虚拟环境
  • AI赋能电商:开启智慧零售新纪元
  • 高阶数据结构——图