Rust is a fast-growing programming language due to its speed and reliability. It has numerous features, such as easy embedding and system integration. Rust is simple and easy to use, and it ensures the safety of your applications and programs, especially from memory issues.
In this procedural guide, we will demonstrate the installation of Rust on Ubuntu 24.04 machine.
How to Install Rust on Ubuntu 24.04?
The following commands will download and configure the Rust package on your Ubuntu 24.04 machine.
Step 1: Update System Repository
To enhance your Ubuntu machine’s performance, use the following command to update your system’s repository and upgrade all installed packages:
sudo apt update && sudo apt upgrade -y |
---|
This process will refresh your system cache files and install updates on your Ubuntu 24.04 system.
Step 2: Install the “Curl” Package
To easily download the Rust installation script, install the “Curl” package using the following command:
sudo apt install curl -y |
---|
If you already have the newest version of “curl”, the command will print the above message on your screen.
Step 3: Install Rust Using Script
Through the “curl”, download the installation script for Rust. You can simply run below the command from your Ubuntu 24.04 terminal:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
---|
After running the above command, type the “1” to select the standard installation process:
1 |
---|
Once the Rust installation process has finished, a confirmation message will print on your terminal screen.
Step 4: Set up Rust’s Environment
After the Rust package has been installed, set up the environment via the following command:
. "$HOME/.cargo/env" |
---|
The dot (.) can be used instead of the source, if you are in the current shell. This command will configure the Rust environment.
Step 5: Verify Rust Installation
Confirm that Rust is installed perfectly by verifying its version:
rustc --version |
---|
If the command prints the version number, such as “rustc 1.79.0”, it means that Rust has been installed correctly. The version number depends on the time of installation of the Rust package.
How to Uninstall Rust from Ubuntu 24.04?
Completely remove the Rust from your Ubuntu 24.04 by using these steps.
Step 1: Uninstall Rust
You can uninstall the Rust package from your Ubuntu 24.04 machine using this command:
rustup self uninstall |
---|
Type “y” to proceed and complete the uninstallation process of the Rust package.
Step 2: Confirm Rust Uninstallation
Confirm that the Rust has been successfully removed from your machine by checking its version:
rustc --version |
---|
After successfully removing the Rust package, the above command will indicate that Rust is no longer installed.
Conclusion
Installing Rust on Ubuntu 24.04 is so simple. After installing the “Curl” package, run the Rust installation script from the Ubuntu terminal to set up Rust on your machine.