Raspberry Pi(rate)Box 1.0 & 2.0 DIY

Note: This howto is for crafting your own PirateBox image. Currently we have prebuild images for all RaspberryPi versions available. You find further instructions on the Raspberry Pi DIY page.


Known working USB Wifi-dongles: RaspberryPI PirateBox compatibility list

RaspberryPI Shutdown button via GPIO

Manual install

The following steps describes the procedure, if you want to store your files on the SD-Card. Additional steps are required, if you want you uploaded data on a USB drive.

  • Download: Raspbian “wheezy” http://www.raspberrypi.org/downloads
  • Install Raspberry as normal: http://elinux.org/RPi_Easy_SD_Card_Setup
  • Boot as normal with a Monitor, Keyboard & connected LAN (DHCP with Internet access) :!:
  • Do the following steps in Raspi-Config
    • Enable SSH Server via raspberry-config
    • change Password
    • Expand FS
    • Finish & reboot now
  • Wait until reboot is finished- needs a while because the OS is resizing the filesystem during this reboot
  • Install needed packages and prepare some stuff:
  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  php-cli php-cgi
  sudo rm /bin/sh
  sudo ln /bin/bash /bin/sh
  sudo chmod a+rx  /bin/sh
  • Edit network config file /etc/network/interfaces
 auto lo
 
 iface lo inet loopback
 iface eth0 inet dhcp
 
 iface wlan0 inet manual
 ### disalbed for PirateBox
 #allow-hotplug wlan0
 #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 #iface default inet dhcp
  • Fetch and copy over PirateBox Source
  wget  http://downloads.piratebox.de/piratebox-ws_current.tar.gz
  tar xzf piratebox-ws_current.tar.gz
  cd piratebox
  sudo mkdir -p  /opt
  sudo cp -rv  piratebox /opt
  cd /opt/piratebox
  sudo sed 's:DROOPY_USE_USER="no":DROOPY_USE_USER="yes":' -i  /opt/piratebox/conf/piratebox.conf
  sudo ln -s /opt/piratebox/init.d/piratebox /etc/init.d/piratebox
  sudo update-rc.d piratebox  defaults 
  sudo /etc/init.d/piratebox start

:!: After this, the PirateBox should be run on default-startup. PirateBox works only on Wifi-Access with redirect. Network on Ethernet-Port is a normal “dhcp-client”, so no interference with your home network :!:


Sidenotes for a later image:

  • Enable SSH default

PirateBox on RaspberryPI without Wifi

Before starting the piratebox first time…

FIXME

PirateBox-Configuration

Do you want to run your PirateBox without a wifi device. This is no problem. Make sure you have changed the following parameters in your /opt/piratebox/conf/piratebox.conf

DO_IFCONFIG="yes"
DO_IW="no"
USE_APN="no"
# The following can be set to no, too. Depends if the device shouldn't be a DHCP & DNS Server (no redirect to piratebox.lan)
USE_DNSMASQ="yes"
INTERFACE="eth0"
DNSMASQ_INTERFACE="eth0"

Network-Configuration

And you have to edit /etc/network/interfaces , which have too look like

auto lo

iface lo inet loopback
iface eth0 inet **manual**


iface wlan0 inet manual
### disalbed for PirateBox
#allow-hotplug wlan0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

After this, the box is accessible under 192.168.77.1 (instead of 192.168.1.1 on OpenWRT)

Post-Installation

Activate the Kareha Image and Discussion Board

Enable the Kareha Image and Discussion Board on the piratebox:

sudo /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard

Use the vi text editor (vi cheat sheet) to change the admin username and password (ADMIN_PASS and SECRET). Don't forget to remove a leading # in the both lines, if exists:

sudo vi /opt/piratebox/www/board/config.pl

Activate Timesave Functionality

Enable Timesave support on the piratebox:

sudo /opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf install

Activate the UPnP Media Server

First, install minidlna if it is not present on the system. WARNING: your raspberry pi must be connected to the Internet to download remote packages:

sudo apt-get install minidlna

Then, save minidlna default config file and replace it with the one provided with piratebox:

sudo cp /etc/minidlna.conf /etc/minidlna.conf.bkp
sudo cp /opt/piratebox/src/linux.example.minidlna.conf /etc/minidlna.conf

Finally, configure the system to automatically start minidlna when power up:

sudo update-rc.d minidlna defaults
sudo service minidlna start

The minidlna should start.