Installing Raspbian on a Raspberry Pi
You have likely heard the hype regarding the Raspberry Pi over the years, as usual the hardest part of getting started is where to start. You can certainly buy an SD Card that already contains the Raspbian operating system, however, what does buying such an SD card teach you?
In this article I will show you how to install the Raspbian operating system on an SD card bypassing the need for Noobs.
What we will need
- Raspberry Pi — This tutorial will work with any Raspberry Pi. The one you choose should really depend upon what you intend to do with the Raspberry Pi.
- SD Card — Providing you are not using a Raspberry Pi from pre-2012 this should be a Micro SD. Anything above 4 GB should be fine but again the size you need depends upon the usage you have planned for the Pi.
- RJ45 (Ethernet cable) — You could use wireless but Ethernet Is always more reliable.
- USB power cable — Hopefully I do not need to explain this one.
You may also need an SD card reader unless your laptop or PC has one built in.
Preparing the SD card
Prior to installing Raspbian we should ensure that we have a blank SD card and that it has been formatted correctly. Raspbian requires the SD card to be formatted using FAT32, however, this can be problematic if you have an SD card larger than 32GB. The steps we will take will overcome this.
The first tool that we are going to use is SD Card Formatter. This tool will remove any partitions on the card as well as carrying out a standard format. After downloading and installing this you should see an icon in your start menu. Open this as you normally would and you will be presented with the following screen:
Start by changing the drive that is selected (where it states “Select Card”). It is best to ensure that this has automatically selected the correct drive, if not change it. We will be wiping the drive, if you choose the wrong one you will be wiping data on the selected drive.
For formatting options select “Quick Format” this will suffice for our needs. Choosing this option will also be quicker than an “Overwrite Format”.
Lastly within “Volume Label” I personally enter “RASPBERRYPI”. You can enter anything you wish: however, it will be changed to upper case and will only actually use alphanumeric characters.
Lastly for this step click “Format”. You will receive a warning advising that the data will be lost. Simply click “Yes” to proceed.
If your card, like mine is less than 32GB you can safely move onto the next step. If the SD card is 32GB or greater keep reading.
Now that the card is formatted, we need to format the drive again however using the FAT32 file system. For this step we are going to use a tool called GUI Format. After going to the linked site simply click on the image to start downloading (easy to miss) alternatively click here.
This particular tool does not install onto your PC, instead you simply run it from the location where you downloaded it, therefore locate the file, double click the icon and you will be presented with the following screen
As the screenshot shows, the card I am formatting is only 7GB (it is actually 8) and it is already in FAT32 so there is no need to run the tool however, if you do need to run the tool ensure that the correct card is selected. The “Volume Label” should match what you entered into SD Card Formatter.
Leave “Quick Format” ticked and press “Start”, and again you will receive a confirmation screen, click “OK”.
Once finished the SD card is now ready for Raspbian.
Of course, before installing Raspbian we first need to download it. Raspbian can be downloaded here. As you can see there are three versions to choose from:
- Raspbian Stretch Lite — This is the minimalist version, no GUI at all so will require knowledge of the command line to manage it.
- Raspbian Stretch with desktop — A desktop version of Raspbian that has a minimal set of software installed along with the GUI.
- Raspbian Stretch with desktop and recommended software — A fuller desktop version with much more software. This is almost twice the size of the other desktop version.
The steps we are going to carry out will work with any of the editions above. However, you should seriously consider the version you wish to use. If you will be installing resource heavy application from the command line, I would strongly suggest the Lite version as this frees any resources that the GUI would have taken up.
After deciding upon the version you wish to use, download it using your preferred method. Once downloaded you will have a file something similar to “YYYY–MM–DD-raspbian-stretch-lite.zip”. The first part of the name is based upon the date the version was released. Locate where the file has downloaded, right click on the file and select “Extract All” then in the new window click “Extract”.
Once the extract has finished you will have a folder with the same name as the zip folder we just extracted, this will contain a file ending in .img.
We now need to burn this image to the SD Card. For this we can use a tool called Etcher. After downloading the file, run this and install the software as you normally would.
Using “Select Image”, locate the img file that we extracted earlier. Ensure the correct card is selected and lastly click “Flash”. You may be presented with a screen that asks if it is OK for the application to make changes to your device, select yes for this.
After a couple of minutes, you should receive confirmation that the flashing has finished.
Now that the SD card has been flashed, if you navigate to the flash drive you should see content similar to the image below. If the SD card does not show, simply remove it from the PC and reinsert it.
Now simply place the SD card into the Raspberry Pi, connect the Raspberry Pi to your router or hub using the Ethernet cable and lastly plug the power cable in.
The Raspberry Pi is now up and running.
Another step that is useful especially if it would be inconvenient to hook up a keyboard and monitor is to automatically start SSH. Luckily a method of doing this has been made possible. Simply navigate too the SD card and create a file called “ssh”.
We also need to ascertain what the IP address is. There are a number of ways to do this. Firstly, you could go into the GUI of your router. The Raspberry Pi will show under that name.
If you have no access to the router you could also try opening the command prompt and typing the following command “ping RASPBERRYPI”. If only one Raspberry Pi is connected this should respond to the ping. You may (as in my example below) need to use the “-4” switch if the response you receive is an IPv6 address (although there is nothing stopping you using the IPv6 address of course)
Now that you have the IP you can connect using your favourite SSH client also using the following credentials:
- Username: pi
- Password: raspberry
Of course, there are plenty of other steps that you could take after setup but this article would never end.
Although installing Raspberry Pi appears very involved, in reality it is not that difficult. The Raspberry Pi is a perfect tool to learn new skills such as:
- Working in the command line
- Linux administration
- Playing with hardware
The list does go on. The hardest part is getting started.