How to Install Rust on Ubuntu {apt and rustup} (2024)

Introduction

Rust or rust-lang is a general-purpose programming language for system-level development projects. Rust is known for its speed, memory efficiency, seamless integration with other languages, and type safety.

This guide will teach you how to install Rust on Ubuntu using the apt package manager or curl.

How to Install Rust on Ubuntu {apt and rustup} (1)

Prerequisites

Option 1: Install Rust on Ubuntu Using apt

The rustc package is included in the official Ubuntu repository, and Rust can be installed with the apt package manager. Even though it may not offer the latest available version, using apt to install Rustis a simple and fast option.

Step 1: Update the Package Registry

First, update the system packages registry with:

sudo apt update
How to Install Rust on Ubuntu {apt and rustup} (2)

Step 2: Install Rust

After updating the package registry, install Rust by running the following command:

sudo apt install rustc
How to Install Rust on Ubuntu {apt and rustup} (3)

Type y when prompted and wait for the installation to complete.

How to Install Rust on Ubuntu {apt and rustup} (4)

Step 3: Verify the Installation

Confirm the installation with:

rustc -V
How to Install Rust on Ubuntu {apt and rustup} (5)

The command confirms the installation of rustc1.61.

Option 2: How to Install Rust on Ubuntu Using rustup

To get the latest available version of Rust, use the curl command to download the rustup shell script. The rustup tool allows users to manage Rust in a more straightforward way.

Step 1: Download rustup

To download and install the rustup installer script, use the curl command:

curl https://sh.rustup.rs -sSf | sh
How to Install Rust on Ubuntu {apt and rustup} (6)

Note: If you receive a "curl command not found" error message, it is likely that the curl package is not installed on your system. Install it by running sudo apt install curl.

2. Type 1 to proceed with the default installation.

How to Install Rust on Ubuntu {apt and rustup} (7)

3. Restart the shell if necessary. (The system might not recognize the /.cargo/bin directory.)

How to Install Rust on Ubuntu {apt and rustup} (8)

Step 2: Add Rust to PATH

Once the shell reboots, run the following to add Rust to the system PATH:

source "$HOME/.cargo/env"
How to Install Rust on Ubuntu {apt and rustup} (9)

The command doesn't produce any output.

Step 3: Verify the Installation

Execute rustc with the -V argument to confirm the installation.

rustc -V
How to Install Rust on Ubuntu {apt and rustup} (10)

The output shows Rust version 1.65., a more up-to-date version than the one in the repository.

How to Uninstall Rust on Ubuntu

Depending on which method you used to install Rust, use either apt or the rustup tool to uninstall it.

Uninstall Rust Using apt

To uninstall Rust using the apt package manager, run:

sudo apt remove rustc
How to Install Rust on Ubuntu {apt and rustup} (11)

Confirm with y when prompted. To verify Rust is removed, run rust -V:

How to Install Rust on Ubuntu {apt and rustup} (12)

The output shows that the package is not on the system.

Uninstall Rust Using rustup

To remove Rust from the system, execute:

rustup self uninstall
How to Install Rust on Ubuntu {apt and rustup} (13)

Hit y when prompted. When the process completes, check the Rust version to verify the outcome:

How to Install Rust on Ubuntu {apt and rustup} (14)

Conclusion

After reading this tutorial, you now know how to install Rust on Ubuntu, either with apt or the Rustup installer. Next, check out this list of the best Linux text editors for coding.

How to Install Rust on Ubuntu {apt and rustup} (2024)
Top Articles
Employee Satisfaction Software with (eNPS) | BambooHR
How To Make A Food Budget You'll Actually Stick To
9.4: Resonance Lewis Structures
Duralast Gold Cv Axle
My E Chart Elliot
Housing near Juneau, WI - craigslist
Cash4Life Maryland Winning Numbers
Craigslist Mpls Mn Apartments
Boggle Brain Busters Bonus Answers
Academic Integrity
Gameday Red Sox
United Dual Complete Providers
Erskine Plus Portal
Tugboat Information
[2024] How to watch Sound of Freedom on Hulu
Myql Loan Login
Shariraye Update
Johnston v. State, 2023 MT 20
Industry Talk: Im Gespräch mit den Machern von Magicseaweed
Canvas Nthurston
Nick Pulos Height, Age, Net Worth, Girlfriend, Stunt Actor
Ruse For Crashing Family Reunions Crossword
CVS Near Me | Columbus, NE
12 Top-Rated Things to Do in Muskegon, MI
Empire Visionworks The Crossings Clifton Park Photos
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
The Old Way Showtimes Near Regency Theatres Granada Hills
Woodmont Place At Palmer Resident Portal
Hannaford To-Go: Grocery Curbside Pickup
Best Sports Bars In Schaumburg Il
When His Eyes Opened Chapter 3123
Ihs Hockey Systems
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Palmadise Rv Lot
Capital Hall 6 Base Layout
Of An Age Showtimes Near Alamo Drafthouse Sloans Lake
Here’s how you can get a foot detox at home!
Texters Wish You Were Here
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
Giantess Feet Deviantart
Miracle Shoes Ff6
Exam With A Social Studies Section Crossword
Natasha Tosini Bikini
Jaefeetz
Truck Works Dothan Alabama
Breaking down the Stafford trade
How To Get To Ultra Space Pixelmon
The Blackening Showtimes Near Ncg Cinema - Grand Blanc Trillium
Dying Light Mother's Day Roof
15:30 Est
Mast Greenhouse Windsor Mo
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6417

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.