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 https://sh.rustup.rs -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
.

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

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
Output
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 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!
Now Rust is installed on your Ubuntu and you can create your blazing fast project using Rust language.