Hello, friends. We know that many developers use Fedora as a system to work with. So, it is convenient for you to know how to install Rust Programming Language on Fedora 34.
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 Programming Language on Fedora 34
The installation is quite simple to perform through the terminal. To do this, first, make sure that the distribution is up to date.
So, open a terminal and run
sudo dnf update
After that you should install the development and build tools for this our post will help you.
After that, you can install the curl
and nano
packages with which we can complete the post.
sudo dnf install nano curl
Now proceed to download and run the installation script provided by the Rust developers.
curl https://sh.rustup.rs -sSf | sh
During the execution of the script, we will be asked about the type of installation. In this case, choose option 1.
Then the whole installation process will continue and at the end, you will see the following screen:
This way the installation has been completed successfully. To make Rust available from the terminal without any problems run
source $HOME/.cargo/env
Now we are ready to try Rust. We are ready to test Rust, for example, show the installed version.
rustc --version
rustc 1.53.0 (53cb7b09b 2021-06-17)
Your first program with Rustc
Now to check that everything is OK we need to create a program. We will do the classic “Hello World”.
First, create the necessary directory structure and access it.
mkdir ~/projects
cd projects
mkdir example
cd example
Obviously, you can change the names and adjust them to your preferences.
Now create the code file
nano helloworld.rs
And add the following code:
fn main() {
println!("Hello, thanks for visiting Osradar blog.");
}
Save the changes and close the editor.
Now compile the program
rustc helloworld.rs
And run it
./helloworld
Hello, thanks for visiting Osradar blog.
So, Rust is installed.
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.