Post

Rust, Rustlings Environment Configuration

Setting up Rust and Rustlings in various environments, and via remote access.

Linux

Installing Linux on a Mac

Access to university’s Linux

1
ssh <username>@linux.bath.ac.uk

Clone respotery from github

Creating SSH Key

To clone GitHub repositories using SSH, generate an SSH key in the Linux environment with the following command:

1
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

View and copy the public key:

1
cat ~/.ssh/id_rsa.pub

Go to GitHub, go to “Settings”. On the settings page, click “SSH and GPG keys”. Click “New SSH Key”, paste the copied public key, add a description, and click “</ins>Add SSH Key”.

Clone the Repository Locally

Using SSH

In the GitHub repository, click the green “Code” button and select the SSH option. Copy the provided URL and then, in your local Linux environment, execute:

1
git clone <copied_ssh_url>

After cloning, use the ls command to view the cloned directory and cd to enter it. Install Rustlings with:

1
cargo install --force --path .

Using HTTPS

Alternatively, the repository can also be cloned by HTTPS:

1
git clone <copied_https_url>

Install Rust & Rustlings

Rust

To install Rust locally in a Linux environment, refer to the ArceOS Tutorial Book1:

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

After installation, reopen the terminal or apply the new environment variable settings with:

1
source $HOME/.cargo/env

Confirm the Rust toolchain installation:

1
rustc --version

Rustlings

Navigate to the cloned directory and install:

1
cargo install --force --path .
  1. Arceos 教程 Rust 开发环境配置 - ArceOS Tutorial Book (rcore-os.cn): https://rcore-os.cn/arceos-tutorial-book/ch01-02.html↩︎

This post is licensed under CC BY 4.0 by the author.