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

Windows Articles

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...

How to finish a task and force to close a program in Windows 10

Hello! We use numerous applications in Windows 10 on a daily basis. However, these programs can fail and crash. That is, it...
angeloma
angeloma
Senior Writer and partner

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.

:~$ 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.

Conclusion

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.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...

How to finish a task and force to close a program in Windows 10

Hello! We use numerous applications in Windows 10 on a daily basis. However, these programs can fail and crash. That is, it...
x