Installing the Rust programming language on Ubuntu 26.04 with rustup gives you a complete, up-to-date toolchain managed independently from your system packages. This guide walks you through the rust rustup install on Ubuntu 26.04, from prerequisites to creating your first project with Cargo.
Software Requirements and Linux Command Line Conventions
Category
Requirements, Conventions or Software Version Used
System
Ubuntu 26.04 Resolute Raccoon
Software
rustup, rustc, cargo
Other
Privileged access to your Linux system as root or via the sudo command. An active internet connection.
Conventions
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux commands to be executed as a regular non-privileged user
Install Rust on Ubuntu 26.04 using the official rustup installer. This sets up rustc, cargo, and toolchain management in your home directory.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
3. Load environment
source "$HOME/.cargo/env"
4. Verify installation
rustc --version && cargo --version
Understanding Rust and Rustup on Ubuntu 26.04
Rust is a systems programming language focused on performance, memory safety, and concurrency. While Ubuntu 26.04 does ship a rustc package through apt, the repository version is typically several releases behind the latest stable. Consequently, the Rust project officially recommends rustup as the preferred installation method.
Rustup is a toolchain multiplexer that installs and manages Rust compiler versions. It places everything under ~/.cargo and ~/.rustup in your home directory, keeping your system untouched. With rustup you get three core components: rustc (the compiler), cargo (the package manager and build system), and rustup itself for toolchain management.
DID YOU KNOW
Ubuntu 26.04 uses Rust-based coreutils (uutils-coreutils) as the default implementation of common commands like ls, cp, and cat. This means Rust is already running at the core of your system, even before you install the compiler.
Installing Rust with Rustup on Ubuntu 26.04
Follow these steps to perform a complete rust rustup install on your Ubuntu 26.04 system.
Install build prerequisites: The Rust compiler needs a C linker and related tools to compile programs. Install the build-essential meta-package along with curl for downloading the installer:
The build-essential package provides GCC, make, and the C library headers that Rust’s linker requires.
Run the rustup installer: Download and execute the official rustup installation script:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The installer presents three options. Press 1 to proceed with the default installation, which installs the latest stable toolchain.
[IMAGE PLACEHOLDER: Screenshot showing the rustup installer interactive prompt with the three installation options]
Load the Rust environment: After installation completes, load the Cargo environment into your current shell session:
$ source "$HOME/.cargo/env"
This adds ~/.cargo/bin to your PATH. The installer also modifies your shell profile (~/.bashrc or ~/.profile), so future terminal sessions will load automatically.
Verify the installation: Confirm that both rustc and cargo are accessible:
COMPLETED
Rust is now installed on your Ubuntu 26.04 system. You have the latest stable compiler, Cargo, and rustup ready to use.
Managing Rust Toolchains
Rustup allows you to install and switch between multiple Rust toolchains. This is particularly useful when a project requires a specific compiler version or when you need to test against nightly features.
Updating Rust
To update all installed toolchains to their latest versions, run:
$ rustup update
This downloads and installs the newest stable, beta, or nightly releases for any toolchains you have installed. It is good practice to run this command regularly.
Installing Additional Toolchains
Besides the default stable toolchain, you can install beta or nightly channels:
Cargo is Rust’s build system and package manager. It handles project creation, dependency management, compilation, and testing. Additionally, Cargo integrates with Git by initializing a repository automatically for each new project.
Create a new project: Generate a new binary project using cargo new:
$ cargo new linuxconfig_project
$ cd linuxconfig_project
This creates a directory with a Cargo.toml manifest and a src/main.rs source file.
Examine the project structure: Take a look at the generated files:
If you need to remove Rust from your system, rustup provides a clean uninstall command that removes all toolchains, components, and the rustup binary itself:
$ rustup self uninstall
This deletes the ~/.cargo and ~/.rustup directories and removes the PATH modification from your shell profile. No system files are affected since rustup installs everything within your home directory.
Conclusion
You have successfully completed the rust rustup install on Ubuntu 26.04. Your system now has the Rust compiler, the Cargo package manager, and rustup for toolchain management. From here you can install additional toolchains, add cross-compilation targets, and manage project dependencies entirely through Cargo. For further reading, consult the official Rust installation page and the Rust Book.
Frequently Asked Questions
Should I install Rust from apt or use rustup on Ubuntu 26.04? Use rustup. The apt rustc package is typically several versions behind the latest stable release and does not support toolchain switching or easy updates. Rustup gives you the latest compiler and lets you manage multiple versions side by side.
Where does rustup install Rust on my system? Rustup installs everything under two directories in your home folder: ~/.rustup (toolchains and components) and ~/.cargo (binaries, the registry cache, and project build artifacts). No system-wide directories are modified.
How do I update Rust to the latest version? Run rustup update to update all installed toolchains. You can also run rustup update stable to update only the stable channel. Check your current version at any time with rustc --version.
Can I have both stable and nightly Rust installed at the same time? Yes. Rustup is designed to manage multiple toolchains simultaneously. Install nightly with rustup toolchain install nightly and switch between them using rustup default or per-project overrides with rustup override set.