In this tutorial I will go through the all the steps to setting up a Raspberry Pi VNC server. Once we have done this you will be able to remote desktop to your Pi so you’re able to control as if you were sitting there with it.
The process of setting this all up is actually pretty easy and at the end of it you will be able to remotely control the desktop of the Pi. This is incredibly handy if you don’t have a screen or access to the Pi itself. If you just want a barebones command line approach, then be sure to check out the tutorial on how to SSH into your Raspberry Pi. This is how I control my Pi pretty much all the time but it all just comes down to preference.
If you want to see how this is all done, then be sure to check out my video below. I go through all the steps from start to finish on getting this setup correctly in no time at all. If you do like the video and would love to see more then please make sure you subscribe.
In order to complete this Raspberry Pi remote desktop tutorial, you will need the following pieces of equipment.
Installing the Raspberry Pi VNC Server
As in all of my tutorials you will need to use have Raspbian pre-installed onto your Raspberry Pi. If you haven’t already done this, then you can find out how to do it all in my guide on installing Raspbian.
Now installing the VNC server software package onto your Raspberry Pi is actually incredibly easy and only requires entering a couple of commands.
- Before we get started first make sure your Pi is up to date by running the following commands:
sudo apt-get update sudo apt-get upgrade
- Once those two commands have finished running, enter the following to install the tightvncserver.
sudo apt-get install tightvncserver
- Now setup and run the VNC server, this is pretty easy to do. Simply run the following command:
- You will now need to setup a password for when you go to connect to the Pi remotely via the VNC client. It is important to remember the password will be truncated to 8 characters so try and choose a password that works best for you that is no longer than 8 characters long.
- It will next ask you to verify the password, just enter it again.
- Next it will ask if you want a separate view only password, simply enter “n” for this.
- Once that is all done the server will be up and running. The following command will need to be run every time the Pi reboots or for some reason the process is stopped.
The Raspberry Pi VNC server should now be up and running correctly. If you want to have the software start up automatically at boot up then simply follow the next couple of steps otherwise we’re ready to setup the client side of things.
Having the VNC server start automatically (Optional)
Having to run the command above is not ideal so you might want to have it start automatically whenever your Pi is booted up.
The following steps are pretty straightforward and will take you through the steps to having the server startup on port 1 at boot up.
- First open up the rc.local file by entering the following command.
sudo nano /etc/rc.local
- Now enter the following before the exit 0 line.
su - pi -c '/usr/bin/tightvncserver :1'
- Save and exit by pressing ctrl + x then y.
- Restart the Pi by running the following command.
- You can confirm that it is running by running the following command.
- It should say “A VNC server is already running at :1”
- If you need to kill the server simply enter the following command (Change 1 if you’re using a different port):
vncserver -kill :1
Once you’re done you can proceed to setting up the client on your other computer, tablet or whatever device you plan on using.
Setting up the VNC client on your PC
Installing and setting up a VNC client on your computer is incredibly easy. There are quite a few different VNC software packages out there but in this tutorial I am going to be using realvnc.
- To begin headover to the realvnc website and download the VNC viewer client relevant to your operating system.
- Once downloaded, simply open it up. (If you wanted server software as well you will need to download the full software package.)
- Enter your IP address with the port 1 in the field that says VNC server. For example mine is, 192.168.1.108:1
- Now simply press connect.
- It should then give you a warning message, simply press continue on this.
- Then it will ask you for the password you set for it earlier. Simply enter the password that we set earlier.
- The VNC window should load and you will now have access to your Raspberry Pi remotely.
This is basically all you need to do to have Raspberry Pi remote desktop up and running. If you do come across any issues I have small troubleshooting section below otherwise be sure to leave a comment.
- I can’t connect! – Be sure to double check the IP you entered and make sure it is the same as the Pi’s. Also be sure to make sure that the VNC server software is running. Most routers also dynamically give out IP’s so it is possible the IP will change over time. To fix this setup a fixed IP or check the IP whenever you go to connect.
- I want access outside my local network – This will open security issues but you’re able to easily do this by setting up port forwarding. Remember the VNC server is running on port 1.
- I want a different/larger sized screen on my VNC client – When you go to start the VNCsever you can add an extra command called geometry and then the screen size width and high you want (This is in pixels). The command is:
vncserver :1 -geometry 1440x900
I hope that you have been able to setup your Raspberry Pi VNC server correctly and that you’re able to remove desktop to your Pi easily. If you’re still having trouble or that I have missed something, then please feel free to drop a comment below. If you’re looking for more than be sure to check out some of my latest DIY raspberry pi projects.