Raspberry Pi: getting started!

 Part One: the basics

 

Why?

Not “Why buy and try a Raspberry Pi?”, because I believe I already explained in my previous post what is so neat about the Raspberry Pi. If you’re still not convinced Google around a bit and be amazed about what this little computer can do, and what people around the world do with their Pi’s.


Someone even came up with the wonderful idea of using a pi for home beer brewing, instantly becoming a favourite! Must try my hands on this too, one day…

Instead, this “why” is more “why this getting started guide?”. Well, just as much for my own benefit as for anyone else, should I ever need to start from scratch. Feel free to copy whatever you need, but be aware that I take no responsibility whatsoever!

 

What?

A pretty basic Raspberry Pi, the Model B. I use Raspbian as the OS which is the standard, although there are many other flavours. I installed my Pi headless (no directly attached monitor, keyboard or mouse) as also use it as such. I intend to use it as a virtual USB Hub (after I have stopped playing with it…) so I’ll show you how that is set up as well.

This is NOT a tutorial from the very bottom, or in other words I expect you to have at least basic Windows and Linux knowledge. If I write “use Win32DiskImager” I expect you to be smart enough to know where and how to get it, install it on your Windows PC and use it. The same goes with PuTTY, etc. If you don’t…Google until you find out yourself, it’s easier than you think!

 

How? Installing Raspbian

There are countless pages and blogs on how to do this. Start at the very source, the Raspberry Pi Foundation, if you’re unsure. Where it boils down to is that you copy the Raspbian image to a SD card with Win32DiskImager, insert the card into your Pi, connect an Ethernet cable and finally power up the Pi. Lights will start to flicker…and that’s it. Nu humming, no bleeps, nothing. That’s okay, that’s how it’s supposed to be.

By the way, train yourself never to hot-plug or -unplug anything on or from your Pi. Things might go bad. Also never unplug the power cable until you have done a software shutdown. Otherwise your SD card might not like it. Connect everything you want first, then power on. Just a bit of advice…

Okay, now what? You’ll have to find which IP address your Pi is using. Check your DHCP server for that. If you don’t have DHCP (not even in your router) then a headless installation is maybe not suited for you and you will have to connect a monitor and keyboard first and after the initial installation assign an IP address manually with ifconfig.

In my setup, I added an IP reservation in my DHCP server and also added an A-record in my DNS server, so I now can reach my Pi with its hostname.

Use PuTTY to start a SSH terminal session to your Pi. Luckily the people responsible have been so wise to add and enable an SSH server in the installation image. Be sure to set PuTTY to use UTF-8, otherwise you’ll get funny characters in your terminal screen (Category -> Window -> Translation -> Remote character set). Is is easiest to save your PuTTY session with this configuration, and use this session from now on.

 

Configuring Raspbian

If everything is well, you’re in! Your user name (for now) is pi, the password is raspberry, all lowercase (Linux is strict about that, remember). After logging in you’ll see a beautiful prompt, and some note that you haven’t yet configured Raspbian yet. We’ll do that at once!

sudo raspi-config

sudo is like “Run as Administrator” in Windows, just so you know. You’ll be doing a lot of sudo’ing as you go along! The people at Raspbian have been kind enough to pack a lot of configuration commands, some of which are long and tedious, into a nice menu which you can navigate with your keyboard and select the things that you want. But not everything is logical though: the very first thing that needs to be done is hidden away at the end! Go to Advanced Options->Update and do that first. Wait until the raspi-config menu returns.

After that’s done, go through the settings and change to your liking. If I were you I would just start by changing the hostname, locale and time zone. Definitely keep your hands off overclocking and such, until you know what you’re doing…

Finally, reboot your Pi. The full and proper command is

sudo shutdown -r now

but

sudo reboot

will work just as well.

 

Updating Raspbian

Of course, we want to be using the latest firmware and software packages. If you think Windows has a lot of updates and patches, then get a load of this! Again Raspbian offers a set of easy to use commands. First we want to get the latest list of files in the packages repository:

sudo apt-get update

Then we want to upgrade everything that is not up to date:

sudo apt-get upgrade

No, that’s not the same command as the one before. Read better if you think otherwise…

Finally check for new Raspbian release:

sudo apt-get dist-upgrade

By default, updating and upgrading is a manual process. There are ways to do this automatically on a schedule, just as Windows does (for most users), but that’s a bit more difficult to set up and anyway the opinions vary (very much) whether that is a good idea in the first place. For now I (would) stick to doing it manually on a regular basis.

 

Next time I’ll be getting rid of the default user “pi”, and connect to the graphic desktop with a simple Windows RDP session. And more!

 

Cheers,
Marco