I’m going to make some assumptions before we begin. The first is that you already know what a Raspberry Pi computer is. I’m going to assume that you already know it is the Credit-Card-Sized-Computer-That-Could. And that its beefiest incarnation has a 900 MHz quad-core ARM Coretx-A7 processor (sounds impressive, no?). That it has a gigabyte of RAM. And that it can also play Minecraft (a freeware version of it anyway).
I am going to assume now that you already know enough about it to want–or already have–one. But just in case: why would anyone want one? Many of them boil down to a basic few:
- You are interested in Linux but want a cheap way to try it out or learn how it works
- You are interested in hobby electronics and want to make LEDs blink and sensors sense.
- You are interested in programming and want to make a cheap, efficient home server.
There are lots of different ways to set up a Raspberry Pi. Some of those methods even work. The problem is, a lot of those guides are somewhat dated now, as newer versions of the Tiny-Linux-Platform-that-Changed-the-World are released (here’s the newest! So tiny!), as well as its flagship Linux distro Raspbian (based on the popular desktop distro Debian).
Decisions are hard, so I’m going to make some of them for you. So I will make one more assumption and one non-assumption:
- You are a complete noob when it comes to Raspberry Pi
- I will assume no prior knowledge of Linux.
Let’s dive in, shall we?
Things Needed to Set up a Raspberry Pi
- A Raspberry Pi computer (for your first go-round, I recommend the Raspberry Pi 2 Model B for its powerful processor and 4 USB ports). The standard model is about $35 and is the easiest to use. The newest one is very inexpensive ($5) but a bit more difficult to set up and is not as powerful.
- A case for it (optional but recommended, typically $10, but you could build one out of Lego)
- A Power Supply (2.5 amp highly recommended) with a micro USB plug
- A class 10, 4-8 GB SD card (if it’s a RPi 2, A+, B+, or Zero, it should be a micro-SD card, otherwise, it should be a regular one or in an adapter). The class 10 part is really important. I’ve had great results with SanDisk Ultras.
- A spare keyboard and mouse or some unholy keyboard/mouse combo (this should be essentially free in since it’s, like, 2015 and all).
- A computer monitor with HDMI input. Or a normal HDTV will work. If you don’t already have something like this, then…well…I suppose you could buy one.
- An HDMI cable
- An appropriately sized SD Card reader. This one can be a problem, but there are inexpensive USB dongles that you can fit a microSD card into.
- A WiFi dongle is highly recommended but not necessary. If you don’t have one and you can get it near the router, then some ethernet cable can get you internet access.
If you don’t want to bother ordering all of that stuff, there are plenty of kits available that consolidate a lot of the equipment. I highly recommend Canakits as they have a reasonable price point and come with quality equipment.
Download the following software:
- The newest version of Raspbian. At the time of this writing, that is Raspbian Jessie, version November 2015. Debian likes to name their versions after characters from Toy Story. For reasons, apparently..
- Note: The most reliable way to download the image is to download the torrent and use a torrent client to get the file. I’ve found the direct download to be very unreliable since it’s such a large file (about 4 gigabytes).
- Win32DiskImager (Windows Only). I know, it’s on SourceForge and they are monsters, but just watch where you click and everything will be fine! You do actually need this if you’re on Windows.
Imaging the SD Card:
What follows are specific instructions for imaging the SD card on Windows and LInux. Macintosh instructions will be forthcoming.
- Ensure that you have Win32DiskImager.
- Insert the SD card into whatever card reader your computer has and open your file manager to verify which drive letter the card was assigned. In my case it is F: See Image of the Drive Letter
It is absolutely critical that you get this right because you will be completely wiping whatever drive you’re imaging.
- To open Win32DiskImager, right click on its icon and In the context menu, click “Run as Administrator”. If you don’t, it will fail. When it opens, you will see a spare, clean interface:
See Image of the before disk image
- Locate the image file you downloaded (make sure it’s unzipped) with the file chooser here. Make triple sure that the correct drive letter is selected under “Device”. Finally, click on the “Write” button and away you go. The progress bar will fill up over the course of the next several minutes. After a while, a little dialogue will pop up saying that the write was successful. Or not. But seriously, it’ll probably be fine.
See Image of the of the disk progress
- Open a BASH Terminal in your Linux environment because you’re running Linux and you like the command line.
- Type df -h into your terminal and press enter to see what’s currently mounted. You might see something like this picture of the mounted information
- Insert your SD Card with the full awareness that you are about to delete everything on it and run df -h You’re looking for the new entry.
See Image of the New Entry
In my case, it looks like this. If it’s a properly mounted SD card, it will be mounted in your media folder (the far right column). Everything is perfect so far.
- Next you will unmount the SD Card by typing the following command:
- umount /dev/sdcard, replacing sdcard with whatever the name of your card is. In this case, it would be /dev/mmcblk0p1
- Feel free to double check df -h to make sure it’s properly unmounted.
- Now the big command that makes it all happen. Make sure you’re in the directory where the image file is located and type the following:
- sudo dd bs=4M if=<raspberry-pi-image.img> of=/dev/<sdcard>
- replace <raspberry-pi-image.img> with the filename of the image you downloaded and <sdcard> with the name of your sdcard. Mine looks like this: See Image of the Burn Image Command
- Wait several minutes. You won’t see anything happening which can be disconcerting. Eventually, you will see a message reporting the success or failure of the operation. Here: See Image of the Burn Success
Setting up the Pi
Okay, now you’re ready to get your Raspberry Pi up and running. First, hook everything up. Into the USB ports should go a keyboard, a mouse, and maybe even a wifi dongle. Connect the HDMI port to a TV or HDMI capable monitor. Do not plug in the power cable until you are ready to begin, though. Once everything is connected, proceed with the following steps:
- When it boots up for the first time, you will see a lot of text scroll up the screen. It’s running through its boot up sequence. When it finishes, it will spit you out on the desktop. See image of the new Raspberry Pi Desktop
- Okay, you’re at the desktop. Click top right on the little doodad that looks like two computers connected together and log into whatever WiFi network you like.
- At this point, everything is go for launch, but stick with me just a little longer and click on the menu button top left, and then go down to “Preferences” and then open Raspberry Pi Configuration and we’ll do a little tweaking. I’ll go through it by tab. See Image of the Raspberry Pi Config screen
- Click Expand Filesystem. Wait. (This is actually a very vital step)
- Change your password.
- Change your Hostname (Name your Raspberry Pi)
- Boot should stay at “To Desktop” unless you’re a command line junky (which is beyond the scope of this tutorial)
- Leave everything else as it is unless you want to add your Pi to Rastrack which is just a fun online map of all the Pis that have been added to Rastrack.
- Camera: Disabled
- SSH: Enabled (lower security, but you can remotely access the Pi, to be in a later tutorial)
- SPI & I2C: Disabled (Advanced users only)
- Serial: Enabled
- Overclock: I usually bump mine up to 1000 MHz because reasons. But you don’t have to.
- GPU Memory: If you’re using the desktop (and you are), go ahead and bump it up to 512, which is half of your available RAM.
- All of this is generally self-explanatory. I advise setting UTF-8 as your character set because important reasons.
- Make sure you set your keyboard layout to whatever your country is. There are tiny, but infuriating differences between US and UK standard keyboard layouts.
- Hit ‘OK,’ then say ‘Yes’ you would like to reboot.
There are kind of a ridiculous number of things that you can do with this machine. By having a single dedicated hardware architecture, the Raspberry Pi Foundation have managed to custom tweak their operating system to most effectively utilize the system’s admittedly limited resources. As such, there is a surprising amount of software packed into this little thing. Head up into the “Menu” and lets take a look around:
Under Programming, we have two Java IDEs, Mathematica, Node-RED, two versions of Python, Scratch (great for kids), Sonic Pi and the Wolfram language environment. Neat! Though, if you’re going to get into Python, I suggest Geany over the default IDE. I can be installed straight from APT.
Under Office, there is the full Libre Office suite which comes standard on many Linux distros. This is a new addition to Raspbian Jessie and I think it’s great. I have tested it and while I get a few hangups when using Impress, the rest of it runs very reliably.
The ramifications of this are actually fairly significant: this device can actually serve as a simple productivity machine in its current state. Seriously? Yes. Seriously. I teach programming on this platform, for instance.
I’ll leave it to you to look through the other branches of the main menu, but there is one other thing that I think you should do before I let you go. Under Internet, there is a web browser. It is a pretty simple WebKit browser called Epiphany (I think) that I hate a lot. It works, just not very well. So I recommend you download Iceweasel, which is a fork of Mozilla Firefox (there’s apparently some bad blood between Debian and Mozilla, but hey, we still get free software and that’s all that matters).
To do this, open the Terminal. It’s the icon next to the file cabinet at the top of the screen. The one that looks like a scary black computer screen. This is the command line. But it’s really not so bad. You’re just going to type three little commands into it and feel like a hacker when it’s done. Here they are in order. Wait until each one is finished before typing the next one.
sudo apt-get update
sudo apt-get upgrade
Note: If there are any errors, just run the commands again. I did actually have mine fail once, and then work when I re-ran it. So these two commands will update all of your software, packages, and operating system to the newest stable versions. They might even take a while. More importantly, they will update your Advanced Package Tool (APT) (also, grow up) which will allow you to use the next command:
sudo apt-get install iceweasel
Wait until it’s done and you’re good to go! You’ll find Firefox…er…Iceweasel in your main menu under “Internet” where you can drag and drop it onto the quick bar. With it, you’ll have a much smoother web experience. I have even found Iceweasel to be more stable with web software like Google Docs/Sheets (I even wrote part of this article in Google Docs on a Raspberry Pi) and even Office 365 (though this will take a much bigger performance hit).
If you are interested in trying it, but want the full package to start out (case, charger, memory, and all), you can order a CanaKit Raspberry Pi from Amazon. Have fun and happy hacking!