We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

How to Install Rust on Ubuntu 20.04 LTS

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

Output
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 hello_world.rs instead of helloworld.rs

sudo nano hello_world.rs

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.

rustc hello_world.rs 
./hello_world

You will see the output of your Rust code.

Hello, world!

That’s it. Enjoy your Rust installation.

Conclusion

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.

Cart

Your Cart is Empty

Back To Shop