Ubuntu

How to Install Rust on Ubuntu

Rust is a programming language that provides a beneficial approach for developing the versatile projects such as creating several file systems, browser components, game engines, operating systems, applications, etc.

It is an open-source language with many advantages like speed, parallelism, memory efficiency, integrity with various languages, and safety. However, many Linux beginners don’t know that they can install and use Rust on their Ubuntu system. So, this quick blog is all about the multiple methods of installing Rust on Ubuntu.

How to Install Rust on Ubuntu

There are two methods to install Rust on an Ubuntu machine. Let’s check them one by one briefly.

The Official Repository

First, update your system according to the newest updates available for the system.

sudo apt update

 

Now, use the following command to install Rust on Ubuntu:

sudo apt install rustc -y

 

In the previous command, we already used the “-y” flag so that Rust is installed directly without your permission during installation.

Finally, check the installed version of Rust through this command:

rustc -V

 

The Dependencies

You can install the same Rust version in the repository through the previous method. To install its updated version, you can also download and install it through dependencies.

Several packages are available in your system for installing Rust. So, run the following command to fulfill all those requirements:

sudo apt install curl gcc make build-essential

 

Now, install Rust by running the following command:

curl https://sh.rustup.rs -sSf | sh

 

The system will ask you for the type of Rust that you want to install. Here, we will go for its default type. For this, type 1 and press “Enter”.

After completing the successful installation, it notifies you as shown in the following image:

Now, you must configure your present shell to create the Rust environment. Hence, run the following command to start the Rust environment:

source ~/.profile

source ~/.cargo/env

 

Once you have done all the provided steps, confirm the Rust installation by running the following command:

rustc -V

 

Conclusion

Rust is a lightweight and fastest programming language for building games and applications. In this quick blog, we installed Rust on Ubuntu 23.10.1 using repositories and dependencies. Through the repository, you get the present version which may not be its latest one. You can go with the second one and use its latest features to get the updated one.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.