How to Install Rust on Debian 12/11/10

Rust is a modern, high-performance programming language that focuses on safety, concurrency, and efficiency. Designed by Graydon Hoare and sponsored by Mozilla Research, Rust has been gaining traction for its ability to prevent many common programming errors and improve overall software quality. In this introduction, we will discuss some of the key features and differences that set Rust apart from other programming languages.

Key Features and Differences:

  1. Memory Safety: Rust provides strong guarantees for memory safety, ensuring that programs are free from undefined behavior and data races. The ownership system and borrow checker are two mechanisms that enable Rust to enforce these guarantees at compile time, without the need for a garbage collector.
  2. Concurrency: Rust excels at handling concurrent programming, thanks to its ability to prevent data races and its fearless concurrency model. Rust’s concurrency model allows for the efficient and safe execution of parallel code, making it an ideal choice for high-performance applications.
  3. Performance: Rust is designed with performance in mind, and its low-level control of system resources allows it to achieve high performance comparable to languages like C++.
  4. Interoperability: Rust can easily integrate with other languages, particularly with C, making it possible to use Rust for performance-critical components while leveraging existing code bases.
  5. Ecosystem: Rust has a growing ecosystem of libraries and tools, which can be easily managed with the package manager Cargo. The Rust community is highly active and welcoming, providing extensive documentation, learning resources, and support.
  6. Syntax and Expressiveness: Rust has a modern and expressive syntax, making it easy to read and write code. The language is also statically typed, which means the compiler catches many errors before the code is run, leading to safer and more maintainable code.

As you can see, Rust offers a unique combination of features that make it a powerful and attractive option for modern software development. Whether you’re building a system application, a web service, or a game, Rust can help you create fast, safe, and efficient software. In the following guide, we will demonstrate how to install Rust on your Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster system.

Section 1: Install Rust

Step 1: Update Debian

Before starting the Rust installation, it’s essential to update your Debian system to make sure all existing packages are up to date. This ensures compatibility and prevents potential issues during the installation process. Run the following command to update your system:

sudo apt update && sudo apt upgrade

Step 2: Install Required Packages

Next, you need to install some required packages that will be used during the Rust installation. These packages include essential build tools such as curl, build-essential, gcc, and make. To install these packages, execute the following command:

sudo apt install curl build-essential gcc make

Step 3: Install Rust

With the required packages installed, you can now proceed to install Rust on your system. The Rust installation script will be downloaded using curl, and the script will be executed automatically. Run the following command to download and run the Rust installation script:

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


During the installation process, you will be prompted to choose an installation option. Type 1 and hit Enter to proceed with the default installation.

The installation process can take between 1 to 5 minutes, depending on your server’s internet speed and hardware. Once the installation is complete, you will see a confirmation message.

The entire installation should take between 1 to 5 minutes, depending on your server’s internet speed and hardware. Once completed, you will see the following outcome:

Step 4: Activate Rust Environment

Next, you need to activate the Rust environment for your current shell session. This allows you to use Rust-related commands and tools. To activate the Rust environment, run the following commands:

source ~/.cargo/env

Step 5: Confirm Rust Installation

Finally, to ensure Rust has been successfully installed on your system, you can check the version of the Rust compiler (rustc). Type the following command and hit Enter to display the Rust compiler version:

rustc -V

Section 2: Test Rust Installation

After installing Rust, it’s essential to test the installation to ensure it’s working correctly. The best way to verify this is by creating a simple test application, like the classic “Hello World” program. In this section, we will walk you through the process of creating and running a basic Rust application.

Step 1: Create a Workspace Directory

First, create a directory that will serve as a workspace for your Rust projects. This helps keep your projects organized and easy to find. Run the following command to create a new directory called rust-projects in your home folder:

mkdir ~/rust-projects

Step 2: Create a Sample Application

Next, change to the newly created rust-projects directory and create a new Rust source file called using a text editor like nano. Run the following command to open the file in nano:

cd rust-projects && nano

Now, enter the following Rust code for the “Hello World” test:

fn main() {
    println!("Hello World, this is a test provided by");

Save the changes by pressing CTRL+O, and then exit nano by pressing CTRL+X.

Step 3: Compile the Program

With the source file created, you can now compile the program using the Rust compiler, rustc. Run the following command to compile the file:


This command will create an executable file named helloworld in your current directory after the compilation process is complete. The directory should now contain both the source file and the compiled executable, as shown in the example output below:


Step 4: Run the Test Application

Finally, to run the “Hello World” application you created using Rust, execute the following command:


You should see the output from the test application, which should look like this:

Hello World, this is a test provided by

If you see the above output, it means your Rust installation is working correctly, and you can start developing Rust applications on your system.

Section 3: Additional Commands & Tips

This section will cover some useful commands and tips for managing your Rust installation, including updating and uninstalling Rust.

Step 1: How to Update Rust

Keeping your Rust installation up-to-date is essential to ensure you have access to the latest features, bug fixes, and performance improvements. Updating Rust is straightforward and can be done using a single command in your terminal. To update Rust, run the following command:

rustup update

Example output:

This command will check for available updates and install them automatically. If your Rust installation is already up-to-date, the command will notify you.

Step 2: How to Remove (Uninstall) Rust

If you decide that you no longer need Rust on your Debian system, you can easily remove it using the rustup tool. To uninstall Rust, run the following command:

rustup self uninstall

Example output:

This command will remove Rust and its associated components from your system. Please note that this command only uninstalls Rust itself and does not remove any projects, source files, or executables you’ve created using Rust.

Conclusion: Installing Rust on Debian

This guide demonstrated how to install Rust on Debian Linux systems, including Debian 12 Bookworm, Debian 11 Bullseye, and Debian 10 Buster. By following the step-by-step instructions, you should now have a working Rust installation and be able to create, compile, and run Rust applications on your Debian system. Additionally, we’ve covered some essential commands and tips for managing your Rust installation, such as updating and uninstalling Rust when necessary. By mastering these concepts, you can ensure a smooth and efficient Rust development experience on Debian Linux.

Additional Resources and Links

To further enhance your knowledge of Rust and assist you in your Rust development journey, here are some official resources and links:

  • The Rust Programming Language: The official Rust website, which contains essential information about the language, its features, and the community.
  • The Rust Documentation: The official Rust documentation, which provides comprehensive information on the language, its syntax, and the standard library.
  • The Rust GitHub Repository: The official Rust GitHub repository, where you can find the source code, report issues, and contribute to the Rust project.
  • The Rust Book: An in-depth guide to Rust, covering everything from basic concepts to advanced topics. This book is an excellent resource for both beginners and experienced Rust developers.
  • The Rust Playground: An online Rust compiler that allows you to quickly test and experiment with Rust code without the need to install anything on your system.
  • The Rust Forum: The official Rust community forum, where you can ask questions, seek advice, and engage with other Rust developers.

Share to...