23.8 C
Senior Writer and partner

How to install Rust Programming language on Ubuntu 20.04 / Debian 10?

Learning programming languages is a good option to find a good job. Above all, if you dedicate yourself to this. Because for no one is a secret that we live in times where many applications are used. That’s why this post will teach you how to install Rust on Ubuntu 20.04 / Debian 10.

Rust is an open source, multipurpose and new programming language that aims to retire to the C language. Although it is sponsored by Mozilla and Samsung, it is a community project. Its focus is primarily on large programs that run on the client and server side.

The main characteristics of Rust are performance, reliability, and productivity. Rust can compile and create applications very quickly; it is conducive to very few failures and its large documentation makes it possible to learn quickly.

Install Rust on Ubuntu 20.04 / Debian 10

Installing Rust is easy thanks to rustup. In fact, it is the recommended way to install Rust, as there are other ways to do it. All you have to do is run the following command.

- Advertisement -
:~$ curl https://sh.rustup.rs -sSf | sh

1.- Download the Rust installation script
1.- Download the Rust installation script

Note: If you don’t have curl installed, you can do it from the terminal. For example, in Ubuntu and Debian a sudo apt install curl is sufficient.

In the installer, you will be asked if you want to keep the default values in the installation or if you want to customize them. Choose option 1 to use the default values and avoid further complications.

2.- Running the installation script
2.- install Rust

After the installation is complete, it is necessary to refresh the Shell profile. Because during the process the compiler and other things are installed.

3.- Rust is installed
3.- Rust is installed

Just run:

:~$ source $HOME/.cargo/env

Then, verify the Rust version.

:~$ rustc --version

4.- Check the Rust version
4.- Check the Rust version

Create a Hello World file

The best way to prove that Rust is properly installed and configured on your computer is to create and run a Rust file. I’ll do the typical Hello World.

First, create a folder that will serve as Workspace, in it create another folder where the file in question will be.

:~$ mkdir ~/projects
:~$ cd projects
:~$ mkdir example
:~$ cd example

5.- Creating the workspace for Rust
5.- Creating the workspace for Rust

Now, create the file.

:~$ nano helloworld.rs

Then, add the following.

fn main() {
    println!("Hello, thanks for visit Osradar blog.");

6.- Create a Hello World file
6.- Create a Hello World file

Save and close the file.

Next, compile the rust file.

:~$ rustc helloworld.rs

After that, a file will be created that is the executable of the code.

Finally, run the file.

:~$ ./helloworld

7.- Compile and run the file
7.- Compile and run the file

And that’s it.


Installing the Rust language in Linux is a fairly simple process. The possibilities offered by this language are many. It is also a great alternative to traditional programming languages.

Please share this article with your friends. So, don’t forget to join our Telegram Channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article