How to Install Rustup on Linux ?

Rustup Installation Guide On Linux

Rustup is the standard and central tool which is used to download and install different versions of the Rust compiler from the official channels. This allows for easy switching between the various versions of the compilers namely, stable, beta and nightly. 

But why Rust ? Well, Rust is a systems level programming language with performance comparable to that of C and C++ whilst prioritising the memory safety of the program through its borrowing and ownership rules, and has been gaining popularity as of recently among developers. This is evident by the fact that the number of Rust developers is growing, as well as the adoption of the language in large codebases.

Apart from that, unlike C and C++, Rust has an official package manager (Cargo) to easily find and install packages, simplify dependency, project management, building, testing and publishing Rust Projects. Also, another benefit of the borrowing and ownership rules appears in concurrent programming. As Rust prevents race conditions at compile time. Also, async/await syntax provided in Rust makes asynchronous programming less error-prone.

But how do you handle the potentially multiple versions of Rust you’ll inevitably encounter across your projects ? That’s where Rustup comes into the picture.

With Rustup, you can compile Rust programs to run on different platforms and architecture. This is especially beneficial in the case of embedded systems programming, or older code bases written with older versions of Rust in mind, as you can simply set up the version of Rust you want for each project.


Method 1 : Using curl (recommended method)

You can directly install Rustup using the command line through the following command, irrespective of your Linux distribution –

curl -sSf | sh
Installing Rustup Using Curl
Installing Rustup Using Curl Part-1

At this point, you have to type 1 and press enter to proceed with the installation, or if you want to customize the installation, you can type 2 and customize the settings as per your requirements. By default, the stable version of Rust will be initialized (can be changed according later on).

Installing Rustup Using Curl 2
Installing Rustup Using Curl Part-2

Finally, you have to set up the PATH environment variables to include cargo (Rust’s package manager) in your PATH. For that, you have to execute the following command –

souce "$HOME/.cargo/env"

Method 2 : Using package manager

You can also install Rustup using the default package manager provided in your distribution. In my case, I’m using Manjaro (Arch-based distribution) with the default package manager being pacman, so in this case, I’ll be running the following command –

pacman -Sy rustup

But you can modify the above command according to the default package manager of your distro.

Method 3 : Downloading the rustup-init from the website

In case you want to manually download the rustup-init file, you can do so from here. Then you proceed normally like you install downloaded apps.

Verifying the Installation

Let’s check if Rustup is properly installed by typing rustup in the terminal and pressing enter. On doing so, you’ll get a similar output as shown below, if not, then you might want to repeat the installation steps you followed.

Confirming Installation 1
Confirming Installation

We’re further going to check if Rust is properly working on the system by building a simple “Hello World” program and running it. To do so, write the following code in a file (make sure the file extension is .rs). In my case, I’ve written the following code in a file named “” which is stored in the folder named “sample”

fn main(){
     println!("Hello World !");

Now, you have to navigate to the folder and run the following commands to run the program –

Testing Rustup
Testing Rust installation


In this module, we discussed Rustup, which is the official toolchain installer for Rust. We also learned how to install Rustup on Linux, as well as wrote a simple “Hello World” program in Rust. If you want to learn more about the Rust programming language, you can refer to the Rust Book. If you want to learn more about Rustup, here’s the link to its documentation.