LibraryBox is based on the TP-Link MR3020 router, which costs less than $40 and is available from Amazon.
LibraryBox also requires a USB flash drive to be used in conjunction with the MR3020. You can use any FAT32 formatted USB flash drive, which means that there is a soft limit of 32GB in size for your files. I haven't tested anything larger than 32GB, at least. I like the SanDisk Cruzer line of drives, that come in a variety of sizes and costs from Amazon: 4Gb for $5.75, 8GB for $7.95, 16GB for $11.24, and 32GB for $21.67.
Once you've got your MR3020 and a USB flash drive, just follow the three steps below.
- Download a custom copy of OpenWrt for the MR3020 at http://stable.openwrt.piratebox.de/ar71xx/openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin (OpenWRT firmware modified by Matthias Strubel to include all needed kernel modules). This is the firmware that will prepare the router for all of the other customization.
- Set the toggle switch located beside the LAN/WAN port to WISP mode
- If using a computer with wifi, turn off the wireless in order to force it to connect to the router over ethernet.
- Connect the router via ethernet cable to your computer, connect it to a power source via USB cable, and open a web browser to http://192.168.0.254
- Enter the default username & password (admin & admin)
- Navigate to System Tools > Firmware Upgrade and select the OpenWRT firmware that you downloaded in step 1 (openwrt-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin)
- After the upgrade completes, the MR3020 will restart. Do not unplug the router or disconnect the ethernet cable during the firmware flash.
Step I is done. At this point, you have an MR3020 running OpenWRT.
Installing Piratebox doesn’t require that you understand the command line...you can simply follow the instructions, and you should be fine. But if you mistype something, it helps if you know your way around Linux a bit. Once the MR3020 restarts, begin this section.
- Telnet to the device:
telnet 192.168.1.1(yes, this is the right IP address, a la the OpenWRT install)
- Use the passwd command to set your login password - this will enable SSH:
- In the next step you'll be editing the MR3020 network configuration at /etc/config/network so that it can access the Internet and install dependencies. You will be changing 4 lines of the file. 2 of these changes (the lines with dns in them) will be the same for every LibraryBox. The other 2 depend on your network configuration. You'll need to determine values for the lines that start with option ipaddr and option gateway.
The value for option gateway should be the IP address of your network router.
The value for option ipaddr should be an IP address that is assignable by your network router. Example: If your network router is 172.16.0.1, then the two lines would be:
option gateway ‘172.16.0.1’ option ipaddr ‘172.16.0.101’The other two lines that need changing are list dns. I recommend using Google’s DNS servers for this, unless you have a good reason not to. If you have such a reason, then you probably already know what you should be using for these values...otherwise, stick to:
list dns ‘184.108.40.206’ list dns ‘220.127.116.11’Because network configurations and routers vary widely it’s impossible for me to give you step by step instructions for how to determine these values, but some judicious use of Google should help if you’re lost.
- Edit the network file with vi. vi is a text editor built into Linux that you will use to make the changes below. If you aren't familiar with vi, there are many help docs available online, but here's a good place to start. Read that over, then:
vi /etc/config/networkYou are editing the /etc/config/network file so that you set a static IP address for the MR3020, and the gateway that matches the IP range being delivered by your network router. I have chosen to use the DNS provided by Google, as it is fast and stable, but if you prefer you can use your network router’s DNS, or OpenDNS. The MR3020 needs to be able to access the Internet in order to update the packages necessary for PirateBox to run. This is the part where the largest number of failures occur in the install process, so take a moment to look it over, use the values you determined in Step 9.5. If you make a mistake at this point, it is possible to brick the MR3020 in such a way that it is no longer accessible. Be careful. You should modify the /etc/config/network file to look like this, where the lines in the second set with “ipaddr” and “gateway” are customized as noted in Step 9.5. You do not need to change any values in the first set of values:
config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth0' option type 'bridge' option proto 'static' option ipaddr '172.16.0.101' option netmask '255.255.255.0' option gateway '172.16.0.1' list dns '18.104.22.168' list dns '22.214.171.124’Another example: If your router is 192.168.0.1 (as many home routers are by default) and is set to assign IPs in the 192.168.0.X range, the lines in question would read:
option ipaddr ‘192.168.0.101' option gateway ‘192.168.0.1’The important thing is that the lines under config interface ‘lan’ for option ipaddr gets set to an address not currently in use on your network, and that option gateway gets set to the IP address of your router.
- Remove the power from the router, and plug in the FAT formatted USB drive. Do not disconnect it for the remainder of the Piratebox install.
- Enable your computer’s wifi once more.
- Connect the MR3020 to your network router with an ethernet cable and plug the the power back into the MR3020. Wait a couple of minutes until the MR3020 boots up. With your computer connected to your home network, try sshing into the MR3020 from your computer.
ssh email@example.comYou should be able to log into the router using the IP address you set in step 10 above..if you cannot, check your network settings by connecting the MR3020 directly to your computer via ethernet once more, and double-check the step 10 instructions. The MR3020 should be reachable on your network, at the address you gave.
- Ping google to ensure that your MR3020 can access the internet:
ping google.comIf you get packet response from google.com, you should be good to go for the next section. CTRL-C to stop the ping command. If you do not get a packet response, double check your /etc/config/network file, double check your IP range, and make sure that any router-based firewall is off, then try again.
- Add USB support to OpenWRT by installing and enabling the following packages:
opkg update opkg install kmod-usb-uhci insmod uhci opkg install kmod-usb-ohci insmod usb-ohci(NOTE: the opkg install lines may return the message: installed in root is up to date. This is fine, and is not an error.)
- Install Piratebox 0.3.2:
cd /tmp wget http://piratebox.aod-rpg.de/piratebox_0.3-2_all.ipk opkg update && opkg install piratebox_0.3-2_all.ipkThis will take a few minutes. Be patient and wait for the install process to finish completely before you do anything else. Removing power, pulling the USB, or otherwise interrupting the install is almost certainly going to brick your MR3020. After the installation completes, you can unplug the MR3020 from your network router, unplug the power to the MR3020, and power it back up, unplugged from your network router. At this point, you should have a working Piratebox, and should be able to connect to the new “Piratebox” SSID that your MR3020 is broadcasting via wifi.
- Download the librarybox.zip file from http://github.com/griffey/Librarybox and save it somewhere you can find it.
- Unzip the file. The result should be a folder, called simply “librarybox”, that has inside it several files and scripts.
- With the MR3020 powered down, remove the USB drive, and insert it into your computer. Copy the librarybox folder (the whole folder, not the contents) to the USB, in the root directory. Eject/remove the USB from your computer, plug it back into MR3020, and power the MR3020 back up.
- Connect your wifi to the “Piratebox” SSID, and reconnect to the MR3020 via SSH:
ssh firstname.lastname@example.org enter your password from step 9 to login. NOTE: this address is different from that in Step 13. The Piratebox install resets the IP that the MR3020 assigns itself.
- Navigate to the librarybox directory on the USB drive on the MR3020:
cd /mnt/usb/librarybox/And run the LibraryBox install script:
./librarybox.shThat script will copy the files necessary for the UI customizations into place, and alters values in other files. If you would like the details of the script, and want to follow where all the parts go, see http://librarybox.us/scripts.html
- By default, LibraryBox v1.5 is installed with Chatbox functionality, which some may prefer to remove. If you would like to remove the Chatbox, simply run the nochat script:
./nochat.shIf you later change your mind, SSH back in to the MR3020, navigate back to /mnt/usb/librarybox/ and run:
- Done! One more reboot, and you should now have a LibraryBox. When the MR3020 boots back up, you should see an SSID called “LibraryBox - Free Content!”. Connect to it via any wifi-enabled device, launch a browser, and you should see the LibraryBox homepage with the ability to browse and download files.
Once you have a running LibraryBox, you can power down the MR-3020, unplug the USB drive, plug it into your computer, and throw content into the PirateBox Share directory...anything you place here will show up alphabetically to be downloaded. If you’d like, you can download this bundle of Public Domain works to get started, or head to Project Gutenberg or Feedbooks to build your own.