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).

Prerequisites

  • 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 https://sh.rustup.rs | sh

Output:

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 testingrust.rs

Add the following file:

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

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

rustc testingrust.rs

And finally, run it with the following command:

./testingrust

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 Server System Administrator with more than 7 years of experience in server administration, operating systems, and programming. They have a strong track record of managing, securing, and optimizing Linux-based infrastructure (Ubuntu, Debian, CentOS/AlmaLinux) as well as Windows Server, across on-premises, VPS, and cloud environments. Their expertise covers configuring and maintaining web servers (Nginx, Apache) and databases (MySQL/MariaDB, PostgreSQL). It also includes virtualization and containers (Proxmox, Docker), networking, firewalls, and security hardening. They are experienced in monitoring, backup and disaster recovery, and troubleshooting to keep services available and performing well. Skilled in Bash, Python, and PHP, they automate routine tasks, build maintenance scripts, and manage deployments, which makes operations more efficient and less error-prone. They are known for being meticulous, responsive during incidents, and willing to share knowledge with teams and the wider community. Outside of work, r00t enjoys experimenting with homelabs, open source software, and emerging infrastructure technologies.

Related Posts