Skip to content

Instantly share code, notes, and snippets.

@aidenfoxivey
Last active December 28, 2023 16:46
Show Gist options
  • Save aidenfoxivey/f9e3da863eb40cadc733218a273d614b to your computer and use it in GitHub Desktop.
Save aidenfoxivey/f9e3da863eb40cadc733218a273d614b to your computer and use it in GitHub Desktop.
Fast Linux VM Workflow on Macs

Do you want a local ECEUbuntu? 👷

Local ECEUbuntu on Macs

eceubuntu

Guide created with limactl version 0.17.2 and Homebrew 4.1.14 on an M1 Pro MBP running macOS 14.0 (23A344).

This guide is supported on:

  • ARM64 (M1) Macs
  • AMD64 (Intel) Macs

In this short guide, I'll walk you through replicating a tiny version of ECEUbuntu on your personal machine. This is an easy solution that doesn't have many pieces to screw up and should take you about 15 minutes to set up properly.

Bear in mind that this does not replace testing on ECEUbuntu. You should always test on ECEUbuntu at the end to make sure that your solution works.

  1. Download brew: The Missing Package Manager for macOS (or Linux) Follow the necessary steps and you should be fine in due time. brew is the unofficial but widely accepted default package manager (tool to install software) on macOS. Other systems exist but they are not nearly as well supported.

  2. Run brew install lima to install lima. lima is a tool that will create easy to manage and configure GNU Linux VMs. It uses the go programming language and QEMU (an emulator) to create systems without the hassle of knowing anything about setting up GNU Linux internals.

  3. Create a new vm with limactl create --name=tinyeceubuntu. You should see a menu that reads:

? Creating an instance "tinyeceubuntu"  [Use arrows to move, type to filter]
> Proceed with the current configuration
  Open an editor to review or modify the current configuration
  Choose another template (docker, podman, archlinux, fedora, ...)
  Exit

Move down to "Choose another template" and hit enter.

Now move down until your > is on ubuntu-lts. Hit enter.

? Creating an instance "tinyeceubuntu" Choose another template (docker, podman, archlinux, fedora, ...)
? Choose a template  [Use arrows to move, type to filter]
  podman
  rocky-8
  rocky-9
  rocky
> ubuntu-lts
  ubuntu
  vmnet

Finally hit enter and Proceed with the current configuration.

It will download and install the VM for you.

  1. Configure your system mounts.

Run limactl edit tinyeceubuntu and edit your file have the following mounts. Note that ~/Development is just my dev folder on my Macbook. You can change it to be whatever folder you want, assuming you have the correct permissions for it.

mounts:
  - location: "~/Development"
    writable: true

Remove the existing mounts and write this new one in. Save the file and exit.

  1. Enter your new system.

First start the system with limactl start tinyeceubuntu and then enter using limactl shell tinyeceubuntu.

  1. Update your new system with sudo apt update

  2. Run sudo apt install -y make gcc valgrind tar to install the basic required software

Sometimes you need additional resources. For example, in ECE252 (2023 Fall offering), you need zlib. For this, run sudo apt install zlib1g-dev.

If you need to exit the new system, run exit.

  1. Setup VSCode SSH.

From your MacOS Terminal, run limactl show-ssh --format=config tinyeceubuntu > ./ssh-config. Then open ssh-config and add it over to ~/.ssh/config.

If you install the Remote-SSH plugin, then you should be able to seamlessly work on your VM without having to worry about moving files back and forth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment