Friday, 17 January 2014

I've decided to bring my Pi in from the car and use it as a low power terminal server for ssh and vnc access to my house while I'm away. Things have moved on a little bit since I carried out my original install and you can now carry out out through an ssh connection once you have copied the operating system image onto the SD card. This means no plugging a keyboard into it or a monitor to get the operating system up and running.

I'm running Linux on my desktop so these instructions are based on around that, you can download putty for Windows and use that as your ssh client.

The first thing you need to do is download the latest version of the OS from here.

Then you put the SD card into your PC and type dmesg | tail to find out what device it is, in my case it came up as /dev/sdc. It is important to make sure you have the right drive otherwise you are going to write the image downloaded onto your boot drive.

Once you have that information the next thing to do is to unzip the image by typing:

unzip 2014-01-07-wheezy-raspbian.zip replacing the file name with the one you have downloaded.

Now we come to writing the image to the SD card, you can do this with the command:

sudo dd bs=1M if=20xx-xx-xx-wheezy-raspbian.img of=/dev/sdb

This will create the system disk with which to boot your Pi from. Once this has completed, insert the card into the Pi, start it up with an ethernet lead connected and you should see all the lights coming on. You need need to find out the IP address assigned to it, you can either look at the router connected devices page, this varies from router to router or you can install nmap to scan your network and report back to you, if it's not already installed type in:

sudo apt-get install nmap or whatever it takes to install it on your distro and then:

sudo nmap -sP 192.168.0.1-254

The latter bit depends on the range of IP addresses from your router, if it was Belkin it would be 192.168.2.1-254.

Once you get the report back, one of the entries should list the Pi, in my case it was 192.168.0.8, so in terminal I typed:

ssh pi@192.168.0.8

Pressed enter, said yes to the security warning and entered the default password of rsapberry, I was now connected to the device and then had to finish setting it up.

Type:

sudo raspi-config

This will launch the configuration tool and you should see a screen like the one below.

You need to go down to advanced and once in there press enter on the update option, after that you can expand the file system, ensure that ssh is set to start on boot, change the hostname and then select Finish to write all the changes and reboot the system.

As a watcher of Blakes 7 and since my Pi is in a clear plastic case I have called it Orac, once it's booted back up you can connect via ssh again using the command:

ssh pi@orac

Enter the password raspberry and then create you own user with the command:

sudo adduser username

Then give the user a password with:

sudo passwd username

Then add the user to the sudo group with

sudo adduser username sudo

If the remote username is the same as the one on your desktop, you just need to type ssh orac to connect or whatever the name of your Raspberry Pi is.

The last thing to do is to get a gui running on the Pi so you can control it with a vnc client, you don't have to but it makes life easier.

This is done using the command:

sudo apt-get install tightvncserver

Once it's installed, you can run it using:

vncserver -depth 16 -geometry 1024x768

This will ask you for to enter a password for the connection

Then you can connect to it with a vnc client at orac:1

or vncviewer orac:1

And that's it

I can now setup port forwarding on my router and connect to this from the outside world with ssh or vnc and can send and receive files with sftp.

A big thank you to this page for providing the information which I have used extensively.