Raspberry Pi Initial Setup
Materials
I recommend using one of the two kits below from Adafruit. Which one you should choose depends on the nature of your IoT project.
Selecting a Distro
The Raspberry Pi is capable of running a large number of operating systems. The Embedded Linux Wiki maintains a comprehensive list of distros for the Pi. However, the folks at the Raspberry Pi Foundation host the most popular versions and the installer on their downloads page. If you want to keep things simple, go ahead and download NOOBS (New Out Of Box Software) with Raspbian included and skip to the next section. If you don't even want to do that, you can buy SD cards with the same software pre-installed. There is a second version called NOOBS-lite that does not include Raspbian which is used to download and install any of the officially supported distros. The advantages of using this is that the vanilla installer is much smaller in terms of disk space and the Pi will always install an up-to-date version of the desired distro. However, the Pi will need to be connected to the internet (either WiFi or Ethernet) in order to download the distro in-place.
With the release of the new Raspberry Pi version 2, Microsoft and Canonical have announced they intend to release versions of their own operating systems, Windows and Ubuntu respectively, to run on the updated hardware. Snappy Ubuntu Core is already available on the downloads page.
Prepare SD Card
When choosing your SD card for the Pi, you need only worry about capacity and form, not the manufacturer. My recommendation is a 16GB Micro-SD card with a Micro-to-Standard adapter. The minimum recommended capacity is 4GB, but that leaves less than 2GB for programs and media storage. With 16GBs, you won't ever have to worry about running out of space (for normal use cases). As for the form, the A+, B+, and B2 all use Micro-SD card slots whereas the A and B use standard. Having a Micro SD and adapter allow you to use the OS with any version and makes it far more likely that you can set up the SD card with your own computer.
Formatting a disk erases all of its contents! Take care that you don't start erasing your own computer!
Whether or not there's anything currently on it, you should always format the SD card before installing your chosen OS. While not true for every distro, most say to use the FAT32 (File Allocation Table) format. In addition, you should choose the "slow" method (overwrite with zeros) if the option is available. For Windows, I recommend using SD Formatter from the SD Association. Mac and Linux have their own Disk Utility / Disks which do a great job. If you have a Mac, however, I recommend using the program I mention below.
If you downloaded either version of NOOBS, all you need to do is copy all of the downloaded folder's contents onto the SD card and eject it. If you'd rather install the OS without NOOBS or it is not supported by NOOBS, go here to read the Raspberry Pi Foundation's installation guide. They have instructions for Linux, Mac, and Windows. If you use a Mac, however, I highly recommend using a free program called ApplePi Baker. It provides an easy graphical interface to format SD cards, install your OS, and back up your current image all tailored for the Raspberry Pi.
Once your OS is installed, it's time to boot and configure your new OS.
First Boot
First off, there are two primary ways of interacting with the Pi upon first boot. The first way is using a USB keyboard and connecting the Pi to a display with an HDMI cable. The second way is using a USB console cable with the GPIO pins and your laptop. This allows you to use your computer's keyboard and screen to interact with the Pi. If you don't know how to use a console cable, Adafruit has a quick tutorial on using a console cable with the Pi. There's a third way which lets you SSH into the Pi if it's connected to your network via Ethernet, but you should only use it if the other two options are not available. I would also recommend not changing any files (like wpa_supplicant for WiFi) before expanding the disk during setup.
From this point on, all of the screenshots and setup specifics are for Raspbian and other Debian-based distros.
Upon first boot, the Pi should display the screen shown below. This program is included in most, if not all, RasPi distros. If you get a login prompt instead, the default username/password combo is pi/raspberry. Then enter sudo raspi-config on Raspbian. Pidora has a similar config tool called firstboot.
Once everything has been set, go to finish and reboot the Pi.
Updating etc
Upon second boot, the Pi should show a terminal login screen or a desktop if option 3 was changed (open up a terminal window to follow along). Login with username pi and the changed password...the password was changed, right?
If the keyboard layout couldn't be changed in raspi-config (it is the most finicky component to configure with that utility), here is the simple way to do so. We are going to open a file and change two letters; that's all it takes. Type sudo nano /etc/default/keyboard into the terminal and a text editor should appear with a top line that says # KEYBOARD CONFIGURATION FILE. Find the line that says XKBLAYOUT and change its value to your keyboard's layout, ie US:"us", UK:"gb", Spanish:"es", French:"fr", German:"de", Russian:"ru". Press ctl+x to save and enter Y to confirm the save. If you got a write error, it's likely the terminal command didn't start with sudo. The great thing about this fix is that it works on all Debian-based Linux distros including Raspbian and Ubuntu.
Next up the Pi needs to get connected to the internet. The simplest way is to connect the Pi to a router via an Ethernet cable. If the Pi doesn't need WiFi access, click here to skip to the next section. First let's test to see if the Pi is already connected. Type ifconfig to print the Pi's network status. We're looking for a line that contains inet addr:192.168.x.x where 192.168.x.x is your internal IP address. If the Pi is connected via Ethernet, you'll find it under eth0. If by wireless adaptor, wlan0. If wlan0 doesn't have an IP address, we'll need to configure it. The easiest way to do it is via the WiFi utility found on the desktop. However, if you're stuck using a terminal, we'll need to edit a file in nano.
Now that the Pi is connected to the Internet, the first thing that should be done is bring its software up to date. This can be done with the following line:
sudo apt-get update;sudo apt-get -y dist-upgrade
It's actually two commands; the upgrade will start immediately after its local repositories are updated. Depending on how long ago the most recent distro release was, this might take a while, especially if your Internet connection is slow. Once everything is done, reboot the Pi for any changes that need it.
Easy atBoot
One of the best uses for the Pi: embedded projects. One of the hardest things to figure out: how to get your program to start at boot. Rather than trying to hack together a solution or edit system files, we can create an easy "at boot" file in the home directory using a program called Crontab. Crontab comes with Raspbian and is used to schedule events on the system. We'll use it to make a file run when the Pi boots up.
That's all there is to it. Now any terminal command in atBoot.sh will always run at start up. A two caveats about using this method. First, every terminal command and program run will have root permissions as it is the root user that automatically executes them. Any file or folder created by these programs will require root permissions to read and write to. Second, because the root user doesn't have a home directory, ~ extensions do not work. No problem though. Just expand the file paths yourself by replacing '~/' with '/home/pi/'. If you forget to do this, you can always use "sudo find / -name file.txt" to find the file for you.