The following instructions are for setting up a student machine for the course. There are instructions for Linux, macOS, Windows, and Windows WSL 2. Also, all students will need to create a GitHub account.
These instructions provide a minimal setup for the course. During the course other software and code libraries will be installed. Students will need local admin and network access on their machines.
These instructions will ensure you have Rust installed, Visual Studio Code installed, a Rust debugging environment, and the ability to install crates with Cargo.
Complete the setup appropriate for your machine. We will be using a tool named Valgrind in the class. Valgrind does not work on Windows. If you are using Windows, you will need to use Windows Subsystem for Linux 2 (WSL 2) to run Valgrind.
- Jump to: Linux
- Jump to: macOS
- Jump to: Windows
- Jump to: Windows WSL 2
During the course additional Rust tools and crates will be installed. Also, depending on your operating system additional software may be required. Students will need local admin and network access on their machines.
Also, for courses which include bare metal programming, each student will need a Microbit V2. The Microbit V2 is a small microcontroller board that can be programmed in Rust. The Microbit V2 can be purchased from various online retailers.
Before purchasing, verify if your employer or the trainer will be providing the device for you. The link above is NOT an Amazon affiliate link.
-
To access the courseware for the class, all students will need to create a GitHub account. If you do not already have a GitHub account, please create one at https://www.github.com. Please know your GitHub username and password on the first day of class.
Note: GitHub Enterprise accounts will not work. You must have a personal, public GitHub account.
-
Install software development packages.
sudo apt install -y build-essential cmake pkg-config
-
Open a terminal window, and run the following command to install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Close all terminal windows.
-
Open a new terminal window, and create a new Rust project in the home folder.
cargo new test_config
-
Change to the new project folder.
cd test_config -
Build the project.
cargo build
-
Run the project.
cargo run
-
Verify you can install crates with Cargo. The installation should proceed without error.
cargo add serde
-
Download the appropriate Visual Studio Code installer for your Linux distribution: https://code.visualstudio.com/download
-
Install Visual Studio Code on Linux.
-
Open Visual Studio Code.
-
Using the main menu, under the
Filemenu, selectOpen Folder...and open thetest_configfolder. -
On the left-hand side of Visual Studio Code, there is a vertical Activity Bar with icons. Click on the squares icon to open the Extensions view.
-
At the top of the Extensions view you will see a search box. In the extension search box, search for the
rust-lang.rust-analyzerand install it. Then, search for thevadimcn.vscode-lldbextension and install it. -
Once installed, you should be able to click
RunandDebugin Visual Studio Code above themainfunction of thetest_configproject.
-
Open a terminal window, and install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Close all terminal windows.
-
Open a new terminal window, and create a new Rust project in the home folder.
cargo new test_config
-
Change to the new project folder.
cd test_config -
Build the project.
cargo build
-
Run the project.
cargo run
-
Verify you can install crates with Cargo. The installation should proceed without error.
cargo add serde
-
Download the Visual Studio Code installer: https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal
-
Install Visual Studio Code on macOS.
-
Open Visual Studio Code.
-
Using the main menu, under the
Filemenu, selectOpen Folder...and open thetest_configfolder. -
On the left-hand side of Visual Studio Code, there is a vertical Activity Bar with icons. Click on the squares icon to open the Extensions view.
-
At the top of the Extensions view you will see a search box. In the extension search box, search for the
rust-lang.rust-analyzerand install it. Then, search for thevadimcn.vscode-lldbextension and install it. -
Once installed, you should be able to click
RunandDebugin Visual Studio Code above themainfunction of thetest_configproject.
-
Download the Rust installer: https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe.
-
Run the
rustup-init.exefile. -
It may prompt you to install the Microsoft C++ build tools. If so, please install then proceded with the Rust installation.
-
Close all terminal windows, and open a new PowerShell or Windows Command Prompt terminal window, and create a new Rust project in the home folder.
cargo new test_config
-
Change to the new project folder.
cd test_config -
Build the project.
cargo build
-
Run the project.
cargo run
-
Verify you can install crates with Cargo. The installation should proceed without error.
cargo add serde
-
Download the appropriate Visual Studio Code installer: https://code.visualstudio.com/download
-
Install Visual Studio Code on Windows.
-
Open Visual Studio Code.
-
Using the main menu, under the
Filemenu, selectOpen Folder...and open thetest_configfolder. -
On the left-hand side of Visual Studio Code, there is a vertical Activity Bar with icons. Click on the squares icon to open the Extensions view.
-
At the top of the Extensions view you will see a search box. In the extension search box, search for the
rust-lang.rust-analyzerand install it. Then, search for thevadimcn.vscode-lldbextension and install it. -
Once installed, you should be able to click
RunandDebugin Visual Studio Code above themainfunction of thetest_configproject.
-
Ensure two optional features for Windows are installed.
- Virtual Machine Platform
- Windows Subsystem for Linux
To verify and install them, run the following command from a terminal window.
optionalfeatures
If features are installed, you will need to reboot.
-
Install and Configure WSL 2: https://docs.microsoft.com/en-us/windows/wsl/install. Open a Windows Powershell terminal, and run the following command.
wsl --install
Your computer may need to be rebooted after installation is complete.
-
Open a Windows Powershell terminal, and verify WSL version and Ubuntu are configured properly.
wsl -l -v
-
Open a Windows WSL 2 Ubuntu terminal window, and install Build Essentail packages.
sudo apt install build-essential
-
Install Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Close all terminal windows.
-
Open a new WSL 2 terminal window, and create a new Rust project in the home folder.
cargo new test_config
-
Change to the new project folder.
cd test_config -
Build the project.
cargo build
-
Run the project.
cargo run
-
Verify you can install crates with Cargo. The installation should proceed without error.
cargo add serde
-
On Windows (not within WSL), download the appropriate Visual Studio Code installer: https://code.visualstudio.com/download
-
Install Visual Studio Code on Windows.
-
Open Visual Studio Code.
-
On the left-hand side of Visual Studio Code, there is a vertical Activity Bar with icons. Click on the squares icon to open the Extensions view.
-
At the top of the Extensions view you will see a search box. In the extension search box, search for the extension with id
ms-vscode-remote.remote-wsl. Click the Install button. -
Open Visual Studio Code. Open the command palette by pressing
Ctrl+Shift+P. In the command palette, typeWSL: Connect to WSL, and press enter. -
Open the command palette by pressing
Ctrl+Shift+P. In the command palette, typeWSL: Open Folderand select the option to open the folder in WSL. -
Select the
test_configfolder in the WSL environment. If prompted, trust the folder. -
Review the locally installed extensions, and click the
Install in WSL: Ubuntublue button for the following extensions.rust-lang.rust-analyzervadimcn.vscode-lldbtamasfe.even-better-toml
-
Once installed, you should be able to click
RunandDebugin Visual Studio Code above themainfunction of thetest_configproject.