How to install Rust on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

Whether you are a Rust developer, or a newbie learning Rust programming language, to be able to work on your projects written in Rust one must have Rust installed on computer.

Installing Rust on Ubuntu 22.04 can be done easily by using the official installer Rustup.

Rustup allows you to download and install Rust easily without having to download additional packages.

In this tutorial, you will learn how to install Rust on Ubuntu 22.04.

Step 1 - Install Curl

We'll be using curl to download rustup, so make sure you have curl installed on your Ubuntu 22.04 machine. If curl it's not installed on your system, then you can easily install it via the command below

sudo apt install curl

Step 2 - Install Rustup

Once you have installed curl, you can proceed to install Rustup.

To install Rustup, first run the command below

curl --proto '=https' --tlsv1.2 -sSf | sh

Next, you will be prompted to select which type of profile you want to go with. By default rustup will use the default profile(profile 1), so if you press enter without choosing rustup will be installed on the default path.

You can also go with "Customize Installation" if you want to install rust on a custom path.

Once you make your choice, rustup will begin downloading files, all you have to do now is waiting for the download process to finish.

Once Rustup installs Rust, you will see the following message on your terminal

Step 3 - Add Rust PATH

Now you need to add rust on your Path environment, to make sure you can use Rust on your projects and terminal.

To add Rust Path on your current shell config file, you can do so by running the following command

source "$HOME/.cargo/env"

Step 4 - Verify Rust Installation

Now that Rust has been installed on your Ubuntu 22.04 machine, and Path added on your current shell config file, run the command below to check rust version

rustc --version


By now you should know how to install Rust on Ubuntu 22.04, by using the official Rust installer Rustup.

You should be able to use Rust on your machine and integrate it on your projects.