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
#!/bin/sh
SPICE_PORT=5924
SPARK_IMG=/home/hoa/spark-training.qcow2
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=127.0.0.1,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 127.0.0.1 -p ${SPICE_PORT}
Inside guest, enable copy and paste listener
[@guest]$ sudo service spice-vdagentd start
[@guest]$ spice-vdagent
Interacting with host (default to 10.0.2.2
ip) via ssh
[@guest]$ ssh [email protected]
Interacting with guest via ssh
[@host]$ ssh guessuser@localhost -p 2222