Skip to content

Instantly share code, notes, and snippets.

@abhi007tyagi
Last active June 16, 2024 09:04
Show Gist options
  • Save abhi007tyagi/22c0288bb3aa523dea7e02226a285b40 to your computer and use it in GitHub Desktop.
Save abhi007tyagi/22c0288bb3aa523dea7e02226a285b40 to your computer and use it in GitHub Desktop.
VNC setup on Raspberry Pi for monitor, keyboard and mouse free access.

Install VNC Server

Open Terminal, and type:

sudo apt-get install tightvncserver

Start VNC Server

To start VNC Server, type:

tightvncserver

Set a password to access the Pi from another computer remotely after the setup.

Run VNCServer at Startup

Type the following in the terminal for creating autostart script:

cd /home/pi
cd .config

Note the '.' at the start of the folder name makes it a hidden folder that will not show up when you type 'ls'.

mkdir autostart
cd autostart

Create a new configuration by typing the following command:

nano tightvnc.desktop

Edit the contents of the file with the following text:

[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false

Press ctrl-X and then Y, and then press Enter to save the file. On reboot, the VNC server will restart automatically.

Connecting to Raspberry Pi via VNC

Download VNC viewer (available for Mac, Linux, Windows, and more), and connect to ipaddress of your Pi over VNC.

Enter the credentials setup earlier and connect.

On Mac, you can also try via finder.

Select Go->Connect to Server from your finder and type

vnc://raspberrypi.local:5901

OR

vnc://IP-ADDRESS-OF-Pi:5901

Enter credentials and connect to raspberry pi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment