如何在 AlmaLinux 8 上安装 Rust
admin
2023-07-31 09:48:51
0

Rust 通常被称为 rust-lang。它是由 Mozilla Research 赞助的通用、多范式、现代、跨平台和开源系统编程语言。Rust 编程语言还有许多其他很酷的特性,包括设备驱动程序、操作系统的低级编码,并且简单化使其易于使用和高效。Rust-programming-languageRust-programming-language

在 AlmaLinux 8 上安装 Rust

步骤 1. 首先,让我们先确保您的系统是最新的。

sudo dnf update
sudo dnf install epel-release
sudo dnf install cmake gcc make

步骤 2. 在 AlmaLinux 8 上安装 Rust。

现在我们使用以下命令下载并安装 Rust:

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.

It will add the cargo, rustc, rustup and other commands to
Cargo\'s bin directory, located at:

  /home/idroot/.cargo/bin

This can be modified with the CARGO_HOME environment variable.

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

  /home/idroot/.rustup

This can be modified with the RUSTUP_HOME environment variable.

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

  /home/idroot/.profile

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
               profile: default
  modify PATH variable: yes

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

安装程序完成后,会向用户提供附加信息:

Rust is installed now. Great!
To get started you need Cargo\'s bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done
automatically.

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

最后,运行以下命令来配置您当前的 shell:

source ~/.profile
source ~/.cargo/env

通过运行以下命令来验证系统上安装的 Rust 版本:

rustc -V

步骤 3. 创建 Rust 示例项目。

让我们使用“Hello, World!”来测试 Rust。应用。首先,使用以下命令创建一个新目录来存放我们的测试:

mkdir ~/rust-projects
cd rust-projects
nano helloworld.rs

添加以下行:

fn main() {
println!(\"Hello World, this is a test provided by idroot.us\");
}

然后,运行以下命令,这将创建一个helloworld在当前目录中调用的可执行文件:

rustc helloworld.rs

接下来,使用 execute 命令运行程序:

./helloworld

感谢您使用本教程在您的 AlmaLinux 8 系统上安装 Rust 编程语言。如需更多帮助或有用信息,我们建议您查看Rust 官方网站。

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
在 Windows 11 中打... 什么是链路状态电源管理? 您可以在系统控制面板的电源选项中看到链接状态电源管理。它是 PCI Exp...
iPhone 屏幕上有亮绿色斑... iPhone 是市场上最稳定的智能手机之一,这主要归功于专为它们设计的 iOS 操作系统。然而,他们...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
QQ浏览器怎么制作简历 QQ浏览器是腾讯公司开发的一款极速浏览器,支持电脑,安卓,苹果等多种终端;更快的浏览体验,更安全的浏...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
Apple Watch Ult... 所有运行 watchOS 7 或更高版本的 Apple Watch 型号都包含一项名为“优化电池充电...
统信UOS每次开机后不直接进入... 统信UOS每次开机后不直接进入系统而是进入到recovery模式 按方向上键选择UOS 20 SP1...