Your cart is currently empty!
How to Install Rust on Ubuntu (the Easy Way)
Rust is fast, safe, and backed by a vibrant community. Whether you’re systems-level hacker or simply curious, Ubuntu’s a perfect playground. Follow these steps and you’ll be compiling “Hello, world!” before your coffee’s cold.
What You’ll Need
- Ubuntu 18.04 or later (tested on 20.04/22.04/24.04)
- A user account with
sudo
rights - A working internet connection
- Basic familiarity with the terminal
1. Update Your System
Open a terminal and run:
sudo apt update
sudo apt upgrade -y
This ensures you have the latest package lists and security patches.
2. Install Prerequisites
Rust’s installer uses curl
and will compile code, so make sure you’ve got what you need:
sudo apt install curl build-essential -y
- curl: fetches the Rust installer
- build-essential: provides
gcc
,make
, and other compilers
3. Download and Run the Rustup Installer
Rust’s official toolchain manager is rustup
. One command does it all:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- ––proto and ––tlsv1.2 force secure downloads
- -sSf silences progress but fails loudly on errors
When prompted, type 1
(the default) to install the stable toolchain and configure your PATH automatically.
4. Load Rust into Your Shell
Either close and reopen your terminal—or source the environment file:
source $HOME/.cargo/env
This adds Cargo (Rust’s package manager) and rustc
(the compiler) to your PATH
.
5. Verify the Installation
Quick sanity check:
rustc --version
cargo --version
You should see something like:
rustc 1.78.0 (protected-penguin 2025-05-01)
cargo 1.78.0 (abcdef123 2025-05-01)
If you do, you’re officially Rust-y.
6. Keep Rust Up to Date
Rust evolves fast. Update your toolchain any time with:
rustup update
This fetches and installs the latest stable compiler and Cargo.
7. Uninstalling Rust
Changed your mind? Remove everything cleanly:
rustup self uninstall
Follow the prompts to purge Rust and all related files.
Next Steps
- Create a new project:
cargo new hello-rust
cd hello-rust
cargo run
- Explore crates.io: thousands of community libraries
- Read “The Rust Book”: free, online, and packed with examples
Rust on Ubuntu takes less than five minutes to install—and once you’ve got it, you’re set for years of safe, high-performance coding. Happy hacking!
Feel free to drop this entire post into a Markdown block on your WordPress site. The code samples will render perfectly, and readers can copy-and-paste without missing a beat.
Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!