Rust is a programming language mostly connected with software development and is extensively used on desktop computers supporting Ubuntu. Rust is based on C++ and emphasizes safety, concurrency, and speed. The programming language has carved out a niche in technology, particularly memory management. The language is suitable for creating game engines, browsers, and operating systems. If you’re an Ubuntu lover, you’ll undoubtedly want to use Rust on your preferred operating system. We’ll teach you how to install Rust on Ubuntu.
Install Rust On Ubuntu
There are 2 ways to install Rust. Well, the first method is to install the language using Ubuntu’s native package manager (APT). The curl command is used in the second method. As many users need help understanding the curl command or how to use it on Linux, it is critical to keep its possibilities open. So here are two ways to install Rust.
Install Rust On Ubuntu Using APT
Before installing Rust on your PC, you must update your system using the update and upgrade commands.
sudo apt update && sudo apt upgrade -y
It is time to start the installation after the system has been upgraded. Use the following command to install Rust.
sudo apt install rustc
By entering, check the installation.
rustc -V
The output will list the Rust version number.
Install Rust On Ubuntu With rustup
The rustup shell script, which you may install with the curl command, is another option for installing Rust on Ubuntu. Before proceeding with the installation, you must install curl, especially if it still needs to be installed on your system. You can verify the curl version on your system as a preliminary check. You do not need to install curl if the output has a version number.
But, if you see the error notice below, you must install curl on Ubuntu.
bash: /usr/bin/curl: No such file or directory
On Ubuntu, run to install curl.
sudo apt install curl -y
It is now time to install the Rust language on Ubuntu. Type to run the rustup script.
curl https://sh.rustup.rs -sSf | sh
Choose the Continue with Installation (default) option by typing 1.
Restart your terminal and use the following command to add Rust to your system’s PATH.
source "$HOME/.cargo/env"
Because this will not return an output, run the following command to validate the installation.
rustc -V
The output should return a version number, which is an installation confirmation.
Uninstall Rust On Ubuntu
Similar to how you installed Rust using APT and the rustup shell script, there are two ways to uninstall Rust on Ubuntu.
Uninstall Rust Via APT
The APT remove command can be used in the following manner.
sudo apt remove rustc -y
If you installed Rust using the rustup shell script and want to uninstall it using APT commands, follow the above uninstall following to remove all dependent versions.
sudo apt autoremove
This will remove all dependents from the list after execution.
Remove Rust From Ubuntu Using rustup
Similar to APT, rustup may be used on Ubuntu to remove Rust. You may remove it by running the following command.
rustup self uninstall
When prompted for confirmation, enter y. As soon as you confirm, the tool will uninstall a list of items.
Conclusion:
Rust is a useful tool for writing, compiling, and running sophisticated programs under Ubuntu. Because this language is not pre-installed on Linux, you must understand how to install, access, and uninstall it on Ubuntu. You may use several Rust-based commands in various Linux distributions, making it easier to grasp the language and further showcase your potential in the programming field.