Controlling the Pi Remotely with VNC
You want access to the full Raspbian graphical desktop of your Pi from a PC or Mac.
Install a VNC (Virtual Network Connection) server.
Open a Terminal session (or SSH session) on the Pi and run the following commands:
$ sudo apt-get update $ sudo apt-get install tightvncserver |
Having installed the VNC server, run it using the command:
$ vncserver :1 |
The first time you run this, you will be prompted to create a new password, so anyone connecting remotely has to enter the password before being granted access to the Pi.
To connect to the Pi from a remote computer, you will need to install a VNC client. RealVNC is a popular choice and connects well with tightvnc.
When you run the client program on your Mac or PC, you will be asked to enter the IP address of the VNC server you want to connect to (the IP address of your Pi). Enter “:1” after the IP address to indicate that you wish to connect to display number 1.
You will then be prompted for the password. Remember, this is the password you set previously after installing tightvncserver (Figure 2-7) and not necessarily the same as your normal Raspberry Pi password.
Discussion
Although you can do most things with SSH, sometimes it is useful to have access to the graphical environment of the Pi.
If you want the VNC server to automatically start whenever you restart your Raspberry Pi, follow these steps:
$ cd /home/pi $ cd .config $ mkdir autostart $ cd autostart $ nano tightvnc.desktop |
Paste the following into the editor window:
[Desktop Entry] Type=Application Name=TightVNC Exec=vncserver :1 StartupNotify=false |
As long as your Raspberry Pi is set to automatically log in and boot into the windowing environment, then VNC server will automatically start when you reboot.
See Also
See also this Adafruit tutorial.