Installing Rust on Ubuntu & Fedora

Standard

Rust, commonly known as Rust-Lang, is a system programming language that is developed by Mozilla and backed by LLVM. Rust is known for preventing program crashes, memory leaks, and data races before it is compiled into binary, thus creating a highly-productive and stable programming environment. This article will show you how to install Rust onto Ubuntu 14.04 x64, 16.04 x64 and Fedora box.

Let’s setup on Ubuntu :

System Update

Open terminal and run the following commands to ensure that package source list is upto date and also install curl

For Ubuntu 16.04

sudo apt update && sudo apt -y install curl

For Ubuntu 14.04

sudo apt-get update && sudo apt-get -y install curl

Install Rust

Installing Rust is a simple process. Run the following command to launch their installation script.

curl -sSf https://static.rust-lang.org/rustup.sh | sh

When the script finishes, Rust will be installed.

Verifying Rust

To verify that Rust was successfully installed on your Linux box, run rustc -V. You will see output similar to:

rustc 1.16.0 (30cf806ef 2017-03-10)

Let’s get started with Rust :

To use Rust, create a file called main.rs with your favorite text-editor and populate it with the following lines of code:

fn main() {
    println!("Hello World!");
}

Running Hello World the “learning” way

Let’s setup on Fedora :

Install Rust

In order to install the Rust compiler, type:

$ sudo dnf install rust

This will install the compiler (rustc), standard library, gdb support and a documentation generator (rustdoc).

To compile the Rust source code, type:

$ rustc hello.rs

This will produce an executable file named hello

Hope you enjoyed my blog. Don’t Forget To Share It With Your All Tech Friends..!! 🙂


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *