|
|
(18 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| | | |
− | == Client Side ==
| |
− |
| |
− | extract the location client-side with [https://github.com/jseidelin/exif-js EXIF-JS]
| |
− |
| |
− | == RPi side ==
| |
− |
| |
− |
| |
− | Lets set up our map server with local cached image files
| |
− |
| |
− | # [http://elinux.org/RPi_Nginx_Webserver install Nginx]
| |
− | <nowiki>
| |
− | sudo apt-get update
| |
− | sudo apt-get install nginx
| |
− | sudo service nginx start
| |
− | </nowiki>
| |
− | # Make a link to /var/www to make things easier
| |
− | <nowiki>
| |
− | sudo ln -s /var/www /home/USER/code
| |
− | </nowiki>
| |
− |
| |
− | (# [http://wiki.nginx.org/PHPFcgiExample now set up PHP with fastCGI])
| |
− | (# [http://gis.stackexchange.com/a/102775 set up mapserv])
| |
− | (# [https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps add mapserv to cache])
| |
− |
| |
− |
| |
− | # Set up AP with hostap (instructions from [http://elinux.org/RPI-Wireless-Hotspot set up AP with udhcpd])
| |
− | <nowiki>
| |
− | sudo apt-get install hostapd
| |
− | </nowiki>
| |
− | edit the file /etc/hostapd/hostapd.conf
| |
− | <nowiki>
| |
− | interface=wlan0
| |
− | ssid=TacticalSpaceLab
| |
− | hw_mode=g
| |
− | channel=6
| |
− | auth_algs=1
| |
− | wmm_enabled=0
| |
− | </nowiki>
| |
− | Edit the file /etc/default/hostapd and change the line:
| |
− | <nowiki>
| |
− | #DAEMON_CONF=""
| |
− | </nowiki>
| |
− | to
| |
− | <nowiki>
| |
− | DAEMON_CONF="/etc/hostapd/hostapd.conf"
| |
− | </nowiki>
| |
− | Start it up, and add it to start at boot
| |
− | <nowiki>
| |
− | sudo service hostapd start
| |
− | sudo update-rc.d hostapd enable
| |
− | </nowiki>
| |
− |
| |
− | sudo service hostapd start
| |
− |
| |
− | # [http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/ edimax version of hostapd]
| |
− | (# [http://www.pihomeserver.fr/en/2014/05/22/raspberry-pi-home-server-creer-hot-spot-wifi-captive-portal/ captive portal setup!!])
| |
− | (# '''[http://www.revsys.com/writings/quicktips/nat.html but with iptables command from here, since the others are broken]''')
| |
− |
| |
− | # Set up interface for serving DHCP and DNS
| |
− | <nowiki>
| |
− | auto eth0
| |
− | iface eth0 inet static
| |
− | address 10.1.2.1
| |
− | netmask 255.255.255.0
| |
− |
| |
− | iface wlan0 inet static
| |
− | address 10.1.2.2
| |
− | netmask 255.255.255.0
| |
− | </nowiki>
| |
− | # Install dnsmasq "sudo apt-get install dnsmasq" and configure
| |
− | <nowiki>
| |
− | # captive portal to this
| |
− | address=/#/10.1.2.1
| |
− | interface=eth0
| |
− | dhcp-range=10.1.2.5,12h
| |
− | </nowiki>
| |
− | # restart dnsmasq
| |
− | <nowiki>
| |
− | sudo /etc/init.d/dnsmasq restart
| |
− | </nowiki>
| |
− |
| |
− | # dnsmarsq script logging...
| |
− | Create /var/log/dhcp_leases file with write
| |
− | create /usr/bin/logdhcp, make executable
| |
− | add it to dnsmasq config
| |
− | <nowiki>
| |
− | #!/bin/bash
| |
− | destfile=/var/log/dhcp_leases
| |
− | #if [ "$1" == "add" ]
| |
− | #then
| |
− | if [ -f "$destfile" ]
| |
− | then
| |
− | echo "$1 $2" >> "$destfile"
| |
− | fi
| |
− | #fi
| |
− | </nowiki>
| |
− | [[File:logging_dhcp.png|thumbnail]]
| |
− |
| |
− | ended up using dnsmasq for DNS and DHCP. Setting DNS forward IP to local for captive portal setup
| |
− |
| |
− |
| |
− | [http://www.raspberrypi.org/forums/viewtopic.php?f=36&t=39225 some popup mehods]
| |
− |
| |
− | /var/www
| |
− |
| |
− | [http://maps.tacticalspace.org/var-MQ-Feb2015.zip MQ var directory archive]
| |
− |
| |
− | Remember to make all /var/www/ folders readable with:
| |
− | <nowiki>
| |
− | sudo find /var/www -type d -exec chmod a+x {} +</nowiki>
| |
− | and possibly
| |
− | <nowiki>
| |
− | sudo find /var/www -type d -exec chown {} root:root +</nowiki>
| |
− |
| |
− | == For Online ==
| |
− |
| |
− | [http://maps.stamen.com/m2i/image/20130610/mapstack_ZHVazuJTG7s beautiful Stamen Design map that can be used]
| |
− | [[File:Map example1.png|thumbnail]]
| |
− | [[File:Map example2.png|thumbnail]]
| |