How To Install Rust on Fedora

Hello, friends. Today, you will learn how to install Rust on Fedora.

As we all know, Rust is one of the most popular languages nowadays. Many people dare to say that it is the natural heir of C++ for many projects, and it has even started to be present in the Linux kernel.

The truth is that Rust is a marvel for its speed, efficiency, support, and flexibility. In addition, cargo is a great package manager that is a kind of PIP but for Rust.

If you are a programmer or are taking your first steps in it, take a look at rust and learn how to install it on a system as versatile as Fedora.

Install Rust on Fedora

Unfortunately, Rust is not present in the official Fedora repositories. But this doesn’t mean that it can’t be easily installed.

In short, there is an installation script provided by the creators of Rust that would make installing it a piece of cake.

So, open the Fedora terminal and make sure the system is fully up-to-date.

sudo dnf update

Although it is not mandatory, it is recommended to install some packages to improve the Rust experience.

sudo dnf groupinstall "Development Tools"

Next, you can download and use the Rust installation script. To achieve this, simply run.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

In the menu that pops up, you will have to choose option 1, which is the most recommended option.

Install Rust on fedora
Install Rust on fedora

Now you have to be patient because the script will download and configure Rust on your computer automatically.

Rust Installed on the system
Rust Installed on the system

At the end, you will be able to verify the compiler and language version.

rustc --version

You will get an output screen similar to this

rustc 1.70.0 (90c541806 2023-05-31)

All that remains is to update the Rust environment variables so that you can use it in all terminal locations.

source "$HOME/.cargo/env"

Testing Rust on Fedora

There is no point in having Rust and not testing it, so the best way to find out if the whole process went well is to test it.

First, create a file with some Rust code.

vim hello.rs

And add this

fn main() {
println!("Hello, world!"); 
}

Compile the source code

rustc hello.rs

And then run it

./hello
Testing Rust on Fedora
Testing Rust on Fedora

Conclusion

Rust is a popular language and knowing how to install it is an important step to get to know it. Furthermore, with Fedora, which has a good reputation among developers, makes the perfect combination.

Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook