Pi Config
– layout: post title: “Configuring Your Raspberry Pi” categories: cheatsheet —
- Download and Extract a Disk Image
- Write disk image
- Turn on SSH:
touch /boot/ssh
- Setup WiFi:
touch /boot/wpa_supplicant.conf
- Install the SD Card and boot the Pi
- Find the Pi on the Network (by IP)
- Run
raspi-config
- Change Password
- Set Pi Hostname
- Copy SSH Key
- Disable SSH Password Logins
- Set the locale
- 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
}
Find the Pi on the Network
Determine the Pi’s Hostname and IP Address.
$ 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.
After booting: SSH into the Pi and set the hostname through the raspi-config
menu or by setting /etc/hostname
.
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
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
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
Update the OS
sudo apt-get update && sudo apt get upgrade
What’s Next?
- Ping Google:
ping google.com
- Copy files with
scp