How to Run an Ubuntu Terminal VM on a MacBook Air M1 Using Multipass

A Comprehensive Guide to Setting Up Multipass on MacBook Air M1 with Custom VM Resources

This guide covers everything from downloading Multipass to creating and managing an Ubuntu VM with custom memory and disk settings. Follow these steps to set up your environment on your MacBook Air M1.


Step 1: Download and Install Multipass

  1. Download Multipass:

    • Visit the Multipass website.
    • Download the macOS installer that is compatible with ARM architecture.
  2. Install Multipass:

    • Open the downloaded installer package.
    • Follow the on-screen instructions to complete the installation.
    • Once installed, Multipass will be available for creating and managing Ubuntu VMs.

Step 2: Launch Your First Ubuntu Instance

Before customizing your VM’s resources, you can test the basic launch process.

  1. Open Terminal:

    • Use the built-in Terminal app on your Mac.
  2. Launch an Instance:

    • Run the following command to launch a basic instance:

      multipass launch --name test-vm

    • Multipass will download the Ubuntu image (if it's not already cached) and create a VM named "test-vm".

  3. Connect to the Instance:

    • After the instance is running, connect by running:

      multipass shell test-vm

    • You are now inside the Ubuntu VM. Type exit to leave the shell when finished.


Step 3: Delete the Existing Instance (if needed)

If you need to change the VM’s resources (RAM and disk), you must first delete the existing instance.

  1. Delete the Instance:

    • In Terminal, run:

      multipass delete test-vm

  2. Purge Deleted Instances:

    • Ensure the instance is completely removed by running:

      multipass purge


Step 4: Launch a New Instance with Custom Resources

Now that your previous instance is removed, create a new one with your preferred settings.

  1. Launch with Custom RAM and Disk:
    • To allocate 6GB of RAM and 50GB of disk space, run:

      multipass launch --name myubuntu --memory 6G --disk 50G

    • Note: The option --memory is recommended over --mem, as the latter is deprecated.

    • Multipass will download the Ubuntu image if necessary and create a VM named "myubuntu" with your specified resources.


Step 5: Verify Custom Resource Allocation

Once the instance is running, confirm that the resources have been correctly assigned.

  1. Check Instance Information:
    • Run the following command:

      multipass info myubuntu

    • This command displays details such as allocated memory, disk space, the instance’s IP address, and current status.


Additional Tips

  • Starting and Stopping the Instance:

    • To stop the instance, run:
      multipass stop myubuntu
    • To start it again, run:
      multipass start myubuntu
  • Deleting and Purging:

    • When you need to start fresh, remember to delete your instance with:
      multipass delete myubuntu
      And then:
      multipass purge
  • Connecting to the Instance:

    • Access your Ubuntu VM at any time using:
      multipass shell myubuntu

Conclusion

By following this comprehensive guide, you now have Multipass installed on your MacBook Air M1 and have learned how to manage Ubuntu VMs with custom resource allocations. This setup is ideal for testing, development, or simply exploring Ubuntu in a lightweight, virtualized environment. If you have any questions or run into issues, feel free to leave a comment or reach out for help.

Happy Multipassing!

Comments

Popular posts from this blog