安装
执行命令:
curl -sSf https://sh.rustup.rs | sh
执行如下
[root@izwz9938t1plpjxsy3riqdz /]# curl https://sh.rustup.rs -sSf | sh -s
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:
/root/.cargo/bin
This path will then be added to your PATH environment variable by modifying the
profile files located at:
/root/.profile
/root/.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-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
info: downloading component 'rustc'
76.4 MiB / 76.4 MiB (100 %) 979.7 KiB/s ETA: 0 s
info: downloading component 'rust-std'
41.9 MiB / 52.8 MiB ( 79 %) 1016.8 KiB/s ETA: 11 s 52.8 MiB / 52.8 MiB (100 %) 1.4 MiB/s ETA: 0 s
info: downloading component 'cargo'
4.4 MiB / 4.4 MiB (100 %) 1.1 MiB/s ETA: 0 s
info: downloading component 'rust-docs'
8.9 MiB / 8.9 MiB (100 %) 1.1 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.30.1 (1433507eb 2018-11-07)
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 automat
2.重开一个会话输入命令rustc --version显示如下说明安装成功
[root@izwz9938t1plpjxsy3riqdz ~]# rustc --version
rustc 1.30.1 (1433507eb 2018-11-07)
配置科大rust源
- 使用命令vi /root/.cargo/config创建一个config文件 并打开文件
- 在config中添加如下内容:
[registry]
index = "https://mirrors.ustc.edu.cn/crates.io-index/"
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "https://mirrors.ustc.edu.cn/crates.io-index/"
3.保存退出