This is the checklist that I follow for initial setup of a raspberry pi. This has been last updated for the release Raspbian GNU/Linux 9 (stretch). If you are running a newer version, there’s a chance these won’t work for you.
NOTE: Never simply copy+paste a command that you do not know what it does.
DISCLAIMER: While this guide aims to be 100% accurate, it may become outdated and commands may break or destroy your system. Use at your own risk.
Basic Setup
- Login. username:
pi, password:raspberry.
- If headless with no monitor / keyboard, run
touch sshon the boot drive when flashing. Creating a file namedsshon the boot drive allows you to ssh into the raspberry pi (which is disabled by default). - Username / password is the same, hostname is
raspberrypi.localby default.
- Change the pi user’s password: run
passwdand enter old/new passwords. - Enter Raspi-config
sudo raspi-config - Enter “Network Options” sub menu.
- Network Interface Names
- Enable predictable network names.
- Enter “Localization Options”
- Change Locale
- Press space to deselect
en-GB(marked by an asterisk) - Press space to select
en_US.UTF-8 UTF-8
- Change Timezone
- (set your timezone here)
- Keyboard Layout
- NOTE: Will not work over ssh.
- press enter to confirm
Generic 105-key (Intl) PC - select “Other” Layout at bottom
- Choose “US English” at the top. You may change this depending on preferences for Dvorak, etc.
- WiFi Country
- Choose
US United States
- Interfacing
- Set SSH to enabled
- (others depending on project.)
- Enter
Advanced Options
- Choose “Expand Filesystem”
- If using a TV, configure “Overscan”
- Finish
- Navigate back to the main menu, and select “Finish”.
- Reboot (it should prompt you. If it doesn’t, run
sudo reboot)
Upgrading all packages
- run
sudo apt-get update - run
sudo apt-get upgrade - run
sudo reboot
Optional Packages
Because I’m a vim fan, I install the latest vim with better support for source highlighting, etc. If you’re not comfortable with vim, I’d recommend nano for first-time users.
- run
sudo apt-get install vim
Adding Users
- Add User
sudo adduser username(replaceusernamewith your username) - Add User to sudoers file
- Newer Raspian (tested on
stretch)- run
sudo visudo -f /etc/sudoers.d/010_pi-nopasswd - Duplicate the pi line,
pi ALL=(ALL) NOPASSWD: ALL, replacingpiwith the username from step 1 on the new line.
- run
- Older Raspbian
- run
sudo visudo - add line under the line reading
pi ALL=(ALL:ALL) ALL:username ALL=(ALL:ALL) ALL(replaceusernamewith your username)
- duplicate
- run