Skip to content

Linux Rust Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux Rust Guide

Complete beginner-friendly guide to Rust programming language on Linux, covering Arch Linux, CachyOS, and other distributions including installation, Cargo, and development.


Table of Contents

  1. Rust Installation
  2. Cargo Package Manager
  3. Rust Development
  4. Troubleshooting

Rust Installation

Install Rust

Using rustup (recommended):

# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Reload shell
source ~/.cargo/env

Arch/CachyOS (system package):

# Install Rust
sudo pacman -S rust

# Install Cargo
sudo pacman -S cargo

Verify Installation

Check Rust:

# Check version
rustc --version
cargo --version

Cargo Package Manager

Create Project

New project:

# Create project
cargo new my-project

# Or library
cargo new --lib my-lib

Build and Run

Cargo commands:

# Build
cargo build

# Run
cargo run

# Test
cargo test

# Release build
cargo build --release

Rust Development

Hello World

Basic program:

fn main() {
    println!("Hello, World!");
}

Dependencies

Add dependencies:

# Cargo.toml
[dependencies]
serde = "1.0"

Troubleshooting

Rust Not Found

Check installation:

# Check Rust
which rustc
which cargo

# Install if missing
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Compilation Errors

Check errors:

# Build with verbose output
cargo build --verbose

# Check Rust version
rustc --version

Summary

This guide covered Rust installation, Cargo usage, and development for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally