Raspberry Pi OS Setup

OS Install and First-Time Configuration

At this point it is assumed you have a bootable SD card containing the Raspbian Lite software. If not, follow the directions on the “Preparation” page.

The case should NOT be assembled yet. Let’s get the system running before sealing it up.
  1. Connect a monitor and a USB keyboard to the Raspberry Pi (a mouse is not required).
  2. Insert the SD card containing the Raspbian Lite software.
  3. Connect a micro-B USB cable to the power connector on the Raspberry Pi.
  4. Plug the other end of the USB cable into a power source: a mobile phone charger, a powered USB hub, or simply a USB port on your computer.

The Raspberry Pi should now boot, and you’ll see the monitor fill with lots of “Unix stuff.” On first boot, the system may automatically reboot once as part of the setup process. This is normal.

Linux can be daunting to the uninitiated. Don’t worry about messing something up…if all else fails, you can re-format the SD card and begin again.

Within a minute or so you should get a login prompt. Log in as user “pi” and password “raspberry”. Then enter the following command for essential system setup:

sudo raspi-config

Use the up/down arrow keys, tab and return/enter to navigate the config menu:

The following selections are required:

  • Under “Interfacing Options,” select “Serial.” Turn OFF the login shell over serial, and ENABLE the hardware serial port. NO and YES, respectively. This is vital!
  • Under “Interfacing Options,” enable SSH. This permits network access to the Raspberry Pi without a monitor or keyboard attached later.
  • Under “Localisation Options,” select “Change Timezone” and set this up for your location (a correct time zone is required for the time display and other examples to work).

The following are optional but recommended:

  • Change User Password,” because everybody knows the default (“raspberry”).
  • Hostname” to distinguish this system from other Raspberry Pis on the network (default is “raspberrypi,” consider changing to “iotp” or “piprinter” or any descriptive name).
  • Under “Localisation Options,” configure the other options for language, WiFi channels and keyboard. If your keyboard is generating unexpected characters, this is why!
  • Under “Advanced Options,” you can optionally disable overscan compensation if using an HDMI monitor. Though our ultimate goal is to use the Raspberry Pi “headless,” without a monitor, the extra space is welcome during the configuration steps.

Do NOT touch “Overclock” or other esoteric settings. Overclocking can wreak havoc with the serial port we’ll be relying on! Do not overclock.

Tab to "Finish" and press enter, but DO NOT REBOOT YET. We still need to set up the wireless networking. Select “No” when prompted to reboot. Raspi-config will exit to the command line.

Some configuration files will now be edited. Our examples show the “nano” text editor being used, as it’s easiest for the uninitiated. Power users can substitute “vi” or their editor of choice.

Configure Wireless Networking

If you have a WiFi network that broadcasts its SSID (the wireless network name), this is fairly straightforward:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Delete everything in the file, then enter the below text in instead. Check your spelling, everything’s got to be spot-on! Then edit the SSID and password lines to reflect your actual network name and password (keeping the double quotes on both):

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

network={
    ssid="SSID"
    psk="YOUR_PASSWORD"
    scan_ssid=1
}

Skip ahead to the “Reboot” section below. This next section pertains only to hidden wireless networks.

Hidden Networks

Hidden WiFi networks are an ongoing point of contention…the following directions may or may not work for your particular network. If this doesn’t seem to work, consider changing your WiFi config to broadcast the SSID; it’s been shown that hidden networks aren’t actually any more secure than visible ones!

The network configuration in this case is a fair bit more complicated. And the slightest typo here, even one character, can prevent the system from joining the network! Again, we strongly recommend using a “broadcast” network, it’s far easier and less error-prone. But if you must…

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Delete everything in the file, then enter the below text in instead. Check your spelling, everything’s got to be spot-on! Indent the 'network' section using tabs, not spaces. Then edit the ssid and psk (password) lines to reflect your actual network name and password (keeping the double quotes on both):

ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=2
eapol_version=1
network={
	ssid="my-network-ssid"
	scan_ssid=1
	mode=0
	proto=WPA2
	auth_alg=OPEN
	pairwise=CCMP
	group=CCMP
	key_mgmt=WPA-PSK
	psk="my-network-password"
}

Reboot

Finally, shut down the system:

sudo shutdown -h now

Wait for the system to report that it’s halted before disconnecting power. It should take about 30 seconds.

Following shutdown, remove the keyboard (if using a Model A board), insert the WiFi adapter and re-connect power (keep the monitor attached for now). With a Model B board, you can keep both the keyboard and WiFi adapter attached until you know the networking is properly configured.

What's nice is Raspbian now comes with Bonjour so you do not need to memorize IP addresses.

If you have Mac, you don't have to do anything

If you have Windows, go here and install the Bonjour support (via Apple print support)

Your Pi's name will be raspberrypi.local unless you changed the hostname in raspi-config in whichcase it will be hostname.local

If the wireless connection doesn’t work, unplug the WiFi adapter and connect the keyboard and double-check the network setup steps above. It might simply be a typo. Correct any mistakes and reboot.

Once WiFi is working, the keyboard and monitor are no longer required. All further configuration can be done remotely via SSH, if you’ve enabled it in raspi-config.

Last updated on 2017-09-12 at 03.47.05 PM Published on 2013-04-12 at 11.38.58 AM