Hey guys, are you searching tutorial for Rust download and installation on Windows and Linux operating systems - If yes then you have come to the right place. In this article we'll guide you step by step through which you will be able to download and install rust on your Windows and Linux operating system but before performing this tutorial let's take a overview of Rust programming language.
What is Rust?
Rust is modern, simple and powerful programming language which is designed and developed by a programmer of Mozilla Research, Graydon Hoare. Rust programming language was designed in the year 2006 and on 7 July 2010 Rust programming language was publically introduced. Rust programming language is developed as an open source programming language and was licensed under MIT or Apache 2.0 license. Rust programming language is statically typed programming language which provides the feature of internal memory management. The syntax of Rust programming language are quite similar to the syntax of C programming language. Rust is a multi paradigm programming language as it supports different programming paradigms and programmers can use Rust programming language for developing different applications, browser components, operating systems, game engines and file systems, etc.
Now, let's discuss the tutorial for download and install Rust on Linux operating system.
Rust download and installation on Linux
Downloading and installing rust on Linux operating system is a very easy task. All you have to do is enter the following command in terminal;
$ curl https://sh.rustup.rs -sSf | sh
As you enter the above command in terminal, the command will download a script to install Rust on your system. Wait for a while until rust is completely installed on your linux os. After successful installation a message will appear in your terminal which will look something like this;
Rust is installed now. Great!
If you see such message, then it means rust has been successfully installed on your linux. And with this method you can also download and install Rust in macOS and Unix operating system.
Now, we will discuss about how to download and install Rust programming language on Windows PC.
Rust download and installation on Windows
Here, we will learn step by step guide to download and install Rust on Windows operating system;
• Download RUSTUP-INIT.exe
First of all, go to Rust download windows dashboard then choose the Rustup-inti.exe file to download - According to your system compatibility (32-bit or 64-bit).
Now, just click on "Save" button to download Rustup-inti.exe file.
• Install rust via rustup-inti command line
It's time to install rust-lang on windows via command line. For this, go to downloads folder and simply click on "Rustup-inti.exe" downloaded file. After clicking on this file, the command line of Rustup-inti.exe will open directly on your computer screen where you have to type Y and press enter to install rust.
Now, here you will get all the details related rust installation package like cargo home directory location, Cargo's bin directory location and path registry key - just type 1 in command line and press enter to proceed with installation.
Wait a few seconds while all the required files are downloading. After all the directories are downloaded successfully, this type of message will appear on your screen.
Rust is installed now. Great!
Huraahh!! Rust is successfully installed on your windows PC. Now press enter key to exit RUSTUP-INIT.exe command prompt.
• Check with commands
Now, its time to check rust with commands. For that, just go to windows menu then search for "command prompt" and open it.
- to check all cargo commands, just type this on command line;
cargo
And press "Enter" key. Now you will see the complete list of cargo commands on the command line.
- Now just type this on command line;
rustc
To see this kind of output;
- And finally, type this on command line;
rustup
To see this type of output;
• Create and new project directory
Now, it's time to create project directory for rust. For that, go to command line and type
cd desktop
- to make new rust directory just type this on command line;
mkdir rustbox
- Now, again you have to create new directory inside rustbox. Firstly give command for open rustbox directory;
cd rustbox
- After that, to create new demo bin directory just type this;
cargo new demo --bin
And press "Enter". Now, you will see new binary application directory (demo package) is created successfully!!
• Run Hello world in Rust on Command line
- Here, you have to open the demo directory on command line. For that just type;
cd demo
- then;
dir
Now, let's print Hello world in Rust
Note: You need to have Visual Studio Code pre-installed on your PC in order to print hello world at the command prompt.
- Type this on command line to open Visual studio code directly;
code -
After doing this, this helloworld file will be generated automatically. now just come back to command line
- And now, type this on command line to run this file;
cargo run
Here, you will see that compiling this file has started . After a few seconds, your file will be successfully compiled and hello world will be printed on your screen.
Conclusion
Above we have discussed tutorial for Rust download and installation on Windows and Linux operating systems. Rust is modern, simple and powerful programming language which is designed and developed by a programmer of Mozilla Research, Graydon Hoare. Rust programming language was designed in the year 2006 and on 7 July 2010 Rust programming language was publically introduced. Rust programming language is developed as an open source programming language and was licensed under MIT or Apache 2.0 license. Rust programming language is statically typed programming language which provides the feature of internal memory management. By following these above mentioned steps anyone can easily download and install Rust on Linux and windows operating system. I hope this information is helpful to you all.