Raspberry Pi

From Gold Coast TechSpace
Jump to: navigation, search

Purchase

element14

RS Australia

Core Electronics

Pi Australia

Download Operating System

Raspbian

If you want to use your RPi with a monitor, keyboard and mouse download the "with desktop" version.

Flashing SD Card

Etcher

Headless Setup

To use a RPi headless (without monitor, keyboard and mouse) you must first inject your WiFi details then enable SSH. This is done by simply creating 2 files in the boot partition of the SD card. The boot partition of the SD card is FAT32 so you should be able to access it no matter what operating system you are using.

WiFi Configuration

Create the following file on the SD card.

/boot/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU

network={
	ssid="Your WiFi Name"
	psk="Your Password"
	key_mgmt=WPA-PSK
}

SSH Configuration

Create a blank file called ssh in the boot directory of the SD card. This will enable SSH when the Raspberry Pi boots.

/boot/ssh

Setup Access Point

If you are setting this up after previously adding a wpa_supplicant.conf file, be sure to remove the /etc/wpa_supplicant/wpa_supplicant.conf file.


Update and upgrade apt-get

sudo apt-get update && sudo apt-get upgrade -y

Install Dnsmasq

sudo apt-get install hostapd dnsmasq -y

Set a static IP address

sudo nano /etc/dhcpcd.conf

Append:

interface wlan0
static ip_address=192.168.1.4/24
denyinterfaces wlan0

Rename the default Dnsmasq config file

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

Create a new Dnsmasq config file

sudo nano /etc/dnsmasq.conf

Configure the DHCP server

interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

Access point config

sudo nano /etc/hostapd/hostapd.conf

Append:

interface=wlan0
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=<NETWORK NAME>
wpa_passphrase=<PASSWORD>

Tell the AP where to find the config file

sudo nano /etc/default/hostapd

Find

DAEMON_CONF=""

and replace with

DAEMON_CONF="/etc/hostapd/hostapd.conf"

FTP Server

mkdir /home/pi/ftp chmod a+rwx /home/pi/ftp

sudo apt-get install vsftpd

sudo nano /etc/vsftpd.conf

anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 chroot_local_user=YES

user_sub_token=$USER local_root=/home/$USER/ftp