Google Cloud

Install Rust on Ubuntu 18.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.

Install Rust on Ubuntu 18.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 18.04 LTS and create a project.

You can install Rust on the following platforms also.

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

Install Rust Programming Language

SSH to your Ubuntu system or server and download Rust using rustup

sudo apt update
sudo apt upgrade

curl -sSf | sh

Now Rust will be downloaded and you will get a prompt to choose the installation options.

Choose Proceed with Installation (default) and hit Enter.

Install Rust on Ubuntu

Now latest stable version of Rust will get installed and you will get a confirmation similar to the one below.

Rust Installed on Ubuntu

The installation script automatically adds Rust to your system path after your next login to SSH. If you need to use Rust immediately without restarting terminal you can add Rust to path manually.

source $HOME/.cargo/env

Now you can verify the version of Rust installed in your Ubuntu.

rustc --version

rustc 1.31.1 (b6c32da9b 2018-12-18)

Install Build Tools for Rust

Rust program needs to be complied before running the file. So you need to install build-essentials

sudo apt install build-essential

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!

Now Rust is installed on your Ubuntu and you can create your blazing fast project using Rust language.

Write A Comment

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