VNC / Remote Desktop
If you want a remote desktop, the most universal way is to create a Virtual Network Computing interface. With a VNC server on the Raspberry Pi and a VNC Viewer on a PC, Mac or other Linux/Unix computer you can now create additional displays on the X-Windows server running on the Pi
Installing a VNC Server on the Raspberry Pi
Install the tightvnc package on the Raspberry Pi:
sudo apt-get install tightvncserver
After this, configure the server running the command:
vncserver :0 -geometry 1920x1080 -depth 24 -dpi 96
You are asked to enter a password. After this, you can open an additional display (aka desktop) on any computer running a VNC Viewer. To open the new display, you must specify the display number. This is the number that is given after the IP number that you connect to (e.g. 192.160.0.100:1)
I use "Real VNC Viewer" (see https://www.realvnc.com/download/viewer/), this was the first viewer I tried that is very easy to install and use.
Running VNC server at startup
If you want to run VNC Server at startup, create a new file in /etc/init.d, call it something logical (e.g. vncboot) and add the following text:
#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO
USER=root
HOME=/root
export USER HOME
case "$1" in
start)
echo "Starting VNC Server"
#Insert your favoured settings for a VNC session
/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565
;;
stop)
echo "Stopping VNC Server"
/usr/bin/vncserver -kill :0
;;
*)
echo "Usage: /etc/init.d/vncboot {start|stop}"
exit 1
;;
esac
exit 0
|
Modify the file permissions such that the file is executable:
chmod 755 /etc/init.d/vncboot
and enable dependency based boot sequencing to start at boot-time:
update-rc.d /etc/init.d/vncboot defaults
Note that the USER and HOME specified in the script determine to which user and home directory this display belongs. You may want to change this to USER=pi and HOME=/home/pi
