[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”The geek factor is quite high here, but this process is not particularly taxing.” cat1rating=”2.5″ overall=”false”]
- Part 1: Getting started with the Raspberry Pi
- Part 2: Creating/restoring an image of the Pi’s SD card
- Part 3: Using the Raspbery Pi to host multiple web sites and as a file server
- Coming up – Part 4: Creating a Dropbox replacement from a Raspberry Pi
- Coming up – Part 5: Using a Raspberry Pi as a thin (or remote desktop) client
In the line of my work, I’ve recently had cause to become better acquainted with every geek’s favourite cheap computer, the Raspberry Pi. At the time of writing, you can pick up a Pi for an extremely reasonable £30, but the first thing I discovered was that this is only half the story. For a workable system, you need all the necessary cables, some storage and a case. Here’s my shopping list:
- The latest model B Raspberry Pi: £29.99.
- A decent case. The case I chose has received good reviews, (to which I would add my own). The Pi fits snugly inside and the case comes with status indicators plus a VESA mounting kit if you want to attach it to the back of a monitor. £8.99.
- A branded, 32GB Class 10 Micro SD card with full-size adapter (it’s a full size slot on the Pi). This seemed to be the best trade-off of price vs. capacity at £16.85.
- A 1m HDMI cable. It probably goes without saying, but make sure your monitor/TV has an HDMI input – otherwise choose whichever cable is most appropriate. £2.44.
- A generic 1A USB power supply with a reasonably long cable. For sure there are lots of other ways of powering your Pi, but this was a simple, self-contained (easily replaced) option. £4.75.
- SanDisk Cruzer Blade 16GB thumb drive, in case I needed extra storage. £6.93.
So my total is £69.95 – over twice the price of buying just the Pi. But still pretty cheap, considering. You’ll also need a USB mouse/keyboard for initial input. I’m going to run my Pi headless (no screen or input devices needed, just a network connection), so I’m borrowing my Microsoft Natural wireless desktop for this purpose, which the Pi detected without issue.
This may well be the easiest hardware installation you ever perform. The case has a couple of punch outs that you need to remove for the model B Pi. I forgot to photograph them I’m afraid, but it will be obvious – when you try and put the Pi in the case, it won’t fit without these pieces removed (e.g. for the ethernet port).
Put the Pi in the case.
Put the case together and fasten the screws. Make sure you put the VESA mount between the screws and the case, if you’re going to monitor-mount the Pi.
What to do, what to do…
There are lots of potential uses for your Pi. It has limited processing power and memory but apart from that, the only real limit is your imagination. I have no imagination to speak of, so I’m going to do what I do with every other gadget: put Linux on it and set it up as a home web/file server. I’ll cover the web/file server setup in a subsequent tutorial.
Here’s the plan:
- Install Rasbian (a Pi-centric version of the venerable Debian GNU/Linux distribution).
- Set up Webmin/Virtualmin for management of the server/web sites.
- Install OwnCloud and create my own Dropbox replacement.
- Experiment with using the Pi as a remote desktop client or thin/fat terminal.
In the process, I’m looking for any major issues or gotchas – things you might want to be aware of if you’re thinking of getting into Pis in a big way.
Prepare the SD card
For this step, you’ll need an SD card reader. If you don’t have a laptop/computer with a built-in reader, you can buy an external reader here. Note: my laptop’s built-in card reader was not supported by the SD Formatter program (see below) so I used an external reader.
- From the SD Association’s official website, download and install the SD Formatter.
- Format the SD card using SD Formatter:
- Download NOOBS (“New Out of Box Software” – chortle) from the official Raspberry Pi website. This file is currently over 1GB. I tried the direct download and it was pretty slow, so I’d recommend using the torrent if you’re so equipped. NOOBS gives us a choice of different operating systems to install on the Pi.
- Extract the contents of the NOOBS zip file onto the newly formatted SD card.
Whack the SD card into the Pi and connect everything up (power last of all, since there’s no power switch). If at this point you don’t see any output, the chances are that your SD card has not been recognised. I’m using a Class 10, but I’ve read that some people have had problems with Class 10 cards and better results with Class 6. If your card is recognised, you should be rewarded with a few pretty lights when powered up.
Install and configure Raspbian
At the NOOBS screen, choose Rasbian and click Install OS, then Yes. Go grab yourself a quick coffee.
The install will take a few minutes (the speed of your SD card is a factor here). Once it’s done, you’ll see a message “Image applied successfully”. Click Okay to reboot the Pi with your new OS.
raspi-config will launch with some initial setup options. I’ll work through them one by one.
- Expand the filesystem: You can skip this, because this option isn’t needed for NOOBS-based installations. Otherwise, this ensures you’re using the whole of the SD card.
- Change the password for the “pi” user. The default password is “raspberry”. Improve on that.
- Enable/disable boot to desktop: I’m not planning to use a desktop system with this Pi. X Windows is such a resource hog that we definitely want to set this to “No”. Of course if you want to use the Pi as a desktop system, you’ll select “Yes” here.
- Internationalization options: I’m in the UK, with a UK keyboard layout. It’s not a huge problem since generally I’ll be accessing the Pi via a web interface or service, but I am fussy, so I set everything up to be UK-centric. My correct locale was already selected. In these dialogue boxes, use the spacebar to select/deselect options, tab to move between fields, up and down cursors keys to navigate and enter to select.
- Enable camera: do this if you’ve bought the optional camera module (I haven’t).
- Add to Rastrack: this puts you on the Rastrack map of Pi installations. Not for me, but you might be interested.
- Overclock: if you need to squeeze more juice out of your Raspberry, you can force it into a more frantic mode of operation. I’m not going to do this, at this stage.
- Advanced options: Here, I’m going to set the hostname of the Pi and reduce the Pi’s use of GPU memory to 16MB (since we’re not running a graphical desktop). I’m also going to ensure that SSH is enabled (for later remote logon purposes).
- Finish and reboot to an ordinary logon prompt.
- For demo/proof of concept servers where security is less of a concern, I like to be able to log on as root. You can give the root user a password by logging in, then entering
sudo passwd rootand following the prompts.
I need this Pi to have a static IP address. You can use a DHCP reservation for this purpose if you like, but I prefer to create a fixed IP address on boot. Like this:
- Log in.
- If you didn’t log on as root, give yourself an elevated shell:
- Install your favourite console-based text editor. For me this is vim:
apt-get --force-yes -y install vim
- Use the editor to edit the
/etc/network/interfacesfile. Replace the line
iface eth0 inet dhcpwith
iface eth0 inet static
adjusting the values to match your network as appropriate.
- My DNS was already correctly configured, but you may need to check the contents of your
/etc/resolv.conffile to ensure DNS is set up. If in doubt, this configuration should work:
- Save the files then back at the command prompt, enter
rebootto restart the Pi with the new network configuration.
Once the Pi is up and running you’ll be able to connect via SSH using your favourite terminal emulation program (mine’s PuTTY).
As you’ll see from the Contents section above, I have a few ideas for things to do next. It’s a good plan to take a snapshot of the Pi in its current state, so we can hit the ground running any time we want to try something different, with a Raspbian base, so this will be the subject of my next how-to. In the meantime, if you have any questions about what we’ve done so far, or if you have any ideas for later tutorials, let us know in the comments!
Until next time. 🙂