Skip to content

Instantly share code, notes, and snippets.

Last active January 4, 2021 10:27
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
QEMU + Spice with Copy & Paste

Create a runner shell script in host -> init with:

  • 2GB RAM
  • Host CPU with 2 Cores
  • Localhost port 2222 traffic redirect to guest port 22
  • Spice display with copy and paste enabled

qemu-system-x86_64 \
  -name Spark \
  -m 2048 \
  -drive file=${SPARK_IMG},if=virtio,cache=off \
  -enable-kvm -cpu host \
  -smp 2 \
  -redir tcp:2222::22 \
  -vga qxl \
  -spice port=${SPICE_PORT},addr=,disable-ticketing \
  -device virtio-serial-pci \
  -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
  -chardev spicevmc,id=spicechannel0,name=vdagent \
  -monitor stdio
  # "$@"            # other args
  # -loadvm persist # load existing tag|id name 'persist'

Open up the graphical using spice client

[@host]$ spicec --title Spark -h -p ${SPICE_PORT}

Inside guest, enable copy and paste listener

[@guest]$ sudo service spice-vdagentd start
[@guest]$ spice-vdagent

Interacting with host (default to ip) via ssh

[@guest]$ ssh hostuser@

Interacting with guest via ssh

[@host]$ ssh guessuser@localhost -p 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment