Operating a computer headless means that you access the computer over a local network, so you don't need a keyboard, mouse, or monitor. The RaspberryPi is the server, and the computer you are using to access it is the client. You will notice that in the picture the only wires connected to the RaspberryPi are the power and an ethernet cable. This tutorial will show how to setup your RaspberryPi so it can be accessed from another computer on your local area network. Next it shows how to setup your client computer to access the RaspberryPi, and it provides a GUI based utility to make everything easy.
Step 1: Setup the RaspberryPi
For now you want your RaspberryPi hooked up to a monitor, keyboard, and mouse. It is much easier to get everything working this way.
Boot your RaspberryPi and start raspi-config with the command:
Open the Advanced Options menu and enable ssh.
Install tightvncserver with the command: sudo apt-get install tightvncserver
Run tightvncserver with the command: tightvncserver
You will be asked for a password for tightvncserver.
Now run the command: ifconfig
Your MAC address is called "HWaddr" in ifconfig. It will be six hex numbers seperated by colons.
Your IP address is called "inet addr" in ifconfig. It will be four decimal numbers seperated by periods.
Write down both of these numbers, you will need them later.
When you are finished reboot.
Most routers have a setting to reserve an IP address for a specific machine. Setup a reserved IP address for your RPi so the script described in the next step will always find it. This will link a MAC address to a permanent IP address.
Step 2: Setup the Client Computer
The installation procedure for setting up the client computer to communicate with the Raspberry is for a Linux desktop and has been tested with Ubuntu. It should work the same on any derivative of Debian. If you are running Windows use Putty.
On your client computer:
Open a terminal and install tightvncviewer and zenity with the command:
sudo apt-get install vncviewer zenity
Download the RPi.sh file and copy it into your home directory.
Edit the file you downloaded to replace [IP ADDRESS] with your IP address.
Make it executable with the command: sudo chmod +x RPi.sh
The zenity program gives you a GUI interface to access the RaspberryPi.
With some versions of zenity you can double click on the desired option and it will work. On others you must click on the option then click on OK.
The RPi.sh script provides three options:
ssh - You have a terminal attached to the PRi you can run any text based program in the terminal.
The +X on the command line allows you to run graphic programs on the RPi and display the results on the desktop screen.
For a quick demonstration of how this works type "xclock" into the terminal.
sftp - This option opens a file manager window so you can easily move files to and from your RPi. In the script it specifies the nautilus file manager. If you are using another file manager you will need to change this line in the script.
VNC - This option gives you the RaspberryPi desktop. You may want to change the geometry settings to better fit your screen.
Open a terminal and try running the script with the command
to make sure you can communicate with the RPi before moving on to the next step.
Step 3: Go Headless
Now you can disconnect the keyboard, mouse, and monitor.
Open a terminal on your client computer and run the script with the command: ./RPi.sh
You should see a terminal window and the window to select what you want to do. It will look something like the first picture.
The second shows the full RaspberryPi desktop running in a VNC window.
sertce made it!