如今安装都依赖于网络,命令比较简单。git
一,运行脚本,安装runstupgithub
1,运行以下脚本:bash
curl https://sh.rustup.rs -sSf | sh
2,输入默认项1,完成余下的安装网络
二,指定安装版本curl
1,指定国内安装源ide
/root/.cargo/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/"
2,指定安装版本url
rustup override set nightly-2018-01-12
三,导入环境变量code
1,运行source命令导入变量blog
source $HOME/.cargo/env
2,查看rust版本
rustup --version
四,测试运行文件
1,在/root/projects/hello_world目录下,生成一个简单的hello.rs文件
fn main() { println!("Hello, Rust!") }
2,编译此文件
rustc hello.rs
3,运行编译后文件
./hello