如何安装rust和jq

命令行安装rust

搭建go-filecoin测试节点,需要安装rust。

不要使用brew安装,直接到rust官网https://www.rust-lang.org/,根据官网提示安装
在终端输入命令curl https://sh.rustup.rs -sSf | sh,过程中会有选择提示,直接输入1继续安装即可。
看到屏幕输出,即为安装成功。

Rust is installed now. Great!

完整过程如下

$ 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/sszxr/.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/sszxr/.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/sszxr/.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 2019-08-15, rust version 1.37.0 (eae3437df 2019-08-13)
info: downloading component 'rustc'
 85.3 MiB /  85.3 MiB (100 %)  12.2 MiB/s in  6s ETA:  0s
info: downloading component 'rust-std'
 61.2 MiB /  61.2 MiB (100 %)  12.7 MiB/s in  5s ETA:  0s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: installing component 'rustc'
 85.3 MiB /  85.3 MiB (100 %)   6.3 MiB/s in 10s ETA:  0s
info: installing component 'rust-std'
 61.2 MiB /  61.2 MiB (100 %)  11.7 MiB/s in  5s ETA:  0s
info: installing component 'cargo'
info: installing component 'rust-docs'
 11.3 MiB /  11.3 MiB (100 %)   2.7 MiB/s in  4s ETA:  0s
info: default toolchain set to 'stable'

  stable installed - rustc 1.37.0 (eae3437df 2019-08-13)


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
 

使用上面的方法安装,会顺带安装cargocargo也是搭建go-filecoin测试节点所需要的。

查看版本

命令行安装的是rust的最新版本,注意,输入的是rustup,输入rust会显示找不到命令。

sszxr:~ sszxr$ rustup --version
rustup 1.19.0 (2af131cf9 2019-09-08)
sszxr:~ sszxr$ 

命令行安装jq

jq也是个很小的软件,直接使用命令行,一行命令安装
Mac上可以用brew安装brew install jq
Linux上安装命令sudo apt-get install jq

查看版本

sszxr:~ sszxr$ jq --version
jq-1.6
sszxr:~ sszxr$ 

也可以下载源码安装,依次执行命令

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
yum repolist
sudo yum install jq

不同方法安装的可能版本不同,但不影响使用。

发布了75 篇原创文章 · 获赞 33 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/Charliewolf/article/details/101274793