How To Install Rust on Debian 11

Install Rust on Debian 11

In this tutorial, we will show you how to install Rust on Debian 11. For those of you who didn’t know, Rust is a programming language created by Mozilla and driven by the user and contributor community. Developers use Rust to create a wide range of new software applications, such as game engines, operating systems, file systems, browser components, and simulation engines for virtual reality.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of Rust programming language on a Debian 11 (Bullseye).


  • A server running one of the following operating systems: Debian 11 (Bullseye).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Rust on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install curl build-essential gcc make

Step 2. Installing Rust on Debian 11.

The installation of Rust is actually quite simple, you can use curl it to download the Rust installation script by executing the following command:

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


Install Rust on Debian 11 Bullseye

At the end of the screen output, it will show you 2 installation options. I recommend using the default installation (option 1) because it is faster, easier.

When the process finishes, you will be prompted to run a command to update the system environment variables. This will allow us to use Rust commands from any location in the terminal:

source ~/.profile
source ~/.cargo/env

Verify the version build of Rust installed:

rustc -V

Step 3. Testing Rust.

Let’s run a test. We’ll use the tried and true “Hello, World!”. Now we create a new directory with the command:

mkdir ~/rustexample
cd ~/rustexample

Next, we’ll create a new rust file with the command:

sudo nano

Add the following file:

fn main() {
    println!("Hello, The New Stack!");

Save and close, then compile the program with the following command below:


And finally, run it with the following command:


Congratulations! You have successfully installed Rust. Thanks for using this tutorial for installing the latest version of Rust open-source programming language on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Rust website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button