FigNewton
Posts: 28
Joined: Mon Jun 29, 2015 4:41 pm

GutenFree

Mon Aug 03, 2015 2:04 am

I have been fiddling around with my new Raspberry Pi 2 for a couple of weeks now and came across the PirateBox (http://piratebox.cc/start) and was intrigued. I think that it's an excellent idea to be able to carry around a little device that can be used to distribute information. I have also been a long time fan of Project Gutenberg (http://www.gutenberg.org). So I got to thinking that it would make sense to use the Raspberry Pi to help distribute these free books. I came up with the name GutenFree for this goofy little project.

Project supplies:
RaspberryPi
Wifi Dongle that will support AP mode
16gb micro/sd card
Battery power for remote use

Step 1
The first step in my project was to acquire the Gutenberg DVD. I went with the April 2010 Dual Layer DVD image which is 8gb in size. You can choose which image you want from here:

http://www.gutenberg.org/wiki/Gutenberg ... VD_Project

Step 2
After you have the DVD, you need to set up your sd card with Raspbian. I am not going to go into the specifics of this as it is well documented elsewhere. Don't forget to change your password for the user 'pi'. Also, make sure you are up to date with you libraries (sudo apt-get update, sudo apt-get upgrade).

Step 3
I used a wired connection for the rest of this setup so that I could get my wireless configured as an Access Point and still have an internet connection. If this is not feasible for you, then you might want to perform the wireless changes last after you get Apache installed. For step 3, I moved the iso file over to my sd card. There are multiple ways you can perform this. I sftp'ed the file over from my laptop. You could also mount your sd card on another machine and copy directly. Whatever works for you. Make sure you note the location of the iso file as you will need to set this up as a mount point later on. I put my Gutenberg iso in the following location: /home/pi/ProjectGutenberg/pgdvd042010.iso . My plan is to mount the iso in the /media folder under another folder name Gutenberg. So you need to cd to /media and 'sudo mkdir Gutenberg'. This will get the mount point set up that you will use later in the process.

Step 4
You need to set up your wireless card as an access point. There are a number of different tutorials on this around the web, and I am sure I used a couple of them to figure this out. I will leave this to you to configure to your specific wifi dongle if this doesn't work on yours. If you have issues, then dongle compatibility is most likely the cause. For this project I decided to set the ip range to 192.168.33.x. Thirty three rhymes with free, so it made sense to me. I also do not set up any kind of encryption. This is an open wifi connection. In my /etc/network/interfaces I have this:

Code: Select all

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.33.1
netmask 255.255.255.0
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
I have this in my /etc/hostapd/hostapd.conf file

Code: Select all

interface=wlan0
driver=rtl871xdrv
ssid=GutenFree
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
ieee80211n=1
wmm_enabled=1
Step 5
Install Apache2. (sudo apt-get install apache2). Now you don't have to use Apache as there are a couple of other http servers out there. I am familiar with Apache so I decided it would be what I went with. You are free to experiment with this as you see fit.

Here is what I used for my /etc/apache2/sites-available/default file entry. I have change the DocumentRoot, put in a Directory entry for the Gutenberg iso, and also put in some basic Track/Trace remediation entries for security.

Code: Select all

<VirtualHost *:80>
	ServerAdmin [email protected]

	#DocumentRoot /var/www
	DocumentRoot /media/Gutenberg
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /media/Gutenberg/>
		Options -Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined

	#Note, these are industry standard track trace remediation entries. One set is recommended in each
	#virtual host entry and one set outside of the virtual hosts.
	RewriteEngine on
	RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
	RewriteRule .* - [F]
</VirtualHost>

#Note, these are industry standard track trace remediation entries. One set is recommended in each
#virtual host entry and one set outside of the virtual hosts.
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
Step 6
Install dnsmasq. I used the instructions from this website to set up a captive portal.
http://sirlagz.net/2013/08/23/how-to-ca ... pberry-pi/

sudo apt-get install dnsmasq
sudo vi /etc/dnsmasq.conf

Code: Select all

#Added by FigNewton 7/9/15
interface=wlan0 # To get dnsmasq to listen only on wlan0.
dhcp-range=192.168.33.5,192.168.33.225,255.255.255.0,12h # This sets the available range from 192.168.33.5 to 192.168.33.225
# It also sets the subnet mask to 255.255.255.0 and specifies a lease time of 12 hours.

#This will redirect all traffic to the local website.
address=/#/192.168.33.1
Step 7
You want the Gutenberg iso to mount at boot time. I mounted it to /media/Gutenberg so that it would match the document root that I set up in the apache config file.

sudo vi /etc/fstab

Code: Select all

#Adding in the Gutenberg ISO
/home/pi/ProjectGutenberg/pgdvd042010.iso /media/Gutenberg auto loop 0 0
Once all of this is set up, you can reboot the RaspberryPi and unplug the ethernet cable. This should reboot as a standalone access point with the name 'GutenFree' that you can connect to without a passcode. From there open your browser and point to any website and you should be re-directed to the Gutenberg CD. You can then look up any of the titles on the dvd and download them to your device. It is a fun little project and I plan to fire this up and leave it running anytime I am in town, or nearby where people might see it.

For my battery power, I am using a 6000mah Pocket Juice Multicharger that I picked up at WalMart. So far I am able to get 6-8 hours of runtime while still having a single bar (out of four) of power left in the device. I don't want to run down completely as I would rather power down the RaspberryPi on my own. For that, I connect to the GutenFree wifi network, and then telnet into 192.168.33.1 and login as 'pi' and my password. I have a terminal program on my phone that will ssh and allow me to issue the shutdown command.

I am open to any suggestions, ideas or contributions to this thread. If you decide to make one, post here and let us know.

This is the website you will see in your browser once connected.
GutenFree_small.png
GutenFree_small.png (30.37 KiB) Viewed 4498 times

User avatar
seeoh9
Posts: 16
Joined: Wed Feb 15, 2017 4:30 pm

Re: GutenFree

Tue Feb 21, 2017 1:55 pm

Thank you so much @FigNewton for sharing your ingenius idea! I too am a major fan of Project Gutenberg and am far too excited to give this a try!
I'll let you know how it goes in the next week or two!

:o

Return to “Other projects”

Who is online

Users browsing this forum: No registered users and 11 guests