rust をインストールするスクリプトをダウンロードして実行する。本家のページではいきなり sh に pipe で流し込む作法だ。危なすぎると思う。一旦ファイルに取り置いてそれから実行する。
mkdir -p ~/rustup-install cd ~/rustup-install curl -o rustup-install.sh https://sh.rustup.rs # if you want to see what will be happen. less ./rustup-install.sh source ./rustup-install.sh
実行すると次の様な警告が出る場合がある。既に deb package 版の rust をインストールしている状況だと思われる。y を返答する。
info: downloading installer warn: It looks like you have an existing installation of Rust at: warn: /usr/bin warn: It is recommended that rustup be the primary Rust installation. warn: Otherwise you may have confusion unless you are careful with your PATH. warn: If you are sure that you want both rustup and your already installed Rust warn: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes warn: or pass `-y' to ignore all ignorable checks. error: cannot install while Rust is installed
# set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
# set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi . "$HOME/.cargo/env"
.bashrc の末尾を確認
tail ~/.bashrc
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi . "$HOME/.cargo/env"
#!/bin/sh # rustup shell setup # affix colons on either side of $PATH to simplify matching case ":${PATH}:" in *:"$HOME/.cargo/bin":*) ;; *) # Prepending path in case a system-installed rustc needs to be overridden export PATH="$HOME/.cargo/bin:$PATH" ;; esac