Raspian boot images can be downloaded from here.
We recommend the desktop variant of Raspian which will bring up an X11 based GUI at startup. If a GUI is not needed, X11 can be easily turned off later.
The easiest way to copy the image onto an sd card is using a dd
command similar to this:
$ sudo dd if=/tmp/raspian.img of=/dev/sdc status=progress
This will create two partitions on the device /dev/sdc
:
/dev/sdc1
) which will be mounted at /boot
/dev/sdc2
) which will be mounted at /
and resized to use up the rest of the sd card after the first bootUse pmount
/pumount
to mount these partitions for the configuration steps below.
add an empty file named ssh
to the boot partition.
user: pi
password: raspberry
Edit the file config.txt
in the boot partition. Note, the raspi-config
tool may also modify this file.
Edit /etc/wpa_supplicant/wpa_supplicant.conf
in the main partition to contain:
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="your_real_wifi_ssid"
scan_ssid=1
psk="your_real_password"
key_mgmt=WPA-PSK
}
change US
, your_real_wifi_ssid
, your_real_password
as necessary
Edit /etc/hostname
in the main partition
This will make it easier to find the Pi’s IP-address by looking for this hostname in the router’s connected-devices-table.
Most of these are optional.
pi
Run this interactive command and follow the instructions:
$ passwd
(default password is raspberry
)
$ sudo raspi-config
Localisation Options → Change Timezone
$ sudo raspi-config
Boot Options → Desktop/CLI
pi
To simplify running your own programs as startup, edit /etc/rc.local
to contain
$ su pi -c /home/pi/start.me.sh &
Next, create a the file /home/pi/start.me.sh
with this content and make it readable/executable.
#!/bin/bash
cd /home/pi
...
<run program 1>
<run program 2>
...
Add lines like the following to /etc/rc.local
:
echo <level> > /sys/class/leds/led<no>/brightness
echo <mode> > /sys/class/leds/led<no>/trigger
where no
is 0 (activity LED) or 1 (power LED). and level
is 0 (on) or 1 (off), mode
is from the following table and only relevant when the brightness is 1.
mode | description |
---|---|
none | always off |
mmc0 | lit when sd card is accessed |
gpio | gpio controlled (default off) |
heartbeat | flashes |
cpu0 | lit when cpu activity |
input | lit when under-voltage detected |
On the Pi Zero only LED 0 (activity LED) is available.