Monday, 18 March 2013

Remotely Connect to a Raspberry Pi Desktop

I run my Raspberry Pi as a headless server. That is I don't have a television, mouse or keyboard attached to it. I log in remotely using SSH, or Secure Shell. Generally having access to the command line allows you to do most of what you need to do. However there are the odd times when you need access to a desktop on the Linux system.

So without having to connect my Raspberry Pi to a television and other peripherals how do I log into it remotely and have access to the desktop? The answer is by installing a VNC (Virtual Network Computing) server.

Installing a VNC Server on the Raspberry Pi

The first stage of this is you need  to install tightvncserver on the Raspberry Pi.

So once you have either remotely logged into your Raspberry Pi using SSH or, if you are logged in directly, you have opened LXTerminal, you need to install a VNC Server. Remember to update the list of available software packages first:

sudo apt-get update




Then install Tight VNC Server with:

sudo apt-get install tightvncserver



When asked 'Do you want to continue [y/n]?' press 'y'.

tightvncserver and probably a few other programs which tightvncserver is dependant on will install.

Now to configure this type:

tightvncserver



and you will be asked to type in a password. You will need to remember this for later!

Although it doesn't matter what you use for your password, tightvnc only uses the first 8 characters of your password. However if you type in more than 8 characters, that is fine, it will always ignore the characters you type after the first 8. The reason I say this is typing more than 8 characters produces the following warning.


If you are happy with the password you have chosen, then don't worry about this message. Personally - I just ignore it. :-)

You are then asked to verify your password, so simply retype your password.

The next question is 'Would you like to enter a view-only password (y/n)?'



I dont think this is necessary, so I enter 'n'. However if you think you would use it then press 'y'.

At this stage the VNC server is running. In subsequent reboots, to start the VNC server, now you have installed it you would have to type:

vncserver :1




Software to Enable Logging in Remotely

Once you have the VNC Server up and running you can now log into it from another machine.

If you don't have already, you will need a piece of software on the Mac or PC to log into this. I tend to use TightVNC Server on the PC and Chicken of the VNC on the Mac

TightVNC server can be downloaded from here.

http://www.tightvnc.com/

Chicken of the VNC for the Mac can be downloaded from here:

http://sourceforge.net/projects/cotvnc/

Using TightVNC

For TightVNC server you need to type the IP address of the Raspberry Pi into the text box. If you don't know what the IP address is you can follow these instructions to remotely find the IP address of your Raspberry Pi.




Click on connect and there you have it a GUI connection from another computer into your Raspberry Pi.


Using Chicken of the VNC

To use Chicken of the VNC, next to host type your IP Address followed by a colon and 5901 i.e.

192.168.1.66:5901

For those wondering what the 5901 signifies, this is specifying the port number. This number should be equal to 5900 + the number you typed in after vncserver. In our case we typed vncserver :1 so the port is 5900 + 1 which is 5901.

You will then need to type your password you entered when installing vncserver.

Finally click connect!


A window should appear showing your Raspberry Pi Desktop!






1 comment:

  1. Hello Dear,

    I Like Your Blog Very Much. I see Daily Your Blog, is A Very Useful For me.

    You can also Find F1 Savannah Cat Breeder We are a savannah cat breeder . Specializing in F1 Savannahs and F2 Savannah cats . We have savannah kittens available now for sale from $3,000 +.

    Please Visit at: https://www.f1savannahkittens.com/

    ReplyDelete