Google Cloud

How to Install Rust on Ubuntu 20.04 LTS

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to Install Rust on Ubuntu 20.04 LTS. Rust is fast and memory efficient with no runtime or garbage collector and easily integrate with other languages.

In this guide you are going to learn how to install Rust language on Ubuntu 20.04 LTS and create a Rust project.

This tutorial is tested on Google Cloud Platform, so it will work fine on other cloud hosting providers like AWS, Azure or any VPS or Dedicated servers.

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Install Rust

SSH to your Ubuntu system or server and start by updating the packages list to the latest version available.

sudo apt update
sudo apt upgrade

By default Rust is included in the Ubuntu 20.04 repositories, so you can install Rust directly using the apt install command.

Execute the following command to install Rust.

sudo apt install rustc

Now Rust and the required dependencies will get installed.

Once the installation is completed you can verify the version of Rust installed in your Ubuntu using the following command.

rustc --version

rustc 1.41.0

Create a Rust Project

Once Rust is installed you can create your first project.

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

Create a new file with the .rs extension. If you are using more than one word for your file name you need to use underscore instead of

sudo nano

Paste the following code inside the new file.

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

Hit Ctrl + X followed by Y and Enter to save the file.

Now compile and run the program.


You will see the output of your Rust code.

Hello, world!

That’s it. Enjoy your Rust installation.


Now you have learned how to install Rust on Ubuntu 20.04 and create a project in Rust language

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

1 Comment

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.