Skip to content

Instantly share code, notes, and snippets.

@idvoretskyi
Last active November 11, 2021 03:13
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save idvoretskyi/71c2f880c79458bc5bff5dd9b3f7b790 to your computer and use it in GitHub Desktop.
Save idvoretskyi/71c2f880c79458bc5bff5dd9b3f7b790 to your computer and use it in GitHub Desktop.
RealVNC Scripting deployment and start-up on Ubuntu/Debian
# Download and unpack the latest binary on a 64-bit Debian-compatible system:
curl -L -o VNC https://www.realvnc.com/connect/download/binary/latest/debian/64-bit/
# Install VNC Server on a Debian-compatible system (assuming download file named as above):
sudo dpkg -i VNC
# Apply your license key, available from the Deployment page of your RealVNC account:
sudo vnclicense -add XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
# Optionally enable cloud connectivity for VNC Server in Service Mode (token available with key):
sudo vncserver-x11 -service -joinCloud <your-token>
# Specify a VNC password for VNC Server in Service Mode:
sudo vncpasswd -service
# Enterprise subscription only. Specify a VNC password for VNC Server in Virtual Mode:
vncpasswd -virtual
# Start VNC Server on a Linux system using systemd:
sudo systemctl start vncserver-x11-serviced.service
# Restart VNC Server each time a Linux system is booted using systemd:
sudo systemctl enable vncserver-x11-serviced.service
# Install a desktop environment suitable for virtualization (for example, XFCE4) on Ubuntu 18.04:
sudo apt-get install xfce4
# Use XFCE4 instead of the console desktop environment (if any) for all virtual desktops:
echo -e '#!/bin/sh\nDESKTOP_SESSION=XFCE4\nexport DESKTOP_SESSION\nstartxfce4\nvncserver-virtual -kill $DISPLAY' | sudo tee /etc/vnc/xstartup.custom
sudo chmod +x /etc/vnc/xstartup.custom
# Start VNC Server on a Linux system using systemd:
sudo systemctl start vncserver-virtuald.service
# Restart VNC Server each time a Linux system is booted using systemd:
sudo systemctl enable vncserver-virtuald.service
@CodeYu001
Copy link

Hi, i have a question and need your help. When i run the aboved script, but after i restart the server, i use the vnc viewer to login, i can't get access to the login interface, and the vnc viewer display the "cannot current show the desktop", how can i set the vnc server to get to display the login interface. I am looking forward to your precious answers. Thank you!

@JHenzi
Copy link

JHenzi commented Dec 15, 2019

Yuzhang001 - have you ever resolved the issue with "cannot current show the desktop" after reboot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment