How to Install Raspbian on Raspberry Pi

Updated on

6 min read

Install Raspbian on Raspberry Pi 3

The Raspberry Pi is the most popular single-board computer of all time. It can be used for various purposes such as desktop PC, home media center, smart WiFi router, automation system, and game server. The use cases are endless.

If your Raspberry Pi comes without an SD card preloaded with NOOBS, you will need to install an operating system on your SD card manually. You can run many different operating systems on Raspberry Pi, including various Linux distributions such as Arch Linux , Windows 10 IoT, and FreeBSD.

Raspbian is the recommended OS by the Raspberry Pi Foundation. It is based on Debian, built specifically for the Raspberry Pi boards. Raspbian comes pre-installed with a plethora of software for development, education, and multimedia, making it the best general-purpose OS for Raspberry Pi users.

Installing Raspbian is as simple as writing the OS image file to the SD card. This tutorial will show you how to format the SD card, flash the Raspbian image, and boot up the Raspberry Pi.

Downloading Raspbian OS

Visit the Raspbian downloads page where you can find download links for:

  • Raspbian Stretch with desktop and recommended software
  • Raspbian Stretch with desktop
  • Raspbian Stretch Lite

If you want to use Raspberry Pi as a desktop PC, download one of the Raspbian desktop images. Otherwise, if you intend to use Raspberry Pi as a media center or anything else that doesn’t require a GUI, download the Raspbian Lite image.

Preparing the SD card

Before flashing the image to the micro SD card, first you need to format it to the FAT32 file system.

The Raspberry Pi’s bootloader supports reading only from FAT file systems. If your SD card is 64GB or larger, make sure it is formatted as FAT32, not as exFAT.

Note that formatting is a destructive process, and it will erase all the existing data. If you have data on the SD card, first back it up.

Windows

Windows users can format the card using the standard Disk Management.

  1. Insert the SD card into your Windows SD card drive.
  2. In the Windows search box, type “Disk” and select “Create and format hard disk partitions” from the results box.
  3. Right-click on the card’s unallocated space and start the Wizard by clicking on “New Simple Volume”. Click “Next”.
  4. Next, you will be asked the volume size. Leave the default maximum disk space. Click “Next”.
  5. You will be prompted to specify the mount path. Click “Next”.
  6. On the next window, select FAT32 as a File system. Click “Next” and then “Finish” to complete the creation of the partition. If the card is 64GB or larger, the FAT32 option will not be available. Select exFAT and complete the process. To format the SD card as FAT32, visit the FAT32 Format download page, and download the tool. Double-click on the exe file, select a drive to format, and click “Start”. The card will be formatted to FAT32 in a few seconds.

Linux

In Linux, you can use a graphical tool as GParted or a command-line tool such as fdisk or parted to create a partition and format the drive.

  1. Insert the SD card into your Linux SD card drive.

  2. Find out the name of your SD card with the lsblk command:

    lsblk
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    ...
    sdb           8:16   1  59.6G  0 disk
    ...

    In this case, the name of the SD device is /dev/sdb, but this may vary on your system. The best way to identify the name is by checking the size of the device.

  3. The next step is to format the card using parted:

    sudo parted /dev/sdb --script -- mklabel msdossudo parted /dev/sdb --script -- mkpart primary fat32 1MiB 100%
  4. Format the partition to FAT32:

    sudo mkfs.fat -F32 /dev/sdb1

macOS

macOS users can format the SD card with the standard Disk Utility or from the command line.

  1. Insert the SD card into your macOS SD card drive.

  2. Type the following command in the terminal window to identify the SD card name:

    sudo diskutil list
  3. Format the SD card to FAT32 by running the following command:

    sudo diskutil eraseDisk FAT32 RPI MBRFormat /dev/disk2

    Make sure you are using the correct drive.

Writing the Image

There are several different applications available for free use, which allows you to flash ISO images to SD cards. In this tutorial, we will use Etcher.

Etcher is a free and open-source utility for flashing images to SD cards & USB drives and supports Windows, macOS, and Linux.

Head over to the Etcher downloads page , download the most recent Etcher for your operating system, and install the application.

  1. Insert the SD card into your SD card drive and Launch Etcher.

  2. Click on the Select image button and locate the Raspbian zip file. If you downloaded the file using a web browser, then it should be stored in the Downloads folder located in your user account. Etcher will autoselect the SD card if only one drive is present. Otherwise, if more than one SD card or USB stick are attached, make sure you have selected the correct drive before flashing the image.

    Etcher Raspbian
  3. Click on the “Flash” button, and the flashing process will start. Etcher will show a progress bar and ETA while flashing the image. The process may take several minutes, depending on the size of the ISO file and the card speed.

On Raspbian, the SSH server is disabled by default. For headless Raspbian setup, you can enable SSH by placing a file named ssh without any extension onto the boot partition. Simply open the SD card in your File Manager and create the file.

That’s all! You have a bootable Raspbian OS on your SD card.

Setting up the Raspbian

Put the SD card into your Raspberry Pi board, plug in the monitor, keyboard, and power source, and you’re ready to go.

The default username is pi, and the password is raspberry.

If you enabled SSH and want to use Raspberry Pi as a headless server, connect the board with a network cable with your router. Once booted, you can find the board IP address in your router’s DHCP lease table and login to your Raspbian via ssh:

ssh pi@192.168.1.149

To start configuring your Pi, use the raspi-config tool:

sudo raspi-config
raspi-config

From here, you can change the pi user password, set up the WiFi, and expand the filesystem.

Conclusion

Installing Raspbian on Raspberry Pi is a pretty straightforward process. Basically, all you need to do is to write the image to the SD card and boot up the Raspberry Pi.

If you hit a problem or have feedback, leave a comment below.