Rust 命令在 Liunx 中设置为全局可用

chmod -R 777 ~/.cargo/
chmod -R 777 ~/.rustup/
mv ~/.cargo /usr/local/cargo
mv ~/.rustup /usr/local/rustup

vi /usr/local/cargo/env
Change:
$HOME/.cargo/bin
to:
/usr/local/cargo/bin

vi ~/.bashrc
Change:
. "$HOME/.cargo/env"
to:
. "/usr/local/cargo/env"
export CARGO_HOME=/usr/local/cargo
export RUSTUP_HOME=/usr/local/rustup

vi ~/.profile
Change:
. "$HOME/.cargo/env"
to:
. "/usr/local/cargo/env"

relogin

rustup show
rustc --version
cargo --version