– layout: post title: “Configuring Your Raspberry Pi” categories: cheatsheet —

  1. Download and Extract a Disk Image
  2. Write disk image
  3. Turn on SSH: touch /boot/ssh
  4. Setup WiFi: touch /boot/wpa_supplicant.conf
  5. Install the SD Card and boot the Pi
  6. Find the Pi on the Network (by IP)
  7. Run raspi-config
  8. Change Password
  9. Set Pi Hostname
  10. Copy SSH Key
  11. Disable SSH Password Logins
  12. Set the locale
  13. Update the OS

Disk Images

$ wget https://github.com/RetroPie/RetroPie-Setup/releases/download/4.3/retropie-4.3-rpi2_rpi3.img.gz
$ gunzip retropie-4.3-rpi2_rpi3.img.gz

wpa_supplicant.conf

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

network={
    ssid="your-ssid"
    scan_ssid=1
    psk="your-wifi-password"
    key_mgmt=WPA-PSK
}

network={
    ssid="another-ssid"
    scan_ssid=1
    psk="wifi-password"
    key_mgmt=WPA-PSK
}

source

Find the Pi on the Network

Determine the Pi’s Hostname and IP Address.

Using nmap or fing

$ ping my-cool-pi-hostname.local

Run raspi-config

$ ssh pi@my-cool-pi-hostname.local  # default password is 'raspberry'
pi@retropie:~ $ sudo raspi-config

Set the password, hostname, and localization options.

hostnames

Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, and the hyphen (-). A hostname may not start with a hyphen.

source

After booting: SSH into the Pi and set the hostname through the raspi-config menu or by setting /etc/hostname.

StackExchange Answer

Set Hostname

$ sudo hostnamectl set-hostname pi-b512

Change Password

$ passwd

Copy SSH Key

$ ls ~/.ssh  # check for keys

Generate keys if id_rsa & id_rsa.pub do not exist.

$ ssh-copy-id -i ~/.ssh/id_rsa.pub pi@my-cool-pi-hostname
$ ssh-copy-id -i ~/.ssh/id_rsa.pub pi@192.168.1.250

source

Disable SSH Password Logins

$ sudo nano /etc/ssh/sshd_config

Add PasswordAuthentication no and save.

$ sudo service ssh reload

Set the locale

$ sudo nano /etc/locale.gen  # uncomment en_US.UTF-8 UTF-8
$ sudo locale-gen
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

source

Set the Video Resolution

$ tvservice -m CEA  # or "DMT", to list supported video modes
$ tvservice -e "DMT 82"  # mode 82: 1920x1080 @ 60Hz 16:9, clock:148MHz progressive
$ tvservice -s
$ tvservice -p  # preferred mode

source

Update the OS

sudo apt-get update && sudo apt get upgrade

What’s Next?

  • Ping Google: ping google.com
  • Copy files with scp

Other Issues

Resources