This installation guide demonstrates how to install, maintain, and remove Rust on a Linux Vultr VPS instance. Rust is a programming language focused on performance and safety. Rust syntax is similar to C++ and provides memory safety without garbage collection. The Rust compiler is free, open-source software under the MIT License and Apache License 2.0.
This guide has been tested on:
FreeBSD users may need to install curl before proceeding.
# pkg install curl
The preferred method to install Rust on Linux, or another Unix-like OS, is with rustup.
Download and execute rustup.
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Make a note of the on-screen information about environment variables and installation paths.
During installation, rustup attempts to configure the PATH to include the ~/.cargo/bin directory, which contains the Rust toolchain. After installation completes, log out and log in again to reload your PATH. You can also load the new environment with:
$ source $HOME/.cargo/env
If rustup encounters errors, it may fail to update the environment. If you are unable to run
rustc -V, verify your path includes ~/.cargo/bin.
Run rustc to verify the installation.
$ rustc -V rustc 1.43.1 (8d69840ab 2020-05-04)
Rust has a rapid release cycle. You can update your installation with rustup.
$ rustup update
For more information, see the rustup documentation or run
rustup update help.
You can remove your Rust installation with rustup.
$ rustup self uninstall This will uninstall all Rust toolchains and data, and remove $HOME/.cargo/bin from your PATH environment variable. Continue? (y/N) Y
For more information, use
rustup help or refer to the official website.