Rust is a systems programming language focused on safety, speed, and concurrency without a garbage collector. This guide installs the Rust toolchain using rustup, the official Rust installer, on Ubuntu 24.04 LTS.
Tested and valid on:
- Ubuntu 24.04 LTS
Prerequisites
- Ubuntu 24.04 LTS server
- A user with sudo privileges
Step 1 – Install Rust with rustup
Download and run the rustup installer:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Select option 1 for the default installation.
Step 2 – Configure the PATH
Load the Rust environment:
source $HOME/.cargo/env
Or open a new terminal — rustup adds this to ~/.bashrc automatically.
Step 3 – Verify the Installation
Check the Rust and Cargo versions:
rustc --version
cargo --version
Step 4 – Install Build Dependencies
Rust requires the C linker and build tools:
sudo apt install build-essential -y
Step 5 – Create a Hello World Project
Create a new Cargo project:
cargo new hello_world
cd hello_world
cargo run
Step 6 – Update Rust
Update the Rust toolchain:
rustup update
Step 7 – Install Additional Toolchains
Install the nightly toolchain for experimental features:
rustup toolchain install nightly
rustup default stable # keep stable as default
Conclusion
Rust is now installed on Ubuntu 24.04 LTS via rustup. Cargo manages dependencies, builds, tests, and benchmarks. Rust is an excellent choice for performance-critical applications, CLI tools, and WebAssembly.