Rust第一次---centos 7下的安裝,配置,測試

如今安裝都依賴於網絡,命令比較簡單。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

相關文章
相關標籤/搜索