Installation of Rust on Windows System
To install the Rust toolchain, you will need to have a few things installed on your system:
- A recent version of the Rust compiler, which you can download from the official Rust website at https://www.rust-lang.org/tools/install.
- A supported version of the Rust package manager, Cargo. This will be installed along with the Rust compiler.
To install Rust, follow these steps:
- Download the Rust installer from the official Rust website: https://www.rust-lang.org/tools/install
- Run the installer and follow the prompts to install Rust.
- Once the installation is complete, you can check that the Rust compiler and Cargo are installed and working by opening a terminal and running the following command:
rustc --version
cargo --version
This should print the version numbers of the Rust compiler and Cargo.
Installation Of Rust on Linux System
To install Rust on a Linux system, you have a few options:
- Use the Rust installer:
- Download the Rust installer from the official Rust website at https://www.rust-lang.org/tools/install
- Run the installer and follow the prompts to install Rust.
- Use the Rustup tool:
Rustup is a command-line tool that makes it easy to install and manage multiple versions of Rust, as well as install additional tools such as the Rust debugger (rls
) and the Rust package manager (Cargo). To install Rustup:
- Visit https://rustup.rs
- Follow the instructions to download and run the Rustup installer.
- When prompted, choose the default installation options. This will install the latest stable version of Rust and set it as the default.
- Use your system’s package manager:
On most Linux systems, you can use the system’s package manager to install Rust. For example, on Debian-based systems you can use apt
to install Rust with the following command:
sudo apt-get install rustc
On CentOS and Fedora, you can use yum
to install Rust with the following command:
sudo yum install rust
On openSUSE, you can use zypper
to install Rust with the following command:
sudo zypper install rust
Once Rust is installed, you can check that it is working by opening a terminal and running the following command:
rustc --version
cargo --version
This should print the version numbers of the Rust compiler and Cargo like below example
PS C:\Users\USER> rustc --version
rustc 1.66.0 (69f9c33d7 2022-12-12)
PS C:\Users\USER> cargo --version
cargo 1.66.0 (d65d197ad 2022-11-15)
PS C:\Users\USER>
To add additional components like rust-fmt, clippy, rust-docs etc you can run the following command:
rustup component add rustfmt
rustup component add clippy
rustup component add rust-docs