Rust is a systems programming language that guarantees memory safety without a garbage collector through its borrow checker. It is used for WebAssembly, operating systems, game engines, and high-performance network services. This guide installs Rust via rustup on Ubuntu 26.04 LTS.
Tested and valid on:
- Ubuntu 26.04 LTS
Prerequisites
- Ubuntu 26.04 LTS
- A user account (does not require sudo)
- curl installed
Step 1 – Install Rust via rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Choose option 1 (default installation) when prompted.
Step 2 – Configure the PATH
source $HOME/.cargo/env
rustc --version
cargo --version
Step 3 – Create Your First Rust Program
cargo new hello_rust
cd hello_rust
cat src/main.rs
Step 4 – Build and Run
cargo build
./target/debug/hello_rust
# Optimised release build:
cargo build --release
./target/release/hello_rust
Step 5 – Add a Dependency
Edit Cargo.toml:
[dependencies]
serde = { version = '1', features = ['derive'] }
serde_json = '1'
cargo build
Step 6 – Update Rust
rustup update
rustc --version
Step 7 – Install Useful Tools
cargo install cargo-watch # auto-rebuild on change
cargo install cargo-edit # cargo add/rm/upgrade
cargo install ripgrep # fast grep replacement (rg)
rg --version
Conclusion
Rust is installed via rustup on Ubuntu 26.04 LTS. The cargo package manager handles building, testing, and dependency management. Explore crates.io for the Rust ecosystem and read The Rust Book at doc.rust-lang.org.