Raspberry Pi initial setup

Random notes

Download the "Raspbian Jessie Lite" image:
https://www.raspberrypi.org/downloads/raspbian/

Writing the image:
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

sudo dd bs=4M if=2016-05-27-raspbian-jessie.img of=/dev/sdd

connect a screen on HDMI and check the My IP address is xxx
To connect to ipv6 hosts over ssh use the -6 flag
ssh -6 pi@ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

Wifi access point setup:
sudo apt-get install dnsmasq hostapd
sudo nano /etc/dhcpcd.conf

denyinterfaces wlan0

sudo nano /etc/network/interfaces

allow-hotplug wlan0
iface wlan0 inet static
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

sudo service dhcpcd restart
sudo ifdown wlan0
sudo ifup wlan0

sudo nano /etc/hostapd/hostapd.conf

# This is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network
ssid=inapp

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
wmm_enabled=1

# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

# Accept all MAC addresses
macaddr_acl=0

# Use WPA authentication
auth_algs=1

# Require clients to know the network name
ignore_broadcast_ssid=0

# Use WPA2
wpa=2

# Use a pre-shared key
wpa_key_mgmt=WPA-PSK

# The network passphrase
wpa_passphrase=raspberry

# Use AES, instead of TKIP
rsn_pairwise=CCMP

(testing only)
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf

interface=wlan0      # Use interface wlan0
listen-address=172.24.1.1 # Explicitly specify the address to listen on
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere
server=8.8.8.8       # Forward DNS requests to Google DNS
domain-needed        # Don't forward short names
bogus-priv           # Never forward addresses in the non-routed address spaces.
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time

# inapp name resolution is local
local=/inapp/

sudo nano /etc/hostname
sudo nano /etc/hosts

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

172.24.1.1       inapp

sudo service hostapd start
sudo service dnsmasq start


sudo adduser ina
sudo visudo
sudo userdel -r pi

sudo nano /etc/fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
/dev/mmcblk0p3  /mnt/docs       ext4    defaults,noatime  1       0

sudo mkdir /mnt/docs

sudo apt-get install lighttpd

sudo apt-get install libqt5core5 libqt5websockets5 libqt5sql5

Price of the Raspberry Pi:
- element14: 31.41€ excl. VAT
- RS: 1-5 £27.99, 5+ £26.37 (33.40€)