Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。

它旨在实现安全性、速度和并发性等目标。

Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。

Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。

如何在 Linux 中安装 Rust 语言?

我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。

$ 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/linuxidc/.cargo/bin

This path will then be added to your PATH environment variable by modifying the

profile files located at:

/home/linuxidc/.profile

/home/linuxidc/.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.Nexttime you log inthis will be done automatically.

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

运行以下命令配置当前 shell。

$ source $HOME/.cargo/env

运行以下命令验证已安装的 Rust 版本。

$ rustc --version

rustc 1.31.0(abe02cefd 2018-12-04)

如何测试 Rust 编程语言?

安装 Rust 后,请按照以下步骤检查 Rust 语言是否正常工作。

$ mkdir~/projects

$ cd~/projects

$ mkdir hello_world

$ cd hello_world

创建一个文件并添加以下代码并保存。确保 Rust 文件始终以 .rs 扩展名结尾。

$ vi2g.rs

fn main(){

println!("Hello, It's 2linuxidc.com - Best Linux Practical Blog!");

}

运行以下命令编译 rust 代码。

$ rustc 2g.rs

上面的命令将在同一目录中创建一个可执行的 Rust 程序。

$ ls-lh

total 3.9M

-rwxr-xr-x 1 linuxidc linuxidc 3.9MDec1411:092g

-rw-r--r--1 linuxidc linuxidc 86Dec1411:092g.rs

运行 Rust 可执行文件得到输出。

$ ./2g

Hello,It's www.linuxidc.com - Best Linux Practical Blog!

好了!正常工作了。

将 Rust 更新到最新版本。

$ rustup update

info: syncing channel updates for'stable-x86_64-unknown-linux-gnu'

info: checking forself-updates

stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0(abe02cefd 2018-12-04)

运行以下命令从系统中删除 Rust 包。

$ rustup self uninstall

卸载 Rust 包后,删除 Rust 项目目录。

$ rm-fr ~/projects

rust安装教程linux,如何在 Linux 中安装 Rust 编程语言相关推荐

  1. hyperterminal使用教程_如何在Win7中安装使用超级终端Hyper Terminal(转)

    [整理]如何在Win7中安装使用超级终端Hyper Terminal how install hyper terminal into Win7 作者:crifan 联系方式:green-waste ( ...

  2. hyperterminal使用教程_如何在Win中安装使用超级终端HyperTerminal.doc

    如何在Win中安装使用超级终端HyperTerminal [将超级终端Hyper Terminal从Windows XP移植到Win7中的过程]1.从Windows XP中获得超级终端相关的文件(可执 ...

  3. unbantu上python安装步骤_如何在Ubuntu中安装Python 3.6?

    Python是增长最快的主要通用编程语言.原因有很多,比如它的可读性和灵活性,易于学习和使用,可靠和高效. 有两个主要的Python版本被使用- 2和3 (Python的现在和未来);前者将看不到新的 ...

  4. 脑影像分析工具保姆级安装教程——VMware Workstation16.1.2中安装FSL6.0.3/FSL6.0.4、MRtrix3、MRIcron并修复fsleyes not found

    | 图源   之前写过三篇关于FSL安装的文章,包括简易安装.docker下完整安装,Linux下完整安装,这篇在VMware Workstation16.1.2中安装,算是之前的各种安装方法的一个集 ...

  5. cdh 安装_0623-6.2.0-如何在CDH中安装CFM

    1.文档编写目的 2019年4月15日,Cloudera在其官网宣布GA两款新的产品Cloudera Flow Management和Cloudera Edge Management,即CFM和CEM ...

  6. python联想_联想电脑python安装教程_如何在windows上安装python

    如何在windows上安装python 方法如下: 首根据Windows版本(64位32位)从Python的官方网站下载Python 3.5的64装程序或32位安装程序. 然后,运行下载的EXE安装包 ...

  7. pycharm教程:如何在pycharm中安装软件包(超详细)

    首先,pycharm的功能十分强大,但是有很多刚接触的朋友不太懂得如何安装软件包.接下来我就来为大家演示这一过程. 1.打开我们的pycharm,然后点击文件(file),再点击(设置)setting ...

  8. 如何在VMware中安装Linux系统(带界面)~新手向

    如何在VMware中安装Linux系统(带界面)~新手向 1.打开VMware虚拟机 2.创建新的虚拟机 3.加载ISO 4.命名虚拟机 5.指定磁盘容量 6.自定义硬件 7.启动虚拟机 1.打开VM ...

  9. 保姆级教程带你在VMware中安装Linux Debinan操作系统

    保姆级教程带你在VMware中安装Linux Debinan操作系统 文章目录 保姆级教程带你在VMware中安装Linux Debinan操作系统 1.Debinan系统介绍 2.Debinan操作 ...

  10. linux动画制作软件,如何在Ubuntu中安装2D动画软件OpenToonz

    OpenToonz,开源2D动画软件,现在可以通过Snap软件包轻松安装在Ubuntu 16.04,Ubuntu 18.04及更高版本中. OpenToonz基于Toonz Studio Ghibli ...

最新文章

  1. redis3.2集群搭建
  2. CSS3自定义Checkbox特效
  3. 如何获取cURL以不显示进度栏?
  4. 2018年最实用的6个机器学习项目
  5. 雪花开发者中心地府云自适应1号模板 雪花xueidc插件
  6. shell之提取头文件
  7. 安装oracle11卡住了咋办,WINDOWS SERVER下安装ORACLE11R2采坑记录
  8. html图片在td上不能显示,动态添加表格数据和表格行到HTML,TD不显示在HTML中
  9. Win 7 Boot Updater(Win7开机引导动画修改工具)v0.0.1.3中文免费版
  10. 微型计算机原理及应用课程复习与考研指导,微机原理及应用课程复习.doc
  11. 在consul中删除服务
  12. 【刷题总结】二叉树前中后序遍历
  13. rpm、lpm是什么意思?
  14. 苹果手机开热点电脑/安卓手机无法链接?
  15. 英语考研——因果状语从句
  16. metasploit中用shodan模块进行网络摄像头查找
  17. linux最后一行awk,51CTO博客-专业IT技术博客创作平台-技术成就梦想
  18. 吉首 - 超超的自闭意思(素筛+暴力)
  19. 中国为什么出不了乔布斯?
  20. 飞思卡尔芯片解密 MC9S08GB60 芯片特点

热门文章

  1. asp-Webshell免杀
  2. 计算机考试考前准备,考前必看如何正确准备计算机等级考试 -电脑资料
  3. [网络安全自学篇] 十五.Python攻防之多线程、C段扫描和数据库编程(二)
  4. 【数据结构与算法】之深入解析“字符串相乘”的求解思路与算法示例
  5. Python之深入解析一行代码计算每个省面积的神器Geopandas
  6. 信息学奥赛一本通(C++)在线评测系统——基础(一)C++语言——1103:陶陶摘苹果
  7. 信息学奥赛一本通(C++)在线评测系统——基础(一)C++语言——1102:与指定数字相同的数的个数
  8. ubutnu16.04安装ros2
  9. 关于uint8_t/uint16_t/uint32_t/uint_fast16_t
  10. 【机器视觉】 translate_measure算子