You can perform all the operations required to download and install RealVNC Connect on a target computer - and license, configure, and start RealVNC Server ready for connections - at the command line, making it easy to script deployment.
*You can only license RealVNC Server as part of the deployment process if your subscription includes mass/offline deployment.
The example script below targets Debian and Red Hat-compatible Linux computers, but the same principles apply to all supported platforms.
For more information on RealVNC Server modes, click here.
############# Download #############
# Download and unpack the latest binary on a 64-bit Debian-compatible system:
curl -L -o VNC.deb https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-Latest-Linux-x64.deb
# Download the latest binary on a 32-bit Debian-compatible system:
# curl -L -o VNC.deb https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-Latest-Linux-x86.deb
# Download the latest binary on a 64-bit Red Hat-compatible system:
# curl -L -o VNC.rpm https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-Latest-Linux-x64.rpm
# Download the latest binary on a 32-bit Red Hat-compatible system:
# curl -L -o VNC.rpm https://downloads.realvnc.com/download/file/vnc.files/VNC-Server-Latest-Linux-x86.rpm
|
############# Install RealVNC Server #############
# Install RealVNC Server on a Debian-compatible system (assuming download file named as above):
sudo apt install -y ./VNC.deb
# Install RealVNC Server on a Red Hat-compatible system:
# sudo yum install -y VNC.rpm
|
############# License RealVNC Server #############
# Start RealVNC Server in Service Mode (see below) and sign in to the GUI using your
# RealVNC account credentials.
# Alternatively, for subscriptions with mass/offline deployment, apply your license via a command
# To use cloud licensing and connectivity for RealVNC Server in Service Mode, use a cloud connectivity token:
# More information: https://help.realvnc.com/hc/en-us/articles/360005474138
sudo vncserver-x11 -service -joinCloud <your-token>
# To license RealVNC Server offline, apply your offline license available from the Deployment page of your
# RealVNC account:
sudo vnclicense -add <offline-license>
|
############# Specify a VNC password for RealVNC Server #############
# More information: man vncpasswd
# Specify a VNC password for RealVNC Server in Service Mode:
sudo vncpasswd -service
# Note, you must also set the appropriate Authentication value
echo 'Authentication=VncAuth' | sudo tee -a /root/.vnc/config.d/vncserver-x11
# Specify a VNC password for RealVNC Server in Virtual Mode:
# vncpasswd -virtual
# Note, you must also set the appropriate Authentication value
# echo 'Authentication=VncAuth' | tee -a $HOME/.vnc/config.d/vncserver-x11-virtual # SystemXorg
# echo 'Authentication=VncAuth' | tee -a $HOME/.vnc/config.d/Xvnc # Xvnc
|
############# Enable domain users to connect to RealVNC Server using system credentials #############
# More information: man vncinitconfig
# Share the common PAM configuration on a Debian-compatible system with RealVNC Server:
echo -e '@include common-auth\n@include common-account\n@include common-session' | sudo tee /etc/pam.d/vncserver.custom
# Share the common PAM configuration on a Red Hat-compatible system with RealVNC Server:
# echo -e 'auth include password-auth\naccount include password-auth\nsession include password-auth' | sudo tee /etc/pam.d/vncserver.custom
# Register the common PAM configuration with RealVNC Server:
echo 'PamApplicationName=vncserver.custom' | sudo tee -a /etc/vnc/config.d/common.custom
|
############# Configure and start RealVNC Server in Service Mode #############
# More information: man vncserver-x11-serviced
# Optionally change registered users and permissions (by default, root user and admin group have full access):
# echo 'Permissions=%admin:f,dev.acme.com\\johndoe:d,janedoe:v' | sudo tee -a /root/.vnc/config.d/vncserver-x11
# Optionally change the listening port for direct connections (by default, 5900):
# echo 'RfbPort=4999' | sudo tee -a /root/.vnc/config.d/vncserver-x11
# Start RealVNC Server on a Linux system using systemd:
sudo systemctl start vncserver-x11-serviced.service
# Restart RealVNC Server each time a Linux system is booted using systemd:
sudo systemctl enable vncserver-x11-serviced.service
|
############# Prepare a system for RealVNC Server in Virtual Mode #############
# More information: https://help.realvnc.com/hc/en-us/articles/360004324217
# Install X11 dummy drive on Debian-compatible systems:
sudo apt install xserver-xorg-video-dummy
# Install X11 dummy drive on Redhat-compatible systems:
# sudo yum install xorg-x11-drv-dummy
# Configure RealVNC Server to use X11 dummy driver. More information: https://help.realvnc.com/hc/en-us/articles/360003474752
sudo vncinitconfig --enable-system-xorg
# Note also the following: hostname must be resolvable, xauth on PATH, and iptables suitably configured.
|
############# Configure and start RealVNC Server in Virtual Mode #############
# More information: man vncserver-virtual
# Optionally change registered users and permissions (by default, user starting RealVNC Server has full access):
# echo 'Permissions=:f,dev.acme.com\\johndoe:d,janedoe:v' | tee -a ~/.vnc/config.d/Xvnc
# Optionally specify virtual desktop geometries (first is the default, largest is the maximum).
# Connected users can cycle between using xrandr:
# echo 'RandR=1280x800,800x600,1024x768,1200x900,1280x720,1800x1024' | tee -a ~/.vnc/config.d/Xvnc
# Start RealVNC Server on port 5900+<next-available-display>, for example 5901. Note, do not start as root user:
vncserver-virtual
|
############# Configure and start RealVNC Server in Virtual Mode daemon #############
# More information: man vncserver-virtuald
# Mandatory if SELinux is Enforcing. Turn Avahi service discovery off:
echo 'ServiceDiscoveryEnabled=false' | sudo tee -a /etc/vnc/config.d/Xvnc
# Recommended. Restrict registered users and permissions (by default, any user can connect using system credentials):
echo 'Permissions=root:f,%teachers:d,%pupils:v' | sudo tee -a /root/.vnc/config.d/vncserver-virtuald
# Optionally change the listening port (by default, 5999):
# echo 'DaemonPort=6051' | sudo tee -a /root/.vnc/config.d/vncserver-virtuald
# Start RealVNC Server on a Linux system using systemd:
# sudo systemctl start vncserver-virtuald.service
# Restart RealVNC Server each time a Linux system is booted using systemd:
# sudo systemctl enable vncserver-virtuald.service
|
Comments
Article is closed for comments.