2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								How to set up a Raspberry Pi to use as a Subsurface downloader
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								1) Get an image file for RaspianPi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								2) Set up your local network according to https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								You also need to create a file named "ssh" in the boot partition to enable the ssh server. Set the hostname to subsurfacepi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 21:52:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								3) Install additional packages with their dependencies
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo apt-get install cmake-curses-gui debsums gvfs-bin ifuse ipheth-utils libcrypto++-dev libcurl4-openssl-dev libgit2-dev \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								libimobiledevice-utils libmtp-dev libqt5svg5-dev libqt5webkit5-dev libxslt1-dev libzip-dev qml-module-qtlocation \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								qml-module-qtpositioning qml-module-qtquick2 qt5-default qtconnectivity5-dev qtdeclarative5-private-dev qtpositioning5-dev qtscript5-dev 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								4) Clone the subsurface repository and build it as for any Debian based system: Run build.sh, then cd to the build directory, run
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ccamke .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								and select SUBSURFACE_TARGET_EXECUTABLE as DownloaderExecutable and make once more
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								5) Add the following lines to /etc/apache2/sites-available/000-default.conf
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ScriptAlias /pi-cgi-bin/ /home/pi/cgi-bin/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        <Directory "/home/pi/cgi-bin">
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                AllowOverride None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Order allow,deny
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Require all granted
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        </Directory>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        <Directory "/usr/lib/cgi-bin">
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                AllowOverride None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Order allow,deny
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                Allow from all
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        </Directory>
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 21:52:53 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ScriptAlias / /usr/lib/cgi-bin/downloader.pl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								activate the CGI Modules
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo ln -s /etc/apache2/mods-available/cgi* /etc/apache2/mods-enabled/
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								and restart apache2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-27 23:14:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								6) Install two perl modules:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo cpan CGI
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo cpan Get:Repository
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								7) copy ~/src/subsurface/scripts/downloader.pl to /usr/lib/cgi-bin and run
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								sudo chmod a+x /usr/lib/cgi-bin/downloader.pl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								It should then be there when you direct your browser to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								subsurfacepi.local/cgi-bin/downloader.pl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-27 23:14:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								8) Give the www user access to the serial interface
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								sudo adduser pi dialout
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								and restart apache2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-27 23:14:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								9) Create a directory to store the data
							 
						 
					
						
							
								
									
										
										
										
											2020-11-27 22:21:05 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								sudo mkdir /opt/ssrf/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo touch /opt/ssrf/ssrf.conf
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo chown -R www-data.www-data /opt/ssrf
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-27 23:14:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								10) If you want to use the pi with an iPhone where the iPhone provides the internet connectivity, follow https://gist.github.com/antronic/157e047cdefa98b3150195c2eacb56b8