How to Install Raspbian Stretch on the Raspberry Pi
Share
Interests
Important: Raspbian has been replaced by Raspberry Pi OS!
How to Install Raspberry Pi OS on Your Raspberry Pi
Get the new official Raspberry Pi OS on your Pi.
Raspbian is a free Debian-based operating system optimized for the Raspberry Pi, and Stretch is the development code name for Debian 9. In this guide, we’ll download and install Raspbian Stretch for use on the Raspberry Pi.
Note: A new version of Raspbian is available! Learn how to install Raspbian Buster |
1 – Download the Stretch image
Since Stretch is no longer the latest version of Raspbian, it’s been removed from the Raspbian Downloads page. But you can still download Raspbian Stretch using our guide that contains links to the Raspbian Archive.
Download Raspbian Stretch
Need an older version of Raspbian? No problem.
Either full or lite will work for this guide, but the version you choose depends on your project.
Choose Raspbian Stretch with Desktop if you want to have access to the Raspbian GUI; in other words, if you want to log in and be able to access a desktop, icons, etc. like you would with Windows or MacOS.
Choose Raspbian Stretch Lite if you only need to boot to the command line. For simpler Raspberry Pi projects, this is often a good choice since the Lite version uses less power and fewer resources.
2 – Put your micro SD card into your computer
You’ll likely need to use an adapter if your computer has a full-sized SD card slot or no SD card slot.
3 – Use Etcher
The easiest way to flash Raspbian Stretch to your SD card is to download and install Etcher. After opening Etcher, select the Raspbian disk image, your SD card, and click Flash. After Etcher finishes running, you’re good to go!
If you prefer to install Raspbian manually and learn a bit more, read on for alternate methods!
4 – Using MacOS
If you’re using MacOS, use the following instructions. Windows instructions are located below.
5 – Open the Disk Utility and find your SD card
To open Disk Utility you can type cmd + space bar and search. Or you can use Finder to navigate to Applications > Utilities > Disk Utility.
6 – Format the SD card
You’ll need to format the SD card to FAT-32. To do so you’ll need to click on the “Apple SDXC Reader” (or the name of whatever adapter you used) in the left column of Disk Utility.
Click the “Erase” tab.
Choose a name for the card (something like “Stretch” will do). For the format, choose MS-DOS (FAT).
Click “Erase” when you’re finished.
7 – Determine the mount point
Using the df command we’re going to determine the mount point.
Type:
df -h
In the output, under the Mounted on column look for the name of your SD card. I named my STRETCH so I’m looking for /Volumes/STRETCH.
Then take note of the filesystem name in the first column. Mine is /dev/disk2s1. This is actually the partition name, but what we’re really concerned with is the device name which is disk2. Copy this device name.
8 – Unmount the volume
For this step you can use either Disk Utility or Finder. In either case look in the left column for the name of your SD card. In my case it’s STRETCH and click the eject symbol.
9 – Locate the disk image
Navigate to the Downloads folder and pen up the Terminal application and type:
cd ~/Downloads
To locate the img type:
ls -lha | grep -i stretch
You should see some output like this:
[Downloads]$ ls -lha | grep -i stretch
-rw-r--r--@ 1 tyler staff 346M Nov 8 14:51 2017-09-07-raspbian-stretch-lite.zip
Now unzip the image. Make sure to use the name of your file.
unzip 2017-09-07-raspbian-stretch-lite.zip
This will create the file 2017-09-07-raspbian-stretch-lite.img.
10 – Flash the disk image
Still in the Terminal, type:
sudo dd bs=1m if=DISK_IMAGE_NAME of=DEVICE_NAME
Make sure to replace the values for DISK_IMAGE_NAME and DEVICE_NAME. Mine looks like this:
sudo dd bs=1m if=2017-09-07-raspbian-stretch-lite.img of=/dev/rdisk2
Enter your password, wait until it finishes, and you’re done.
Note: You may have noticed that we’re using rdisk2 instead of disk2. You can actually use either, but rdisk2 is significantly faster.
11 – Using Windows
If you’re using Windows to format the Disk you can use the following steps.
12 – Format the SD card
Open Windows Explorer and find your SD card. Right click on the icon and click Format…. Make sure Fat 32 (default) is selected and hit enter.
13 – Download and launch the Win32 Disk Manager
Go here and download the app called Win32 Disk Imager. After downloading the program, click to uncompress the files, and then click Win32DiskImager.exe to launch.
14 – Flash the SD card
In the Win32 Disk Imager, click the blue folder icon and locate the Jessie image you downloaded. Then in the Device box make sure the drive letter for your SD card is selected.
Click the Write button to begin.
15 – Boot your Pi!
Safely eject the SD card from your computer and insert it into your Raspberry Pi. Then, connect your Pi’s power supply to boot it.
You’re good to go! Next, you’ll want to connect your Pi to WiFi and enable SSH so you can log into your Pi remotely.
How to Set up WiFi on Your Raspberry Pi Without a Monitor (Headless)
No monitor, keyboard, or mouse? No problem.
How to Enable SSH on Raspberry Pi OS Without a Screen
The SSH protocol is disabled by default.