DEV Community

El Bruno for Microsoft Azure

Posted on • Originally published at elbruno.com on

#Rust โ€“ Install Rust and Hello World ๐ŸŒ in #RaspberryPi

Hi !

Quick post today on how to install rust in a Raspberry Pi, and later create a hello world test app.

Install Rust

Iโ€™m starting this with the latest updates for Raspberry Pi OS installed.

current raspberry pi os installed

The command to install rust is this one:


curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Enter fullscreen mode Exit fullscreen mode

Check the Rust Lang documentation for more details.

Letโ€™s choose the default installation, this may take a couple of minutes.

And now, we can check the rust and cargo versions with the following commands


rustc --version
cargo --version

Enter fullscreen mode Exit fullscreen mode

checking rust and cargo versions with command line

Hello World project

Now letโ€™s use cargo to create a new project. Iโ€™ll name it โ€œDemoBlogPostโ€. In the following image, we can check the default contents of the project

  • cargo.toml
  • src/main.rs

createing a new project with cargo and check the generated files

Time to edit the main.rs file. Iโ€™m not a VIM user, so itโ€™s nano time.

editing the main rs file with nano

And now, time to run the project !

Super fun and literally a great way to use a device like a raspberry pi to learn Rust !

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


Top comments (0)