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

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:

fnmain() {
    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!