Raspberry Pi & Raspbian Setup as Fast as Possible

This is a simple setup guide to install Raspbian on a Raspberry Pi and get it set up headlessly. This means that we we won't ever need to plug a keyboard, mouse or screen into it.

This is a tutorial for MacOS and Linux because it makes use of the terminal.

Make sure you have these things:

  • Your Raspberry Pi
  • A way to power your Raspberry Pi
  • A micro SD card
  • A micro SD card adapter so you can plug it into your computer
  • A computer
  • If your Pi doesn't have WiFi built in, you'll need a WiFi dongle.

WiFi is built in to the Raspberry Pi Zero W and Raspberry Pi 3 and on.

Download these things:

Let's carry on with the tutorial assuming you have everything installed and downloaded.

Installing Raspbian

  1. Unzip the Raspbian zip folder that you downloaded. There should be a .img file in there.
  2. Using your USB adapter, plug in your micro SD card to your computer.
  3. Open Etcher on your computer.
  4. Select the .img Raspbian file in the left section.
  5. Select the micro SD card in the middle section.
  6. Click "Flash" and wait.

Once that is done, Raspbian is installed.

By default, Raspbian disallows ssh connections. So we will need to enable them. Also, we want the Pi to be able to connect to our WiFi right away so we don't need to connect a screen and keyboard to it.

Enable SSH over WiFi

  • If the micro SD card has unmounted from your computer, reconnect it.
  • In the Terminal, go to the SD card.

    # Mac
    cd /Volume/MySDCard/
    # Linux (Can vary or require additional steps)
    cd /media/MySDCard/
  • Add a blank file simply called ssh to the micro SD card.

    $ touch ssh
  • Add a file called wpa_supplicant.conf to the micro SD card.

    nano wpa_supplicant.conf

This file needs to contain your WiFi name and password. Here is a template you can edit.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  • Once these two files are on your SD card, remove it and plug it into your Raspberry Pi.
  • If the PI needs a WiFi adapter, plug it in. Then power up the Pi.

The only cable you need to have plugged into the Pi is the power cable.

Find Your Pi's IP Address

You can do this by simply looking at your routers UI. Just find the device called 'Raspberry Pi'.

If you want to find the IP in the terminal:

arp -na | grep -i b8:27:eb

This will give you an IP address starting with '192.168.'. That's your Pi's internal IP address. You can only access your Pi from another device on the same network using this address.

All Raspberry Pi device MAC addresses start with 'B8:27:EB'.

Access and Setup

  • SSH onto your Pi

    sh pi@192.168.x.x

    Replace the Xs with your Pis IP address.

  • When asked for a password, type 'raspberry'. It will look like nothing is being typed. Don't worry, it is.
  • The first thing we want to do here is to change that default password.

  • Update

    sudo apt-get update
  • Optionally, install some commonly used packages.

    sudo apt-get install git curl build-essential
  • If you are planning on using the Pi as a web server, install nginx.

    sudo apt-get install -y nginx
    sudo service nginx start
  • I regularaly use NodeJS on my Raspberry Pis. If you want to install it, I recommend using NVM.

    # Download NVM
    wget -qO- https://raw.github.com/nvm-sh/nvm/master/install.sh | sh

Access NVM right away

export NVMDIR="/home/vagrant/.nvm" [ -s "$NVMDIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

nvm install --lts npm use --lts

You are all set and ready to go! Just use your new password when SSHing to the Pi from now on.


If you have questions, feel free to ask.

You can also check out the [Raspberry Pi Stack Exchange](https://raspberrypi.stackexchange.com/)