Skip to content

Instantly share code, notes, and snippets.

@gnthibault
Last active June 12, 2024 08:44
Show Gist options
  • Save gnthibault/457c40f3359c6b9f8ab3be58128f9bfd to your computer and use it in GitHub Desktop.
Save gnthibault/457c40f3359c6b9f8ab3be58128f9bfd to your computer and use it in GitHub Desktop.
Install default setup in ubuntu when ran into UTM, qemu based virtualization
#!/bin/bash
# Install prerequisites
sudo apt install -y ubuntu-desktop
sudo apt install -y qemu-guest-agent, spice-vdagent, spice-webdavd, davfs2
# Check if spice vdagent is enabled to get right click/clipboard working through utm
sudo systemctl start spice-vdagent
sudo systemctl enable spice-vdagent
sudo systemctl status spice-vdagent
# If you want to use webdav (not recommanded) you can check if it is working with
# sudo systemctl start spice-webdavd.service
# sudo systemctl enable spice-webdavd.service
# sudo systemctl status spice-webdavd.service
# Check directory sharing through webdav, ie once SPICE WebDAV is installed and running, you should be able to access http://127.0.0.1:9843 from inside the guest. This is a WebDAV share that you can mount using something like davfs2.
# We'd rather use VirtFS, faster, and easier to setup (see https://docs.getutm.app/guest-support/linux/#virtfs)
mkdir /home/gnthibault/shared
sudo mount -t 9p -o trans=virtio share /home/gnthibault/shared -oversion=9p2000.L
# Automate with
echo "share /home/gnthibault/shared 9p trans=virtio,version=9p2000.L,rw,_netdev,nofail 0 0" | sudo tee -a /etc/fstab
sudo systemctl daemon-reload
sudo mount -a
sudo chown -R $USER /home/gnthibault/shared
# Extend disk
lsblk -p
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment