How to setup a VNC server on a Raspberry Pi for remote access.

Today I figured out how to setup a VNC server using tightvncserverPenguin tutor explains it very well on his website.

This is how I did it. Start off with a clean Raspbian Wheezy install. Make sure to use sudo aptitude update and sudo aptitude upgrade to get to the latest version.

Install the Tight VNC Server on the Rpi with the following command


aptitude install tightvncserver


You can start the tightvnc server with the following command


/usr/bin/tightvncserver:1 -geometry 1280×720 -depth 24


The first time you run the tightvnc server, you will have to set a password e.g. “raspberry”. You don’t need a view only password. In case you want to change the password a later moment, use the following command:



If you want to run tightvncserver at startup you have to do the following:


Create an init file


sudo nano /etc/init.d/tightvncserver


Make the content of the file look like this, user = “pi” desktop resolution is set to “1280×720” both can be changed:


# Set the USER variable VNC server

export USER=’pi’


eval cd ~$USER


case “$1” in


su $USER -c ‘/usr/bin/tightvncserver :1 -geometry 1280×720 -depth 24’

echo “Starting TightVNC server for $USER ”



pkill Xtightvnc

echo “Tightvncserver stopped”



echo “Usage: /etc/init.d/tightvncserver {start|stop}”

exit 1



exit 0


ctrl-x and Y to save


To complete execute the following commands:


sudo chown root:root /etc/init.d/tightvncserver

sudo chmod 755 /etc/init.d/tightvncserver

sudo update-rc.d tightvncserver defaults


The tightvncserver can be started and stopped with the following commands:


sudo /etc/init.d/tightvncserver start

sudo /etc/init.d/tightvncserver stop


In order to access the Raspberry Pi via VNC, you will need a VNC viewer.

That’s it!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s