So, your Raspberry Pi has arrived and you are ready to set it up? There are plenty of tutorials available but I thought I would add mine here as I don't recall finding all the information I used in a single place.
The Raspberry Pi that I'll be setting up is a Model B Revision 2 board with 512 mb of memory. This version has its own ethernet port. It should work for any setup where you can get an ethernet connection on boot up of a fresh raspbian operating system.
My setup is a home network behind a router using a Windows machine as my main desktop. I want to setup the Raspberry Pi without using a dedicated keyboard, mouse and monitor. I'd like to plug it into the network, and connect to it using VNC. This is quite possible provided that you know the IP address that your router or other DHCP server has handed out to your Raspberry Pi.
If you connect to your router or DHCP service you can find out where you can see the list of connected machines. This is entirely dependent on your brand of router but should be fairly straightforward. It will be one of the main features of your router or DHCP server. The idea is that you look at the list of connected machines, then connect your Raspberry Pi to the network, then the new machine that appears on your router's list of connected machines is the Raspberry Pi. You just need to record the IP address which you can then use to connect to the Raspberry Pi from your desktop.
To set this up from a Windows desktop you will need:
Putty - this is an ssh client for Windows that you will use to make the initial connection to your Raspberry Pi. You can download and install this from the
Putty Download Page. You want the installer for Windows which at the time of writing is called
putty-0.62-installer.exe.
VNC Viewer - you need a VNC Viewer to connect to a graphical session on your RaspberryPi. There are several available but I used TightVNC from the
TightVNC Download Page. You need the Windows installer for your type of system ( either 64 or 32 bit ).
Raspbian Image - You need an operating system to run on your Raspberry Pi. All the information on this site assumes you are using a Raspbian Wheezy image from the
Raspberry Pi Download page. The steps in this blog entry have been tested against the
2012-12-16-wheezy-raspbian.zip and
2012-10-28-wheezy-raspbian.zip images. The image needs to be written to an SD card using
Win32DiskImager. There are full instructions at the Raspberry Pi site on the
Download Page.
You have Putty and TightVNC installed on your WIndows desktop and a Raspbian image on the SD card in your Raspberry Pi.
You need to connect to your router or DHCP server and bring up the list of connected machines.
Connect your Raspberry Pi to your network via the ethernet port and plug in the power. Once the Raspberry Pi has booted fully ( all indicator lights are on and have stopped flashing ) you can refresh your view of your router or DHCP service and identify which IP has been assigned to your Raspberry Pi. in my case it was 10.10.10.211
You are ready to connect using Putty. Start the Putty programme and enter the Raspberry Pi IP as the host address.
Click the open button and you should be presented with a terminal window. The default username is 'pi' and the default password is 'raspberry'.
Because this is the first boot of your image you should see a message suggesting you run sudo raspi-config. You should do so now.
sudo raspi-config
You need to select the option to expand_rootfs.
Once this has completed you can 'finish'.
You now need to reboot the Raspberry Pi
sudo shutdown -r now
You can close the Putty window as the Raspberry Pi will disconnect anyway.
Once your Raspberry Pi has rebooted, you can start Putty again and connect as you did before.
After logging in, you will need to install the TightVNC server but before first usage you will need to update the package system.
sudo apt-get update
sudo apt-get install tightvncserver
Once installed, you need to run the tightvncserver once to set up your user configuration. Run the command
tightvncserver
You will be asked for a password. You will use this when connecting from your Windows desktop, You will also be asked if you want to set a 'view only' password. You can answer 'no'.
The final thing you have to do is install a script in the /etc/init.d directory to run your VNC service at system boot. There is a
prepared script here that you can install and configure using the following commands.
Change to the /etc/init.d directory
cd /etc/init.d
Download the script
sudo wget http://raspberrypi.citrusperl.com/src/vncboot
Set the script permissions
sudo chmod 755 vncboot
Configure system initialisation for the script
sudo update-rc.d vncboot defaults
The boot script is now installed and configured. You now need to reboot your Raspberry Pi
sudo shutdown -r now
You can close the Putty window ( the Raspberry Pi will disconnect on reboot).
Once the Raspberry Pi has rebooted you should be able to run the TightVNC viewer programme on your Windows desktop and connect to the Raspberry Pi at the known IP address.
You will be prompted for your VNC password that was set up earlier and then you should have access to a graphical Raspberry Pi desktop.