Rust-Programming-Language/C2/Installation-of-Rust-on-Linux/English

From Script | Spoken-Tutorial
Revision as of 17:36, 5 March 2025 by Nirmala Venkat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Visual Cue Narration
Show Slide:
Title Slide
Welcome to the Spoken tutorial on Installation of Rust on Linux.
Show Slide:
Learning Objectives
In this tutorial, we will learn how to
  • Install Rust on Ubuntu Linux
  • Set up an Integrated Development Environment
  • Run a “Hello -World” Rust program
Show Slide:
System Requirements
To record this tutorial, I am using
  • Ubuntu Linux OS version 22.04
  • Visual Studio Code
Show Slide:
Installation Requirements
For the installation of Rust
  • A working internet connection is required
Show Slide:
About Rust
  • Rust is a systems programming language and similar to C++
  • It prioritizes performance, memory safety, and parallelism.
  • Rust offers features like guaranteed memory safety without needing a garbage collector.
Open the terminal by pressing ctrl alt and t keys simultaneously.
> curl --version
>sudo apt install curl
First we need to check whether curl is installed in our system
For that, Type curl --version
If you see information about curl, it means curl is installed.
If you get an error, you have to install curl.
Type, sudo apt install curl
Enter the password if prompted.
Type curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Once curl is installed, type the follow
ing command.
You will see a list of options.
Press 1 to proceed with default installation.
This will install modules and packages like cargo, rustfmt, clippy.
These will be useful for development and writing code.
Next, we will set up an Integrated Development Environment(IDE).
Open web browser

Type https://code.visualstudio.com</u>

Open any web browser.
In the address bar type this link.
Visual Studio code page opens.
Let us download and install Visual Studio Code.
Click on the Download button
Click on .deb for Ubuntu.
Click on the Download button on the top right corner of the window.
You can see options for various operating systems.
I will download a .deb file for Ubuntu.
Right click on the file select open with software install.
Click on the install button.
Type the system password.
Let us go to the Downloads folder and locate the .deb file.
Right click on the file and select open with software install.
Click on the install button.
Enter the system password to authenticate.
Once the installation is complete, close the window.
Let us open the Visual Studio code.
Go to Show Applications on the bottom left of your screen.
In the search bar, type Visual Studio code.
Click on Visual Studio Code to open the window.
Locate rust-analyzer and click on Install button.
On the left toolbar, click on Extensions icon
The Extensions panel opens.
In the Search bar type, rust-analyzer and Press Enter
A list of options will appear.
Locate rust-analyzer and click on Install button.
Once the installation is complete a blue tick mark appears.
Rust analyzer extension is used to autocomplete the code.
It makes the code more readable.
In the terminal, type
> rustc –version
1.79.0
We can verify the installation by running these commands on the terminal:
rustc --version
We can see the Rust compiler version that has been installed.
>cargo –version
Type,
cargo --version
This will show the package manager and build system version.
> rustup –version
Type
rustup --version
This shows the rustup toolchain manager version.
.
You have to restart the system after the rust installation is completed.
After installing Rust and its extensions, it is important to understand a few key components:
They are Rust compiler, Cargo, and the Toolchain Manager.
Slide:
Rust Compiler
Now we will learn about Rust Compiler.
  • rustc is the Rust compiler
  • It is responsible for translating the Rust code into executable binaries.
  • This process involves checking for errors and optimizing your code for performance.
Rustup: The Toolchain Manager
  • Rustup is a toolchain manager that helps to manage Rust versions and tools.
  • It allows you to easily install and switch between different versions of Rust.
Open the text editor
fn main() {
println!("Hello, World!");
}
Now, let's write our first Rust program.
Open the text editor.
Type the following code.
Highlight according to narration
In this program, we will print “Hello, World!”
Save the file by pressing Ctrl + S.
Type the file name as Helloworld.rs and save it on the Desktop.
>cd Desktop
> rustc Helloworld.rs
> ./Helloworld
Switch back to the terminal.
Go to the folder where we have saved the rust program
Type cd Desktop
Then type,
rustc Helloworld.rs
This will compile the program.
Type ./Helloworld to run the program.
We can see the output: Hello, World!
This shows we have successfully installed Rust and compiled and executed a program.
Show Slide:
Summary
This brings us to the end of this tutorial.
Let us summarize.
In this tutorial, we have learnt to
  • Install Rust on Ubuntu Linux
  • Set up an Integrated Development Environment
  • Run a “Hello -World” program
Show Slide:
About Spoken Tutorial Project
The video at the following link summarizes the Spoken Tutorial Project.
Please download and watch it.
Show Slide:
Spoken Tutorial Workshops
The Spoken Tutorial Project team conducts workshops and gives certificates.
For more details, please write to us.
Show Slide:
Answers for THIS Spoken Tutorial
Do you have questions in THIS Spoken Tutorial?
Please visit this website.
Choose the minute and second where you have the question.
Explain your question briefly.
The Spoken Tutorial project will ensure an answer.
You will have to register to ask questions.
Slide : Forum for specific questions
The Spoken Tutorial forum is for specific questions on this tutorial.
Please do not post unrelated and general questions on them.
This will help reduce the clutter.
With less clutter, we can use these discussions as instructional material.
Show Slide:
Acknowledgement
The Spoken Tutorial Project was established by the Ministry of Education, Government of India.
Show Slide:
Acknowledgement
We would like to thank Vishal Pokuri from VIT Vellore for content contribution.
Show Slide:
Thank you
This tutorial is contributed by Nirmala Venkat and Ketki Bhamble from the spoken tutorial team.
Thank you for joining.

Contributors and Content Editors

Madhurig, Nirmala Venkat