image.pngimage.png

    1. 我提前设置好了 RUSTUP_DIST_SERVER 为清华源,但是使用官网的 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 命令会出现网络连接导向出错,下载地址根本不存在。因此只能自己去官网下载 rustup-init 执行文件来安装。注意,需要 chmod +x rustup-init 增加可执行属性。

      1. # 在 /etc/profile.d/ 文件下创建一个设置文件 setting.sh,写入以下内容,再 source /etc/profile 生效
      2. RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup
      3. RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup
    2. 一般64位的 linux 下载 清华源 /rustup/archive/1.22.1/x86_64-unknown-linux-gnu/ 路径下的 rustup-init ,但是我一开始下载的是 x86_64-unknown-linux-musl 版本,安装完之后 .cargo/bin 目录明明存在执行文件,却都无法调用 cargo 命令。查了一下,可能是内核识别为动态链接的可执行文件,但其动态加载程序不可用。最后我发现了所有版本的说明 以及 musl 版本 的说明。原来 musl 版本的前提是要安装 musl。使用 rustup self uninstall 卸载 rust,再重新下载和安装。

    image.pngimage.png
    image.png
    image.png