Setting Up Your Raspberry Pi

Setting Up Your Raspberry Pi

Raspberry-Pi-Logo thumb 200I recently configured a Raspberry Pi as a throughput test server for use with Ekahau Site Survey 8.0. It was my first experience with a Pi, and as simple as it seems now, I stumbled through it at first. I was going to do one post on the entire configuration process, but decided to split them into two shorter ones. In this post I’ll go over required hardware, installing the OS (Raspbian) image, and basic configuration and commands. I’ll be doing everything with sudo, which you can read about at that link. There will be links to documentation for most commands for those of you who are interested or green like me.

I believe there are approximately 1,000,001 things you can do with a Raspberry Pi. Jake Snyder (twitter, blog) has some cool ideas, such as this. Check out for lots of RPI info. A Google search will also keep you busy.

Edit: Commands have been bolded because italics don’t seem to be working…


Required Hardware

You will need the following:

  • Raspberry Pi w/ power supply
  • USB keyboard
  • Monitor
  • Any combo of cables and adapters that will connect the Pi’s HDMI output to your flavor of display
  • Wired internet connection (recommended for updates and because I’m not sure what USB wifi adapters work with the Pi)
  • USB KVM switch can be handy too
  • microSD card, at least 8 GB
  • Internal or external card reader of some kind, and probably a microSD-to-SD adapter


Flash Your SD Card with Raspbian

You’ll need to download and install an OS image onto your microSD card. I grabbed Raspbian from here. Raspbian is a version of Debian that is optimized for the Raspberry Pi. *EDIT: As of February 2016, there is now a lite version of Raspbian which is about 1/3 the size and excludes many packages which are unnecessary for networking use. If you want to use any of the missing packages, you can get them with apt-get install. The lite version does not include the desktop GUI and boots to the CLI, making it perfect for a headless networking tool.* Extract it to wherever you want, but remember where you put it. Then head over to SourceForge and get Win32 Disk Imager. Install that, and open it up. Insert your microSD card into whatever reader you have. You may need to format it as FAT32. Make a note of the drive letter that the card is assigned, then open up Win32 Disk Imager. Click on the blue folder icon, browse to the location you saved your image, and select it. Then MAKE SURE you have selected the correct disk letter! Once you are sure of that, click Write. It’ll take ten-ish minutes. When it’s complete, click exit. You can remove the card and insert it into your Raspberry Pi (while it is not connected to power!)



Basic Configuration of Your Raspberry Pi

Next, connect up your keyboard, monitor, network connection and power. You should see the boot process happening if you have your monitor on the correct input. You’ll come to the raspi-config screen, which looks like this. You can get here from the command line with the command sudo raspi-config.


I only did one thing at this menu:

1) Expand the Filesystem – I wasn’t planning to put any other partitions on that card, so I let the file system fill the entire SD card. If you think you might want to dual-boot, maybe don’t do this, but that is beyond the scope of this post.

There are other options to check out, and you may find something you want to change. You can change the keyboard layout here but I had more luck editing the file at the command line interface – I’ll go over that shortly. From the screen above, arrow right two times until <Finish> is highlighted in red, and hit enter. You’ll be asked to reboot now; select yes, hit enter, and you’ll be rebooted to the CLI. Log in as pi. The default password is raspberry.


You can change the password with the command passwd. Type passwd pi and hit enter. It’ll look like this:


Let’s change the keyboard layout next, as the default is a Great Britain layout. To do so, you need to edit the file /etc/default/keyboard. Type sudo nano /etc/default/keyboard and hit enter. Nano is an editor. There are other editors out there but I learned on nano, so I stick with it. You should see the image below.


You’ll want to change the “gb” to “us” (or whatever the code is for your keyboard). Just use the arrow keys to move the cursor, then delete and replace the two characters. It should look like this image.


Hit ctrl-x to exit, y to save, enter to confirm the file name, and you’ll come back out to the CLI. Type sudo reboot and wait for the Pi to reboot, then log back in.

If you’re like me and have the Pi connected to your main monitor, you’ll want to get rid of that video connection and SSH to it. That eliminates pesky input flipping, and allows you to copy and/or paste lines of commands or take screenshots. The Pi is configured for DHCP by default; you can confirm the network configuration with the cat command. Type cat /etc/network/interfaces and hit enter. The output should be similar to the image below. The important part is the eth0 interface.

network interfaces

If you want to use a dynamic address, you’re golden. You only need to find what IP address it received. You can use either the ifconfig or ip address commands. The image below shows the outputs of both.

ip address

Make a note of that IP address. You can now SSH to your RPI – unless you want it to use a static address.

If you want to assign a static IP address, you’ll have to edit the file /etc/network/interfaces just like we did the keyboard file. Type sudo nano /etc/network/interfaces. You’ll want to make the file look like the following image, but make sure the address, netmask and gateway are specific to your network. I like to comment out the DHCP line – it’s simple and then it’s always there. Use the # sign at the beginning of a line to make that line a comment. If you use the number pad on your keyboard for typing addresses, make sure Num Lock is on, or else you could end up with your file looking all kinds of funky. If that happens, just exit with ctrl-x and hit n to discard changes, then head back into the editor and start over. When in doubt, exit without saving!

network interfaces static

When you’ve got the address information entered, hit ctrl-x to exit, y to save, enter to confirm the file name, and you’ll come back out to the CLI. You don’t have to reboot to make the change take effect, but you will need to stop and start the networking service. Be warned, if you are connected via SSH and you stop the networking service, you’ll be disconnected. You’ll have to either reconnect the HDMI output to your monitor, or power cycle the Pi. You can, however, do a restart instead. Type sudo /etc/init.d/networking restart. You might see some warnings, but don’t worry about them. You will lose your SSH connection if your IP address changed, so reconnect to the new address and do a cat /etc/network/interfaces to confirm your config. I found it easier to do the basic setup with the keyboard and monitor connected directly to the Pi. Wait to use a remote connection until you’ve got the network config the way you want it and you’ve confirmed internet access. You may also need to think about what VLAN you are plugged into, depending on your network setup. You won’t need to configure a VLAN on the Pi, but it may affect your addressing.

Finally you’ll want to update and upgrade the packages on your system. You should confirm internet access before doing this step, otherwise you’ll end up with a whole screen full of failures. Try the command ping to check your connectivity. The update/upgrade process is very simple, but can take some time, depending on how recent your image of Raspbian is. Type sudo apt-get update. You’ll see something like this:

apt-get update

Next, type sudo apt-get upgrade. You’ll see a few lines of output, including how much disk space will be freed or consumed. Hit y and the process will continue. You’ll see something like this image, and more output afterwords until it is complete.

apt-get upgrade

Your Raspberry Pi is now configured, on your network with internet access, and up to date! My next post will go over how to configure the iperf3-ekahau throughput server and use it for active throughput surveys with Ekahau Site Survey 8.


Logging in as root

If you want to log in as root, which is akin to being an Administrator in Windows, you can use the command sudo passwd root to set a password for the root user. Type the command logout, and then reconnect as root instead of pi. You no longer need to type sudo before commands, but your home directory will change. Use caution if you are going to dig around as root!

Thanks for reading!

Post Tagged with , , , ,