How to Install Rust on Ubuntu 20.04

Install Rust on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and set up Rust on Ubuntu 20.04. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Rust is fast and memory-efficient with no runtime or garbage collector and easily integrates with other languages. The main characteristics of Rust are performance, reliability, and productivity. Rust can compile and create applications very quickly; it is conducive to very few failures and its large documentation makes it possible to learn quickly.

Install Rust on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install Rust.

Execute the following command to install Rust Programming Language:

sudo apt install rustc

Once the installation is completed you can verify the version using the following command:

$ rustc --version
rustc 1.41.0

Step 3. Create Rust Project.

Now we create your first project:

mkdir ~/projects
cd ~/projects
mkdir hello_world
cd hello_world

Create a new file with the .rs extension. Example:

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

Then, compile and run the program:


Result output of your Rust code:

Hello, world!

That’s all you need to do to install Rust Programming Language on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. Don’t forget to share your valuable queries/suggestions in the below comment box & also drop your worthwhile feedback.