Rust is designed to compete with C and C++. In this tutorial, we will explore the steps to install and start using RUST on Debian 11 Bullseye Linux.
C and C++ have been the most popular programming languages for developing operating systems and performance-critical applications. However, there is also another popular player known as Rust that has positioned itself in the programming language market between low-level languages like C/C++ and highly abstract languages like C# and Java.
Like C/C++, the language is compiled directly into machine code and thus enables direct access to the hardware. At the same time, as in Java and C#, care is taken to ensure that memory accesses cannot lead to security gaps.
Mozilla’s new Servo browser engine provides a glimpse of Rust’s possibilities. It is a modern programming language that focuses on thread safety and performance. Unlike many so-called higher-level programming languages, Rust has neither garbage collection nor a virtual machine. Instead, Rust addresses well-known problems of long-established low-level programming languages such as C or C++. However, developers have to give some time to overcome the steep learning curves.
Steps to Install and use Rust on Debian 11 Bullseye
1. Requirements
• Debian Linux
• Terminal Access
• Non-root user atleast
• Terminal Access
2. Run Apt Update command
Next, before getting into the steps for the installation of the RUST on Debian 11, let’s ensure that our system is updated. This will also minimize package compatibility issues.
sudo apt update && sudo apt upgrade
3. Install Rust on Debian 11 Bullseye
Rust packages to install on Debian 11 Bullseye are not available in its official repository. Therefore, we can use the script provided by the offcial RUST developers to install it easily on our Linux systems.
curl https://sh.rustup.rs -sSf | sh
As you run the script, three options will appear:
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
By default, the first will be selected, hence just hit the Enter key to move forward.
4. Configure your current Shell
Once the installation is completed, to use the Rust in the current shell we need to restart it. This will reload our PATH environment variable to include Cargo’s bin directory (at $HOME/.cargo/bin).
source $HOME/.cargo/env
5. Check Rust version on Debian 11
After following the steps to install Rust version on Debian 11 bullseye, we can check which version of this programming language is on our system.
rustc --version
6. Start using Rust code
Let’s create a file and type some simple RUST code to get a simple program.
Create a directory for your project:
mkdir myproject
Create a File:
nano mycode.rs
Using the above command we are creating a file with Rust extension, in this file paste the following code:
fn main() { println!("Hi, Here is How2shout portale for Linux!"); }
Save the file by pressing Ctrl+O, hit the Enter key and then Ctrl + X to exit the file.
Compile and run the program:
rustc mycode.rs
Now, run the app you have compiled using Rust command tool. The executable app name will be of same as the file you have created.
./mycode
To know further about it and learn this programming language, refer to its offcial documentation.
Other Articles:
• Install the latest R Programming Language version on Debian 11
• How to create, compile & run a C Program in Linux terminal
• Install Python 3.x or 2.7 on Debian 11 Bullseye Linux
• Two ways to Install Eclipse IDE in AlmaLinux & Rocky Linux 8