Saturday, September 24, 2022

How To Set up Rust Programming Language on Centos 7

In this article, we want to teach you How To Set up Rust Programming Language on Centos 7.

Rust is a low-level statically-typed multi-paradigm programming language that’s focused on safety and performance.

Rust solves problems that C/C++ has been struggling with for a long time, such as memory errors and building concurrent programs.

It has three main benefits:

  • better memory safety due to the compiler;
  • easier concurrency due to the data ownership model that prevents data races;
  • zero-cost abstractions.

Here are some of Rust’s use cases:

  • Powerful, cross-platform command-line tools.
  • Distributed online services.
  • Embedded devices.
  • Anywhere else you would need systems programming, like browser engines and, perhaps, Linux kernel.

For example, here are a few operating systems, written in Rust: Redox, intermezzOS, QuiltOS, Rux, and Tock.

How To Set up Rust Programming Language on Centos 7

Before you start to set up Rust on Centos 7, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Centos 7.

Now follow the steps below to install Rust Programming Language on Centos 7.

Install Rust Programming Language on Centos 7

First, you need to update your local package index with the following command:

sudo yum update -y

Then, install the Epel repository on your server with the command below:

sudo yum install epel-release

Now you need to install the required packages on your server:

sudo yum install cmake gcc make curl -y

At this point, use the curl command to download the Rust installer script on Centos 7:

curl --proto '=https' --tlsv1.2 -sSf | sh

In your output you will see:

Current installation options:

default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation

Enter 1 to proceed with the installation.

Next, configure your current shell with the command below:

source $HOME/.cargo/env

To verify that the Rust programming language is installed successfully on your Centos 7, run the command below:

rustc -V
rustc 1.60.0 (7737e0b5c 2022-04-04)

Create a sample Rust Programming language Application

At this point, you can create a sample Rust project on Centos 7.

First, you need to create a directory for your Rust project:

mkdir rust-projects

Switch to your Rust directory:

cd rust-projects

Now you need to create a sample application with your favorite text editor, here we use vi:


Add the following content to the file:

fn main() { 
println!("Hello World, this is a test provided by"); 

When you are done, save and close the file.

Here you need to compile your program with the command below:


This will create an executable application after it has finished compiling.

To run the application you created using Rust on Centos 7, run the program with the execute command:

Hello World, this is a test provided by

Also, you can update your Rust programming language with the following command:

rustup update

If you no longer want to use Rust on Centos 7, you can easily remove it with the following command:

rustup self uninstall
Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
$HOME/.cargo/bin from your PATH environment variable.

Continue? (y/N)


At this point, you learn to Set up Rust Programming language on Centos 7.

Hope you enjoy it.

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles


Most Popular