如何在 Linux 中安装 Rust 编程语言 | Linux 中国
2018-12-29 12:12
1676 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/F8qG7f9YD02Pe/article/details/85346713
Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。-- Prakash Subramanian
https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/
作者 | Prakash Subramanian
译者 | geekpi 💎💎💎共计翻译:869.5 篇 贡献时间:1891 天
https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/
作者 | Prakash Subramanian
译者 | geekpi 💎💎💎共计翻译:869.5 篇 贡献时间:1891 天
Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。它旨在实现安全性、速度和并发性等目标。Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。如何在 Linux 中安装 Rust 语言?我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。
- [p]
$ curl https://sh.rustup.rs -sSf | 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/daygeek/.cargo/bin
This path will then be added to your PATH environment variable by modifying the
profile files located at:
/home/daygeek/.profile
/home/daygeek/.bash_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
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04)
info: downloading component 'rustc'
77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
info: downloading component 'rust-std'
54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s
info: downloading component 'cargo'
4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
info: downloading component 'rust-docs'
8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable'
stable installed - rustc 1.31.0 (abe02cefd 2018-12-04)
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
$ source $HOME/.cargo/env
$ rustc --version
rustc 1.31.0 (abe02cefd 2018-12-04)
$ mkdir ~/projects
$ cd ~/projects
$ mkdir hello_world
$ cd hello_world
$ vi 2g.rs
fn main() {
println!("Hello, It's 2DayGeek.com - Best Linux Practical Blog!");
}
$ rustc 2g.rs
$ ls -lh
total 3.9M
-rwxr-xr-x 1 daygeek daygeek 3.9M Dec 14 11:09 2g
-rw-r--r-- 1 daygeek daygeek 86 Dec 14 11:09 2g.rs
$ ./2g
Hello, It's 2DayGeek.com - Best Linux Practical Blog!
$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: checking for self-updates
stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)
$ rustup self uninstall
$ rm -fr ~/projects
相关文章推荐
- 如何在 Linux 中安装 Rust 编程语言
- 如何使用多种编程语言而又不失理智 | Linux 中国
- 如何在 Ubuntu 16.04 上安装和使用 Encryptpad | Linux 中国
- 如何使用 GNU Stow 来管理从源代码安装的程序和点文件 | Linux 中国
- 如何安装并设置 Vagrant | Linux 中国
- 详解如何用源代码安装软件,以及如何卸载它 | Linux 中国
- 如何在 Ubuntu 安装 Go 语言编写的 Git 服务器 Gogs | Linux 中国
- 如何在 Linux 上安装/更新 Intel 微码固件 | Linux 中国
- 如何在 CentOS 7 / RHEL 7 终端服务器上安装 KVM | Linux 中国
- 如何在 Anbox 上安装 Google Play 商店及启用 ARM 支持 | Linux 中国
- 如何在 Linux 上安装应用程序 | Linux 中国
- 如何从硬盘安装linux[中国linux公社]
- 一步步教你如何安装 Arch Linux | Linux 中国
- 如何在 Linux 上使用 snap 安装 Spotify(声破天) | Linux 中国
- Linux 中如何卸载已安装的软件
- 新手看招 如何制作Linux系统的安装光盘?
- linux 下如何安装卸载 .tar.gz 格式的文件
- 安装完samba如何从linux访问WINDOWS共享文件夹
- 如何在安装Linux之后自己修改Swap分区大小
- 如何在SBC-2410X上安装嵌入式Linux