Do the following to install x11vnc which will allow you to VNC into a “headless” (no monitor, keyboard, or mouse connected) Pi from an external machine.
sudo apt-get install x11vnc
sudo tee /etc/init.d/x11vnc <<EOF
#!/bin/bash
# /etc/init.d/x11vnc
# Carry out specific functions when asked to by the system
case "$1" in
start)
su pi -c '/usr/bin/x11vnc -forever -display :0'
echo "Starting VNC server "
;;
stop)
pkill x11vnc
echo "VNC Server has been stopped (didn't double check though)"
;;
*)
echo "Usage: /etc/init.d/x11vnc {start|stop}"
exit 1
;;
esac
exit 0
EOF
sudo chmod 755 /etc/init.d/x11vnc
sudo update-rc.d x11vnc defaults