The Raspberry Pi is the most popular single-board computer of all times. 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 and manually install an operating system on your SD card. 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. In this tutorial, we 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 FAT32 file system.

The Raspberry Pi’s bootloader supports reading only from FAT file systems. If your SD card that 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 should 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, just 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 page where you can download the tool by clicking on the picture. A single file named guiformat.exe will be download. Simply 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, 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. 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 will allow 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 cards or USB sticks are attached make sure you have selected the correct drive before flashing the image.
  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 you want to use Raspberry Pi as a headless server connect the board with a network cable with your router. Once is booted you can find the board IP address in your router’s DHCP lease table and login to your Raspbian via ssh:

[email protected]

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

sudo 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.