Posted on

Raspberry Pi First Steps

There are loads of web pages out there that are meant to guide you through the process of setting up your RPi for first use. I wrote this version as a reminder on how I created my “baseline” installation upon which all my projects are built.

Building a Base Image

The goal is to create an image that represents the absolute minimal setup for a Pi with the Raspbian Linux OS, using the distribution that was obtained from the Raspberry Pi organization downloads page. During the installation the only devices attached were the HDMI cable, network cable, a USB keyboard, a USB Wi-Fi dongle and the power supply. I started with a 4GB SD card because I wanted to save my SD card images for reuse later, and I wanted the image files to be as small as possible without having to manipulate partition tables (something like Gparted would help with that if you are so inclined). Of course you can always compress your saved images into a ZIP file.

Each build I created uses this as the foundation with the objective to keep the images small. Once you have flashed one of these images to your own SD card you can choose whether to increase the space available to the maximum using the raspi-config utility, or increase it in smaller increments by using the Gparted linux application (advanced users only as this means fiddling with the partitions manually).

These are the steps taken to build the BASE image.

Preparing the SD Card

Download the Raspbian (Wheezy) image to your computer. You can find the image at the RaspberryPi.org website downloads page.

sdformatter

Use SDFormatter to format your new SD card. There is a PC and MAC version of this at the SD Association downloads page. This step requires plugging the SD card into your computer, or using an SD card adapter that can plug into a USB port. The app is very easy to use and pretty self explanatory for using it to format your SD card to a FAT32 type device (I use 512 byte partition blocks, which I believe is the default setting).

 

win32diskimager-write-to-SD

 

Windows users can use Win32DiskImager to write the raspbian-wheezy image (2GB) to the memory card. You can use this to write the

Eject the SD card from your PC and insert the SD card into your Raspberry Pi.

Starting Up and Configuring the Pi

Applying power starts up the Pi. But first, connect a monitor, keyboard and a network cable to a working Internet connection, and then plug in the power to the Pi. When the Pi boots up it launches the raspi-config utility, where you customize your installation with a few simple steps.

At the raspi-config menu do the following:

Select Option 8 – Advanced Options
Select A7 Update – run this first in the Advanced Options area to update this tool with the latest version

Select Option 4 – Internationalisation Options
Select Change Locale
Scroll through the list presented and uncheck en_GB.UTF-8 UTF-8
Scroll down a little further and check en_US.UTF-8 UTF-8 – select OK
At the next screen select en_US.UTF-8 for the default locale – select OK

Select Option 4 – Internationalisation Options
Select Change Timezone
Select US
Select Eastern (or wherever you are)

Select Option 4 – Internationalisation Options
Select keyboard
Select generic 101-key PC
At the next screen scroll down to select other
Select English (US) (if you dont, you get british sterling symbol for the hash sign)
At the next screen scroll up and select English (US) at the top of the list
At the next screen select \”The default for the keyboard layout\”
Next select no AltGR key
Next select no compose key
Next select yes for ctrl-alt-backspace to terminate X server

Select Option 8 – Advanced Options
Select A2 – Hostname
I used RPi-Base-Image, but you can give it something else – and you can change it later at the command line or with this utility.

Select Option 8 – Advanced Options
Select A4 – SSH
Enable SSH because you will want to connect to it from other computers later using an app like Putty

Select Option 7 – Overclock
I set to Modest (900Mhz) which has no voltage increase – 700Mhz is normal.

Select Option 1 – Expand Filesystem
You can do this step now or later. It enlarges the disk partition to the maximum size of your SD card.

Select Finish

Reboot the Pi, by entering “sudo shutdown -r now” or “sudo reboot” to expose full size of filesystem.

Check the amount of space used on the SD card
df -h
Mine showed the rootfs as 2.6G in size, 2.1G used, 428M available

Updating the O/S

Run the following to update the OS:

sudo apt-get update
This may not take very long to finish.

sudo apt-get upgrade
This step takes a few minutes so go grab a coffee, cappachino, soda, pop, coke, adult beverage, or whatever and be patient.

This pretty much finishes up your baseline installation. I recommend you create a backup image at this point so if you do something bad to your build later, you can simply re-flash the SD card with the backup image and save yourself a lot of time.

Stopping the Pi

To gracefully shutdown the Pi, you must log in, and issue the command sudo shutdown -h now. Wait until the Pi display goes dark and the green LED stops flashing before unplugging the power cable to turn off the Pi (about 20 seconds).

Backing up your SD card

After you have shutdown the RPi, and unplugged the power cable, remove the SD card and insert it into your PC.

win32diskimager-read-from-SDLaunch your Win32Diskimager application.
Put a name in the filename area for your backup. It wants the whole path to a folder, so enter something like C:Users<your username>DesktopPi-backup.img, replacing the <your username> with the actual username you are using on your PC.
Click the READ button to copy the SD card to the new file.

Fini

That should do it! You now have a bootable SD card and a backup of it. My advice is to use a fresh image to experiment with, then as you have a functioning build from your experimentation, make a backup of your SD card and you will have a way to recover to good working points.

Cheers!