The first step in preparing the Raspberry Pi is to install and configure the Raspbian software.
- Load Raspbian onto the SDcard. Instructions for how to do this can be found here.
- Insert the SD card into the slot on the Raspberry Pi.
- Connect the Raspberry Pi to a display, keyboard, mouse, LAN with access to the internet, and to a 5 volt USB power adapter as shown in the "Raspberry Pi Setup" diagram.
- Boot the Raspberry Pi and perform first time configuration according to the instructions here. When configuring Raspbian, do not configure the graphical user interface to start automatically. It is a good idea to change the password for the Raspberry Pi at this time.
The second step is to install and configure the PirateBox software. Boot the Raspberry Pi and log in. Issue the following commands (note that in the list of commands below, the wget command may get split across two lines because of the formatting of this instructable in your browser - the command needs to be entered on a single line: wget and the whole URL in quotes).
sudo apt-get update
sudo apt-get -y install lighttpd
sudo /etc/init.d/lighttpd stop
sudo update-rc.d lighttpd remove
sudo apt-get -y install dnsmasq
sudo /etc/init.d/dnsmasq stop
sudo update-rc.d dnsmasq remove
sudo apt-get -y install hostapd
sudo /etc/init.d/hostapd stop
sudo update-rc.d hostapd remove
sudo apt-get -y install iw
tar xzf piratebox-ws_current.tar.gz
sudo mkdir -p /opt
sudo cp -rv piratebox /opt
sudo ln -s /opt/piratebox/init.d/piratebox /etc/init.d/piratebox
sudo update-rc.d piratebox defaults
sudo /etc/init.d/piratebox start
There will be an error message after the last command that indicates that the network interface could not be started: this error occurs because the the WiFi USB adapter is not plugged in. This error is OK at this point - it will not adversely effect the PirateBox. It will work correctly when the Raspberry Pi is rebooted with the WiFi adapter plugged in.
The third step is to install the Python program that will illuminate the LEDs when the WiFi is up and running and to install the Python program that will shutdown the Raspberry Pi when the push button is pressed.
Create the directory where the Python programs will reside by issuing the following commands at the command prompt:
Issue the following two commands to get the Python programs:
Using a text editor, edit the "/etc/rc.local" file and add the line below to the bottom of the file before the line with "exit 0". Since "/etc/rc.local" is a system file you will need to use the sudo command when you start your editor - for example "sudo nano /etc/rc.local". The line of code you are adding will automatically start the Python program that monitors the shutdown button. Make sure to put the ampersand ("&") at the end of the line.
Lastly, use sudo and a text editor to edit "/etc/network/interfaces" to make the contents look like exactly like this:
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet manual
#iface default inet dhcp
post-up python /home/pi/python_programs/illuminate_leds.py
The last line runs the Python program that illuminates the blue LEDs when the WiFi is up and running.
The Raspberry Pi is now setup!
Shutdown the Raspberry Pi using the command
and disconnect all of the cables from the Raspberry Pi.