Learn how to install Rust on Linux using the official Rustup installer. Follow simple step by step instructions to install Rust, Cargo, verify the installation, update Rust, and create your first project.
ust is a modern programming language designed for building fast, reliable, and secure applications. It comes with Cargo, the official package manager that makes it easy to create projects, install libraries, and manage dependencies.
The recommended way to install Rust on Linux is by using rustup. It installs the latest stable version of Rust and makes it simple to keep your installation up to date.
Step 1: Open the Terminal
Launch the Terminal application on your Linux system.
Step 2: Install Curl
The Rust installer uses curl to download the installation script. Check if it is already installed.
curl --version
If the command is not available, install it using your distribution's package manager.
Ubuntu and Debian
sudo apt update
sudo apt install curl -y
Fedora
sudo dnf install curl
CentOS Stream, Rocky Linux, and AlmaLinux
sudo dnf install curl
Arch Linux
sudo pacman -S curl
Step 3: Install Rust
Run the official installation command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
The installer will display a few options. For most users, simply press Enter to continue with the default installation. This installs the latest stable Rust compiler along with Cargo and Rustup.
Step 4: Load the Rust Environment
Once the installation finishes, load the Rust environment into your current terminal session.
source "$HOME/.cargo/env"
If you open a new terminal window later, this step is usually handled automatically.
Step 5: Verify the Installation
Check the installed Rust compiler version.
rustc --version
Example output:
rustc 1.xx.x
Check the Cargo version.
cargo --version
Example output:
cargo 1.xx.x
If both commands display version numbers, Rust is ready to use.
Step 6: Create Your First Rust Project
Create a new project with Cargo.
cargo new hello_rust
Move into the project directory.
cd hello_rust
Run the application.
cargo run
You should see the following output.
Hello, world!
Update Rust
Rust receives regular updates. You can install the latest stable release with a single command.
rustup update
This updates Rust, Cargo, and the installed toolchains.
Check Installed Toolchains
To view the installed Rust toolchains, run:
rustup show
Install the Nightly Toolchain
If you want to use nightly features, install the nightly toolchain.
rustup toolchain install nightly
Switch to it when needed.
rustup default nightly
To switch back to the stable release:
rustup default stable
Uninstall Rust
If you ever want to remove Rust from your system, run:
rustup self uninstall
This removes Rust, Cargo, and Rustup from your system.
Conclusion
Installing Rust on Linux takes only a few minutes with the official Rustup installer. After installation, you get the Rust compiler, Cargo package manager, and Rustup version manager in one setup. From there, you can create projects, manage dependencies, and keep your development environment updated with a single command.

