## Tutorial ##

How To Install Rust Lang on Linux

Published on March 08 2023 · Updated on March 08 2023

In this tutorial, we will show the steps to install Rust Lang on Linux. These steps can be followed on Ubuntu, AlmaLinux, Rocky Linux.

Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.

Rust or rust-lang is a general-purpose programming language for system-level development projects. Rust is known for its speed, memory efficiency, seamless integration with other languages, and type safety.

We have covered installation and configuration of the Rust Lang on Linux.


  • A Linux OS installed dedicated server or KVM VPS.
  • A root user access or normal user with sudo privileges.

Step 1 - Install Dependency

Run the following command in your terminal then follow the on-screen instructions.

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

Here, you can proceed with default installation or customize it. For default installation, type 1 and enter.

       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

Once the installation gets done, it will ask you to restart your current shell.

Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:

source "$HOME/.cargo/env"

Step 3 - Verify the Installation

Execute rustc with the -V argument to check the version of the Rust and also to confirm the installation.

rustc -V


rustc 1.67.1 (d5a82bbd2 2023-02-07)

Step 4 - Write Hello World! Program

This is the source code of the traditional Hello World! program.

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

A binary can be generated using the Rust compiler: rustc.

rustc hello.rs

rustc will produce a hello binary that can be executed.



Hello World!

We have seen, how to install Rust Lang on Linux. Here is the Rust Lang official Documentation.

Related Tutorials

Install Fiber Server with Golang on AlmaLinux 9 - HostnExtra

We will show how to install Fiber Server with Golang on AlmaLinux 9. It is a Go web framework built on top of Fast http, the fastest HTTP engine for Go.

How To Install Docker on Ubuntu 22.04 - HostnExtra

We will show how to install Docker on Ubuntu 22.04. Docker Engine is an open source containerization technology. It acts as a client-server application.

How To Install RubyGems on Ubuntu 22.04 - HostnExtra

We will show the steps to install RubyGems on Ubuntu 22.04 using source code.allows you to easily download, install, and use ruby software packages.