How to Install Rust on a Linux Vultr VPS

Updated on May 13, 2020
How to Install Rust on a Linux Vultr VPS header image


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:

  • CentOS 7 & 8
  • CoreOS
  • Debian 8, 9 & 10
  • Fedora 30, 31, & 32
  • FreeBSD 11 & 12
  • Ubuntu 16.04 LTS, 18.04 LTS, 19.10, & 20.04 LTS


FreeBSD users may need to install curl before proceeding.

# pkg install curl

Install Rust

The preferred method to install Rust on Linux, or another Unix-like OS, is with rustup.

  1. SSH to your VPS instance. You do not need root access.

  2. Download and execute rustup.

     $ curl --proto '=https' --tlsv1.2 -sSf | sh
  3. Make a note of the on-screen information about environment variables and installation paths.

  4. When prompted, proceed with the default or customized installation.

Configure the PATH for Rust

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.

Test the Rust Installation

Run rustc to verify the installation.

$ rustc -V

rustc 1.43.1 (8d69840ab 2020-05-04)

Update Rust

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.

Uninstall Rust

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

More Information

For more information, use rustup help or refer to the official website.