- Download your image for the Raspberry Pi
Download the image you want to use, make note of the location you are saving your image to (ie: ~/Downloads). I usually use the Raspbian Jessie image for most of my projects.
https://www.raspberrypi.org/downloads/
- Raspberry Pi 2 will require a micro SD card adapter, for most computers
- Find the SD card
Unplug your SD card from you computer and run this in the command line
watch 'dmesg | tail -20'
While that command is still running, plug the SD card back in, your looking to find what device it is showing up as (ie: sdb, sdc, sdd, etc)
In our example, you can see that the SD card is showing up as sdc, In these examples, we will now refer to our card as sdc (although yours may be sdb, sdd, etc)
Once you see something similar to this screen press Ctrl+c
to exit the last command.
- Unmount the SD card partitions
See what partitions are mounted
df -h
If there were any partitions mounted for our drive, in our example we are looking for /dev/sdc[<number>], you would see /dev/sdc1 pointed to a directory
This will un-mount all partitions associated with sdc, in the command below, substitute sdc, with your drive (sdb,sdd, etc)
for n in /dev/sdc* ; do umount -l $n ; done
Run the df -h command again to show all partitions with our card are no longer showing up
df -h
- Image the SD card with the Raspberry Pi image you downloaded in the previous step
Uncompress the downloaded raspberry pi image, substituting the directory path and image name to match your image
unzip ~/Downloads/2015-05-05-raspbian-wheezy.zip -d ~/Downloads
The next command will write to the SD card, anything that may have been on the SD card previously will now be overwritten permanently
Using the command dd, we will write the image you previously had downloaded, directly to your SD card
*Important, be sure to substitute the full path of your Raspberry Pi image and your SD letter (sd[x]) shown in the example below
sudo dd bs=4M if=<-full-path-of raspberry-pi-image> of=/dev/<sd-card-location>
example:
sudo dd bs=4M if=~/Downloads/2015-11-21-raspbian-jessie.img of=/dev/sdc
You will not see any progress as the card is being written, It should take around 5 minutes or so.
Once you're back to the command prompt, it's complete, remove the SD card and insert it into your raspberry pi and have some fun!
*The above image shows me using the raspbian-wheezy image, but now I typically use the raspbian-jessie image.
Done!