Categories: TutorialsUbuntu

How to Install Rust Programming Language on Ubuntu 20.04

Rust is a popular, open-source high-level programming language that was developed in 2006. It is designed for high performance and reliability while emphasizing on the code’s safety. Rust’s syntax is similar to that of C++ and it is used to build a wide range of applications such as operating systems, game engines, browser components, and much more

Among the big tech giants that use Rust in their applications include Dropbox, Firefox, and Cloudflare. This guide will show you how to install Rust programming language on Ubuntu 20.04.

Step 1: Update system

First, let’s start by updating the system packages on Ubuntu 20.04. Execute the command:

$

Sponsored
sudo apt update && sudo apt upgrade -y

Step 2: Download and Install Rust

Now we are ready to install Rust. Download the Rust installation script from the official site using the following curl command.

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

The command downloads a script and launches the rustup tool, which installs the latest stable version of Rust. The following screen with details about the rust installation will appear.

You will be prompted to choose an option in order to continue with the installation. Type 1 and press enter to proceed.

The complete installation should take around a minute. Once successfully completed, you will see the following output:

To confirm the successful installation of Rust, verify the version installed. Execute the command:

$ rustc --version

Keep in mind that you will need to activate the Rust environment for your current shell. To enable the rust environment, run:

Sponsored
$ source ~/.profile
$ source ~/.cargo/env

Testing the Rust Installation

We will run a simple hello world script to make sure rust is properly installed and configured on our machine.

$ mkdir ~/projects
$ cd projects

First, create a new folder to store the rust sample file. Create a file and add

Now, create the file.

$ sudo nano hello.rs

Then, append the following lines to the file:

fn main() {

 println!("Hello, World!");

}

Save the file. Thereafter, compile the rust file as shown:

$ rustc hello.rs

After that, an executable file will be created.

Now run the file to view the output of your program.

$ ./hello

The output ‘Hello World’ will be displayed.

Rust is now successfully installed. You can now start developing programs using Rust language on your Ubuntu system.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago