Setting up a Raspbery Pi can be a little troublesome when you have limited connectivity options: without a monitor, keyboard, and mouse, network cable, or serial cable, it can be hard to see how to bootstrap the process.

It's actually possible to configure many aspects of the Pi by modifying files on the FAT32 'boot' partition of a standard Raspbian install. I tend to go through the following steps when setting up a new Raspberry Pi:

  1. Install Raspbian
  2. Configure WiFi
  3. Enable SSH
  4. Discover the IP address
  5. Connect using SSH
  6. Enable VNC

Install Raspbian

Download and install the latest Raspbian distribution from the Raspberry Pi downloads page, and follow the installation guide. The following instructions will work with both the 'Desktop' and 'Lite' distributions, so pick whichever is best suited to your needs.

Configure WiFi

Create a file named wpa_supplicant.conf on the newly created 'boot' partition of your microSD card, entering your own network name, pre-shared key, and changing the country and security type if necessary:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="<Network Name>"
    psk="<Pre-Shared Key>"

This will be used to update /etc/wpa_supplicant/wpa_supplicant.conf on the next boot.

There's a pretty good discussion on Stack Exchange, and you can find more details of the wpa_supplicant.conf file and general command-line WiFi configuration in the Raspberry Pi documentation.

Enable SSH

In order to be able to connect to the Pi, you'll need to enable SSH. This can be done by creating a empty file named ssh on the 'boot' partition of your microSD card; the presence of this file will enable SSH access on subsequent boots.

For example, on a Mac:

touch /Volumes/boot/ssh

Discover the IP address

In order to be able to connect to the Rapsberry Pi, you'll need to find its IP address.

Return your microSD card to the Raspberry Pi and power it on. Once it has booted, you can discover the device on the network using the nmap command, substituting with your own IP address:

sudo nmap -sPn

This will scan your current subnet for other devices. By default, your Raspberry Pi will have a hostname of raspberrypi, making it fairly easy to find. (You may wish to change this using raspi-config for ease of identification in the future.)

Connect using SSH

Since we enabled SSH access in an earlier step, connecting to the Raspberry Pi should simply be a matter of using SSH (remember to substitute the IP address below for the one you discovered using nmap):

ssh pi@

The default password is raspberry. You'll be prompted to change this on first log in.

Enable VNC

If you're running a Desktop distribution, you might find it useful to use VNC. There are great step-by-step instructions in the Raspberry Pi documentation.

In short, you will need to install the RealVNC VNC Server as follows:

sudo apt-get update
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer

After this, you can enable the VNC Server by running the interactive raspi-config utility:

sudo raspi-config

From here, you will need to select 5 Interfacing Options, P3 VNC, then <Yes>. I also find it useful to increase the display resolution, in 7 Advanced Options1.

If you want to use VNC Connect--which allows you to connect back to you Pi, even if you're on a different network--you will first need to connect over the local network, then sign in to your VNC Connect account using UI as there's no command-line mechanism to do so.

  1. If you require a non-standard resolution, you can specify this by editing config.txt on the 'boot' volume and setting framebuffer_width and framebuffer_height. These will override the raspi-config settings.