Using Ubuntu 20.04, I am starting my Ubuntu server with:
qemu-system-x86_64 \
-enable-kvm \
-cpu host \
-smp 11 \
-drive format=raw,file=/mnt/kvm-guests/work.img,if=virtio \
-net nic,model=virtio,macaddr=ec:8d:2c:f3:2a:7c \
-net tap,ifname=tap2,script=no,downscript=no \
-runas kvmuser \
-nographic \
-m 30000 &
How do I make it to where:
- There is a port given in the output if I want to vnc into it
- Not have the terminal be used as a display (I don't want a terminal at all)
Using Qemu version 4.2.1 along with KVM
for the cli configuration of a VNC you need to configure the display that way. To do that drop "nographic" and instead add something like
-display none -vnc :0
.Of these options
-display none
makes it not put output somewhere immediately, but in comparison tonographic
it will leave a virtual gpu present to the guest. Then-vnc
controls where/how to open a port. There are many suboptions, and I'd recommend to restrict accessibility and authentication. You can aslo combine it with spice, so I'd recommend to have a look for "vnc" in the man page-display none
of the above will already have done that for you, for full background execution consider also adding-daemonize