Skip to content

Instantly share code, notes, and snippets.

@mjkpolo
Last active January 11, 2023 19:52
Show Gist options
  • Save mjkpolo/6c835bc04403df1058af1b2598bf8e58 to your computer and use it in GitHub Desktop.
Save mjkpolo/6c835bc04403df1058af1b2598bf8e58 to your computer and use it in GitHub Desktop.
running qemu for linux on m1

Download qemu

brew install qemu

Setup a directory

mkdir ~/qemu
pushd ~/qemu
curl -O https://gist.githubusercontent.com/mjkpolo/ae804c93dcc17cec6419092905abe5f2/raw/6a56f42a7f4b2404553198b0a39ef5d5d20cbd49/start_vm.sh
chmod +x start_vm.sh
ln -s $HOME/qemu/start_vm.sh $HOME/.local/bin/start_vm

Install Ubuntu 22.10

This will bring a qemu window up for installation. If keyboard and mouse doesn't work just wait for the boot menu to autoselect the default option

qemu-img create -f qcow2 ubuntu.qcow2 60G
curl -O https://cdimage.ubuntu.com/releases/22.10/release/ubuntu-22.10-live-server-arm64.iso
start_vm build ubuntu-22.10-live-server-arm64.iso

now you can start the vm (if you put ~/.local/bin in your path)

start_vm

The installer options should allow you to install open-ssh server. Do not import an ssh key, and password auth will be enabled by default

if you would like to login to the vm easily, add the following to ~/.ssh/config:

Host vm
  User <if different than local>
  HostName localhost
  Port 5555
  ForwardX11Trusted yes

ssh to the machine with ssh vm

Finally you could add your ssh key to the box

ssh-copy-id vm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment