Official installation guide

I’ll use

  • macOS Mojave
  • Raspbian Buster Lite
  • 32GB micro SD card

Flash os image to sdcard

List disks

diskutil list
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.0 GB    disk2
   1:             Windows_FAT_32 boot                    46.0 MB    disk2s1
   2:                      Linux                         32.0 GB    disk2s2

Unmount disk2

diskutil unmountDisk disk2

Download image

Download Page

Check SHA-256

sha256sum 2019-06-20-raspbian-buster-lite.zip
9009409a9f969b117602d85d992d90563f181a904bc3812bdd880fc493185234  2019-06-20-raspbian-buster-lite.zip

Unzip

unzip 2019-06-20-raspbian-buster-lite.zip

Flash image

sudo dd bs=1m if=2019-06-20-raspbian-buster-lite.img of=/dev/rdisk2 conv=sync

List disk2

diskutil list disk2
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.0 GB    disk2
   1:             Windows_FAT_32 boot                    268.4 MB   disk2s1
   2:                      Linux                         1.9 GB     disk2s2

Unmount disk2 again

diskutil unmountDisk disk2

After install

Login

The default user is pi, password is raspberry.

Change keyboard

Open “/etc/default/keyboard”

sudo nano /etc/default/keyboard

The file should be like this:

# KEYBOARD CONFIGURATION FILE
 
# Consult the keyboard(5) manual page.
 
XKBMODEL="pc105"
XKBLAYOUT="gb"
XKBVARIANT=""
XKBOPTIONS=""
 
BACKSPACE="guess"

Change “gb” to “us”

XKBLAYOUT="us"

Remote access via SSH

Enable and start SSH

sudo systemctl enable ssh
sudo systemctl start ssh

Copy ssh-id

ssh-copy-id pi@192.168.1.14

Secure SSH

On Raspbian, edit “/etc/ssh/sshd_config”, there are three lines that need to be changed to no.

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Change port number if necessary, e.g. 2222.

Port 2222

Read Securing your Raspberry Pi for more info.

Locale

Fix locale error like this

/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

This means LC_ALL is set to en_US.UTF-8. But en_US.UTF-8 is not generated (not in locale -a).

Generate locales

sudo raspi-config

Select “4 Localisation Options” -> “L1 Change Locale”

Prees “space bar” to check All locales (will take time to generate)

Pi-Configure-Locale.png

Select en_US.UTF-8 as default.

Pi-Locale-enUS.png

Another way of doing this is to edit “/etc/locale.gen”

Uncomment en_US.UTF-8 and others you want to use

Use commands below to generate and set default

sudo locale-gen
sudo update-locale en_US.UTF-8

Many thanks to jaredwolff.com.

Cloudflare DDNS

Use my shell script
https://gist.github.com/HackingGate/2276b69d52839fef1603132b4de941f0

SSH login from anywhere

ssh pi@example.com -p 2222