Vncserver Without X
The most light-weight setup, to have a long-running GUI application on Linux server, is to simply use a vncserver, then run the application after connected to the vncserver. This way you don't have to install many of the X11-related packages, and memory footprint is considerably smaller.
Step 1: Install vncserver and a window manager of your choosing (I use icewm).
1 | apt install xterm xfonts-base xfonts-scalable tightvncserver icewm sakura |
Where sakura is a light-weight terminal emulator that I prefer.
Step 2: Create init files for vncserver session.
1 | mkdir .vnc |
You could also create a vnc password by running vncpasswd
.
Step 3: Run vncserver
1 | vncserver :1 -depth 24 -geometry 1280x800 -localhost -interface lo -nolisten tcp |
Vncserver will listen on localhost:5901, and you're pretty much done at the server side. You could also make it a systemd service instead:
1 | sudo tee /etc/systemd/system/vncserver@.service <<EOF |
To connect to the vncserver, you'll need to forward the vnc connection to localhost:5091 on the server side via a ssh tunnel:
1 | ssh -L 5901:localhost:5901 -C -N server_ip |
On Mac OS, I recommend Secure Pipes which is a great tool for managing multiple tunnels and keeping connections alive.
Now use any vnc client and connect to localhost:5901
, you'll be connected to the vncserver. On Mac OS, simply launch Screen Sharing from spotlight, it's a fairly good vnc client.