How to install rust in Ubuntu 24.04

news/2024/11/23 22:31:15/

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 installerWelcome 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/.rustupThis can be modified with the RUSTUP_HOME environment variable.The Cargo home directory is located at:/home/lwk/.cargoThis 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/binThis path will then be added to your PATH environment variable by
modifying the profile files located at:/home/lwk/.profile/home/lwk/.bashrcYou 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-gnudefault toolchain: stable (default)profile: defaultmodify PATH variable: yes1) 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 managerUsage: 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 helpCommands:build, b    Compile the current packagecheck, c    Analyze the current package and report errors, but don't build object filesclean       Remove the target directorydoc, d      Build this package's and its dependencies' documentationnew         Create a new cargo packageinit        Create a new cargo package in an existing directoryadd         Add dependencies to a manifest fileremove      Remove dependencies from a manifest filerun, r      Run a binary or example of the local packagetest, t     Run the testsbench       Run the benchmarksupdate      Update dependencies listed in Cargo.locksearch      Search registry for cratespublish     Package and upload this package to the registryinstall     Install a Rust binaryuninstall   Uninstall a Rust binary...         See all commands with --listSee 'cargo help <command>' for more information on a specific command.
lwk@qwfys:~$

http://www.ppmy.cn/news/1548883.html

相关文章

python基础知识(七)——写入excel

一、写入excel 写入数据到excel wb load_workbook("testcase_api_wuye.xlsx") #打开一个已经存在的excel文件 sh wb["register"] #识别某一个表单 sh.cell(row 2,column 8).value "pass" #写入数据&#xff0c;单元格的值赋值 wb.sav…

Kotlin深度面试题:协程、密封类和高阶函数

文章目录 知识回顾前言源码分析1.面试题目1&#xff1a;Kotlin中的协程与线程的区别是什么&#xff1f;如何在Android中使用协程进行异步编程&#xff1f;2.面试题目2&#xff1a;Kotlin中的扩展函数和扩展属性是什么&#xff1f;如何在Android开发中使用它们&#xff1f;3. 面…

编译安装 openssl-3.0.14

编译和安装 OpenSSL 3.0.14 的步骤如下&#xff1a; 1. 下载 OpenSSL 源码 首先&#xff0c;从 OpenSSL 的官方网站下载所需版本的源代码。你可以使用 wget 或 curl 命令来下载&#xff1a; wget https://www.openssl.org/source/openssl-3.0.14.tar.gz或者 curl -O https:…

【国产MCU系列】-GD32F470-通用同步异步收发器(USART)

通用同步异步收发器(USART) 文章目录 通用同步异步收发器(USART)1、USART与UART介绍2、GD32F4的USART2.1 GD32F4的USART介绍与特性2.2 GD32F4的USART寄存器列表3、USART数据发送与接收与配置3.1 数据帧格式与配置3.2 波特率发生与配置3.3 UART发送器配置与步骤3.4 UART接收…

【大选】2024年美国总统选举数据分析可视化

前言 • &#x1f453; 可视化主要使用 Plotly • &#x1f50e; 数据处理主要使用 pandas • &#x1f449; 本文是我自己在和鲸社区的原创 1.项目背景描述 2024年美国大选是该国政治生活中的重要事件&#xff0c;吸引了全球的关注。本报告通过对选举数据的分析&#xff0c…

Web导出Excel表格

背景&#xff1a; 1. 后端主导实现 流程&#xff1a;前端调用到导出excel接口 -> 后端返回excel文件流 -> 浏览器会识别并自动下载 场景&#xff1a;大部分场景都有后端来做 2. 前端主导实现 流程&#xff1a;前端获取要导出的数据 -> 常规数据用插件处理成一个e…

实验室管理软件:Spring Boot技术构建

3系统分析 3.1可行性分析 通过对本实验室管理系统实行的目的初步调查和分析&#xff0c;提出可行性方案并对其一一进行论证。我们在这里主要从技术可行性、经济可行性、操作可行性等方面进行分析。 3.1.1技术可行性 本实验室管理系统采用SSM框架&#xff0c;JAVA作为开发语言&a…

【jvm】StringTable为什么要调整

目录 1. 永久代内存限制与回收效率2. 堆内存的优势3. JDK版本的演进4. 实际应用的考虑 1. 永久代内存限制与回收效率 1.内存限制&#xff1a;在JDK 6及之前的版本中&#xff0c;StringTable位于永久代&#xff08;PermGen space&#xff09;中。然而&#xff0c;永久代的内存空…