Setting Up Your First Raspberry Pi Server
The Raspberry Pi Single Board Computer (SBC) is a powerful and useful tool for smart home enthusiasts. Being compact and low power, it provides the perfect platform for hosting hubs and utilities like Homebridge, Scrypted, or Home Assistant.
Making the jump into open-source tools to level up your smart home can be a bit daunting. Using a Raspberry Pi for these purposes is a good choice but adds another level of setup that can be a deterrent to getting started.
If you haven’t used a Raspberry Pi before, this guide will take you through the steps to prepare one for installing and hosting these kinds of tools. It’s actually much easier than you might think.
Who Is This For?
There are plenty of cool uses for a Raspberry Pi, and add-on accessories to match. This includes cameras, screens, sensors and all manner of maker goodness. You can even use it as a full blown PC if you want, with the inherent performance limitations of course. All that aside, this guide will focus on using the device as a headlesss server for hosting various smart home tools. This cuts down the setup steps you might otherwise need, and gets you to the point where you can install whatever tool you had in mind.
What You’ll Need
Much of what you’ll need will be provided in a typical Raspberry Pi Starter Kit, like the good options from CanaKit. Indeed, these kits will come with a pre-configured MicroSD card with the OS already on it, so they’re a good choice for getting started quickly.
If you use this pre-built MicroSD card, you’ll need to temporarily plug in a monitor, mouse and keyboard to do the initial setup of things like user account and network settings. For this reason, I’d recommend preparing your own MicroSD card anyway. We’re not going to be using those peripherals afterwards, so we can avoid this headache entirely.
I’ve marked the items that you’ll get in a starter kit with an asterisk(*).
*A Raspberry Pi - The device itself, Smart home use cases generally only need a Raspberry Pi 4 or 4B, but you can splurge for a 5 if you like.
*A Raspberry Pi case (recommended) - You can just plug in your Raspberry Pi and go, but it’s not a good idea to leave it exposed to dust and contact foreign objects. Getting a decent case to keep it in makes it safer and more easily stored or mounted for the long term.
*Raspberry Pi heat sinks - Heat sinks are a must to avoid thermal damage. A good case will come with them, or you can buy them separately very cheaply. Be sure to get the correct heat sinks for your Raspberry Pi version.
*Power supply - Commonly provided with starter kits, you may have a suitable USB-C power supply already on hand. This will need to be 15W at a minimum.
*A MicroSD card - This is your Raspberry Pi’s ‘hard drive’. You’ll use it to pre-load the operating system. 32GB is usually fine unless you plan to record video on it. I’ve had good experiences with SanDisk and use them for my various Raspberry Pi units.
A USB MicroSD card reader - Needed to do the pre-loading. You’ll do this on a regular computer using the handy Raspberry Pi Imager tool. These are inexpensive and handy to have around. Look for a decent one like this from Anker.
A PC with the Raspberry Pi imager program - The tool that prepares your MicroSD card for use.
An SSH client - For Windows I prefer PuTTY. It’s an older style tool, but it’s free and works well. For Mac and mobile, I use Termius. The free plan is sufficient for our needs.
Quick Process Overview
The process for setting up a Raspberry Pi is actually fairly straightforward and is made simpler by the use of a dedicated imager tool to get the OS configured and ready for use before you even turn it on. With the correct items this can be done in about 30 minutes all up. The process looks like this:
Insert the MicroSD card into the USB reader
Insert the reader in your PC
Run the Raspberry Pi Imager
Select the correct Pi version and configure the customizations
Write the image to the MicroSD card
Add the heat sinks to the Raspberry Pi
Place the Raspberry Pi in the case
Insert the MicroSD card in the Raspberry Pi
Plug in the power and wait for boot
Now you’ll be ready to open an SSH console to install your intended tool.
Preparing The MicroSD Card
This stage represents the bulk of the prep work you need to do to have your Raspberry Pi ready for use. The first thing to do is get the imager tool installed on your PC.
Once you have the imager installed, insert the MicroSD card into your USB reader and put that into the PC. The storage volume should be recognized, and we’re good to go.
Run the Imager now. The first page gives you three options: Device, OS, and Storage.
Click Choose Device and select the model of your Raspberry Pi.
Click Choose OS and select Raspberry Pi OS (64-bit) - this is the one we’d normally use.
Click Choose Storage and select the drive that represents your MicroSD storage volume.
Click Next.
On the pop-up that appears click Edit Settings. We want to make a few customizations before we write the image.
On the General tab we want to tick Set hostname, Set username and password, Configure wireless LAN, and Set locale settings. For the hostname I like to use something that describes what is running on this device. The username and password will be for your admin user, make sure you write it down. You can actually leave the Wireless settings unticked if you only plan to use Ethernet for connectivity.
Move to the Services tab and tick Enable SSH with password authentication.
Click Save.
Now click Yes on the pop-up to use the customizations we’ve made.
You’ll be asked to confirm the write. All data on the card will be erased. Click Yes and the process will start. This will take several minutes depending on the size of the card. The image will be downloaded, written and then verified.
Note: On Windows I’ve found that once the write process is complete, you’ll be asked to Format the drive. Windows will complain it can’t read it and warn you. This is because the card is no longer in FAT32 format, so Just cancel this and remove the card from the reader.
Preparing The Raspberry Pi
Now we just need to get the Raspberry Pi itself ready to use. It’s easier to place the heatsinks prior to inserting the Pi in the case.
The heatsinks are self-adhesive, so this is pretty simple to do. Just peel off the backing and stick them into place. I find using a pair of long hobby tweezers or long nose pliers to be helpful here.
For the Raspberry Pi 4/4B there are 4 heat sinks to install - 2 large and 2 small. Place them on the chips as shown below (the aluminium heat sinks in the center of the image).
Now insert the Raspberry Pi into the case. This will vary with the specific case you have. This one has three parts: The bottom where the Raspberry Pi is screwed into place, a middle section that slots over the ports, and a top ventilated cover that simply inserts into the holes around the edge. This also supports an optional cooling fan that connects to the GPIO pins as shown in the image.
With the case assembled, we can now insert the MicroSD card into the slot on the end of the Raspberry Pi. This is at the opposite end to the Ethernet and USB ports. The metal contacts on the card should face up.
Power Up And Login
Everything should now be ready to get into using the device. If you’re using Ethernet for connectivity, plug the network cable in. Now plug in the power supply. This should be a regular USB charger with a 5 Volt, 3 Amp rating or better. You want at least 15W. The Raspberry Pi 3 series will use a micro-USB plug, while the 4 and 5 series will use USB-C. You’ll find the USB power port on the side.
Give the device a minute to power up and connect to the network. If you’ve set things up right, it should come online. You should be able to use the ping command from a command prompt or terminal window on your PC or Mac to confirm it’s ready to connect. You should be able to use the hostname you specified in the custom settings of the image. In the example above I used the name toolname.local.
Once the Raspberry Pi is on the network, you can log into it via SSH using you chosen app. Log in with the username and password also specified in the custom settings of the image. You can now run the install for whatever tool you need to host on your Pi using the instructions provided by the tool. This will usually by a command line string you can simply copy and paste from the website.