'Virtualizing Ubuntu Linux on MacOS with Apple silicon (M1 chip)

As of March 2022 VirtualBox supports only x86 and AMD64/Intel64 and doesn't support ARM-based systems like Apple M1.

Parallels Desktop for Mac supports Apple M1 chip but requires you to buy a license.

Are there an open source solution for running Ubuntu Linux virtual machine on MacOS with Apple silicon (M1 chip)?



Solution 1:[1]

UTM

UTM is a full featured open source virtual machine host for MacOS that supports Apple silicon (M1 chip) - https://mac.getutm.app/

Follow the instructions to install Ubuntu on UTM - https://mac.getutm.app/gallery/ubuntu-20-04

In my experience there are a few issues with UTM and there is an easier way to run an Ubuntu VM on MacOS.

Multipass

Multipass allows launching and managing Ubuntu VMs with a few CLI commands - https://multipass.run/

Download Multipass for MacOS - https://multipass.run/download/macos

Run the installer to install Multipass.

Verify the installation:

multipass --help

Launch Ubuntu 20.04 LTS VM called MyUbuntu (2 CPUs, 3GB RAM, 10GB HDD):

multipass launch --cpus 2 --mem 3G --disk 10G --name MyUbuntu 20.04

Mount a home directory to share data between your host and the VM instance:

multipass mount $HOME MyUbuntu:Home

Open a shell prompt on a VM instance:

multipass sh MyUbuntu

Inside the VM shell you are logged as ubuntu user with passwordless sudo.

Interact with the instance, for example list mounted home directory:

ls ~/Home/

If you want to have GUI, install Ubuntu Desktop and xrdp:

sudo apt update
sudo apt install ubuntu-desktop xrdp

Set password for user ubuntu

sudo passwd ubuntu

Reboot the VM instance:

sudo reboot

Wait for the VM to restart.

Find the IP address (IPv4) of the VM:

multipass ls

Name                    State             IPv4             Image
MyUbuntu                Running           192.168.xx.xx    Ubuntu 20.04 LTS

Or find the IP address using jq in a single command:

multipass ls --format json | jq ".list[0].ipv4[0]"

Install Microsoft Remote Desktop - https://apps.apple.com/us/app/microsoft-remote-desktop/id1295203466?mt=12

Open Microsoft Remote Desktop.

Click Add PC:

  • PC name: <VM instance IP address>
  • Friendly name: MyUbuntu

Edit PC

Click Add User Account...:

  • Username: ubuntu
  • Password: <your password>
  • Friendly name: ubuntu

Add User Account

MyUbuntu click ... > Connect

Connect

After entering the password enjoy Ubuntu Desktop:

Ubuntu xrdp

To delete the VM instance run:

multipass delete MyUbuntu
multipass purge

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1