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
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.
After the installation is complete, it is necessary to refresh the Shell profile. Because during the process the compiler and other things are installed.
Just run:
:~$ source $HOME/.cargo/env
Then, verify the Rust version.
:~$ rustc --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
Now, create the file.
:~$ nano helloworld.rs
Then, add the following.
fn main() { println!("Hello, thanks for visit Osradar blog."); }
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
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.