How To Install Rust On Ubuntu

You’re here to write code — something that runs fast, stays stable, and doesn’t crash when you need it most. Rust isn’t just another language. It’s the tool developers use when performance matters: servers, embedded systems, network tools. And if you’re building anything serious, you need real hardware behind it. This guide walks you through installing Rust on a clean Ubuntu 22.04 VPS Just you, the terminal, and the compiler.

How To Install Rust On Ubuntu.

How To Set Up Rust on Ubuntu VPS: A Step-by-Step Guide 2026

Step 1. Connect to Your VPS via SSH

You’ll need an SSH client — like PuTTY on Windows or Terminal on Mac or Linux. Open it, then type:

ssh root@ip-address

Replace ip-address with the actual IP address your VPS provider gave you. Press Enter. You’ll be asked for a password — paste the one from your welcome email. If you see a prompt like root@server:~#, you’re in. This is your server’s command line. Everything you type here runs directly on the machine.

Step 2. Update Your System & Install Essential Tools

Your server came with a base OS, but it might be outdated. Run this to get the latest fixes and security patches:

apt update && apt upgrade -y

Apt is Ubuntu’s package manager. Update checks for new versions. Upgrade installs them. The -y tells the system to say “yes” automatically to prompts. Wait until you see the prompt again. Don’t rush this step.

You need three programs to continue:

  • curl to download files from the internet;
  • nano to edit text files (like code);
  • unzip to unpack files later.

Install them all at once:

apt install -y curl nano unzip

Again, -y skips confirmation. These are your basic tools.

Step 3. Install Rust via rustup

Rust changes often. The official installer, rustup, handles versions for you. Run:

curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh

This downloads a script and runs it. You’ll see a menu. Type 1 and press Enter. It will install Rust into your user folder. This takes a few minutes. Don’t close the window.

The installer put Rust in a place your terminal doesn’t know about yet. Run this to fix that:

source $HOME/.cargo/env

This tells your current session where to find Rust tools. Now check if it worked:

rustc --version

You should see something like rustc 1.91.1. If you see an error, restart your SSH session and try again. This step is easy to miss — but it’s required.

Step 4. Install Build Tools

Rust doesn’t compile itself. It needs a C compiler and tools to turn your code into a program. Install them:

sudo apt install build-essential

This adds gcc, make, and other low-level tools. Without them, rustc will fail with confusing errors. This is like installing drivers for your printer — you don’t see it, but nothing works without it.

Step 5. Create a Test Project Folder

Organize your work so you don’t lose files later. Run these commands one after another:

mkdir ~/rustprojects

This creates a folder called rustprojects inside your home directory.

cd ~/rustprojects

This moves you into that folder.

mkdir testdir

Creates a subfolder for your first project.

cd testdir

Moves you inside it. You’re now in ~/rustprojects/testdir. Your terminal prompt will show it. This is where your code lives.

Use the nano text editor to create a file:

nano test.rs

A blank screen opens. Type this exactly:

fn main() {

  println!("Congratulations! Your Rust program works.");

}

Don’t add extra spaces or quotes. When done, press Ctrl+X. You’ll see “Save modified buffer?” Type y then press Enter. Then press Enter again to confirm the filename test.rs. You’ve just written your first Rust program.

Now turn your code into a program:

rustc test.rs

This creates a file called test (no extension). It’s not a .exe — it’s a Linux binary. Run it with:

./test

The ./ means “run this file from the current folder.” You should see: Congratulations! Your Rust program works. If you do, you’ve compiled and run Rust on a real server. That’s the milestone.

Step 6. Keep Rust Updated

Rust improves every six weeks. To update later:

rustup update

It will download and install the latest version.

To remove Rust completely:

rustup self uninstall

It deletes everything.

Conclusion

Rust gives you speed, safety, and control — whether you’re writing a CLI tool, a microservice, or a system-level library. But none of that matters if your environment is shared, throttled, or unstable. That’s why you need a real VPS: full root access, SSD storage, and dedicated resources. No middlemen. No restrictions. Just you, your code, and hardware that doesn’t flinch under load. If you’re serious about building with Rust, start with infrastructure that doesn’t hold you back. See our VPS plans. Build something that lasts.

DN

The author

Dmitriy Novitsky

Dmitriy Novitsky, Chief Technology Officer at VPS.one, is a seasoned expert in VPS hosting. With years of experience, he shares valuable insights and technical knowledge to help users optimize their hosting performance and stay ahead in the tech world.

How to Install a Minecraft Server.

How to Install a Minecraft Server on a VPS (Ubuntu 22.04)

How to Install cPanel.

How to Install cPanel on a VPS Server

How to Install UFW Firewall.

How to Install UFW Firewall on Ubuntu 24.04