Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install the Rust Programming Language on Ubuntu

Install Rust with rustup, check it and write a first program.

VPS and Cloud Servers1 min read3 steps5 screenshots

Step 1: Install curl

sudo apt install curl build-essential
Installing curl

(build-essential gives you the C linker that Rust needs.)

Step 2: Download and run the installer

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Running rustup

Step 3: Choose the installation option

The installer shows three options:

  1. Proceed with standard installation (the default). Installs the stable toolchain.
  2. Customize installation. Choose the toolchain and the profile.
  3. Cancel installation.

Press 1 and Enter.

Choosing the installation option
Rust is installed

Load Rust into your current shell:

source "$HOME/.cargo/env"

Step 4: Check the install

rustc --version
cargo --version
The Rust version

A first program

cargo new hello
cd hello
cargo run

Cargo creates a project that prints "Hello, world!".

Update and remove

rustup update
rustup self uninstall

About Rust

Advantages

  • Performance. Speed like C and C++.
  • Reliability. The type system and ownership rules prevent whole classes of bugs.
  • Concurrency. Safe code that runs in parallel.
  • Modern tools. Cargo, tests and docs built in.

Use cases

  • Systems programming.
  • Web back ends and services.
  • Command-line tools.
  • WebAssembly and embedded code.

Quick recap

  • Use the rustup installer.
  • Choose option 1 and load ~/.cargo/env.
  • Check with rustc --version.