Raspberry Pi VNC fail connection

Jackdon Chew picture Jackdon Chew · Mar 2, 2017 · Viewed 23k times · Source

I face a problem that I can ping to correct IP address, it have no loss. And also I use nmap ping the pi address, and I get it correctly. Then I using VNC viewer to try access to pi, but it always show up "The connection was refused by the host computer"

Did u all have any idea ?

Answer

avatli picture avatli · Mar 2, 2017

Your problem indicates that your Raspberry Pi was reached by the connection attempt, but that no service was running on the relevant port and hence the connection was refused. I think, this is because the VNC service is not running on your Raspberry Pi.

Update 1
Raspbian now comes with the server by default thanks to a partnership with RealVNC, it just needs to be enabled.

Original
You must enable VNC Server on your Raspberry Pi using terminal

sudo apt-get update
sudo apt-get install realvnc-vnc-server

or you can also enable VNC Server on the command line using the sudo raspi-config command.

Advanced Options->VNC:Yes

Now you can connect to the VNC Server using a application such as VNC Viewer.