Raspberry Pi: the Perfect Home Server
Ever since the announcement of the Raspberry Pi, sites all across the Internet have offered lots of interesting and challenging uses for this exciting device. Although all of those ideas are great, the most obvious and perhaps least glamorous use for the Raspberry Pi (RPi) is creating your perfect home server.
If you've got several different computers in need of a consistent and automated backup strategy, the RPi can do that. If you have music and video you'd like to be able to access from almost any screen in the house, the RPi can make that happen too. Maybe you have a printer or two you'd like to share with everyone easily? The Raspberry Pi can fill all those needs with a minimal investment in hardware and time.
Raspberry Pi Benefits
Low cost: for $35, the RPi model B is nearly a complete computer with 512MB of RAM, 100Mb Ethernet, an SD card slot, two USB ports, audio out and HDMI or RCA video out. I've seen HDMI cables that cost more than that.
Energy efficient: hardware costs are only one component of a server's expense, because you also need to consider the energy cost to keep the device running constantly. The services needed for home use aren't going to tax the CPU much, and most of the time it will just be idling, waiting for something to do. The RPi's ultra-low power components are a perfect fit for this workload, which helps keep your power bill down. My model B unit plus external hard drive consume only 8 watts total, while the old Athlon-based box it replaced drew 54 watts at idle. Assuming 10 cents per kilowatt hour, that puts the yearly power bill for an RPi at $7 vs. $47 for an Athlon-based machine. The RPi basically pays for itself in less than a year!
Low noise: because the RPi doesn't have fans or moving parts, the only component in your final configuration that generates noise or any appreciable heat will be the hard disk. If you're concerned about noise, enthusiast sites like Silent PC Review often include noise benchmarks in their storage reviews. My experience is that any modern drive is quiet enough to avoid detection anywhere there's something else already running (such as a media center, gaming console or other computer). If your home doesn't provide a lot of flexibility for wiring options, the RPi's small size, minimal thermal output and low-noise footprint may make it possible to sneak in a server where it was difficult to justify one in the past.
Figure 1. A Compact, but Highly Capable Home Server
New opportunities: a less tangible benefit is the simple joy of trying something new! For me, this was my first time really working on a Debian-based distribution, and it's probably the first time many Linux enthusiasts will have a chance to try an ARM-based architecture.
Arranging the Hardware
For a home server, you'll need a medium-size SD Flash card for local storage. It's possible to use a USB thumbdrive for booting, but that would use up one of the two precious USB slots. The Flash storage card doesn't need to be large, but the faster the better. I chose a name-brand SD card with an 8GB capacity and class 10 speed rating. For backups and multimedia files, a large hard drive with a USB dock is a must. I chose a 1.5TB hard drive and a Calvary EN-CAHDD-D 2-bay USB 2.0 hard drive dock. This dock has a feature to run two drives in RAID-0 mode, which could be useful someday. Finally, the RPi doesn't come with a power supply, but most smartphone chargers supply the required 5v-over-micro USB. To see if the RPi was fussy about the power source, I swapped through three different micro-USB cell-phone chargers for power supplies. I tried each one for about a week, with no issues on any of the units.
Installing the Operating System
Installing the RPi operating system is covered in extensive detail elsewhere, but here are a few home-server-specific tips, roughly in the order needed.
1) Get the Raspbian "Wheezy" install image directly from http://www.raspberrypi.org/downloads, and copy it onto the SD card, using the steps listed on the site.
2) When booting the RPi for the first time, attach a keyboard, mouse and monitor. Don't forget to turn on the monitor before booting the RPi, so that it can detect the correct HDMI or composite output port.
3) The RPi has a nice "raspi-config" screen that you'll see on first boot. For a home server, the following selections will be useful:
expand_rootfs: resizes the default 2GB OS image to fill the rest of the Flash card.
change_pass: the default password is "raspberry", but something more secure than that would be better.
Set your locale and timezone.
memory_split: assign the minimum amount possible (16) to the GPU to leave as much room as possible for services.
SSH: don't forget to enable the SSH server.
boot_behaviour: turn off boot to desktop (again, to save memory for your services).
When finished, you'll be at the
pi@raspberrypi prompt. The setup
script can be re-run at any time via
There are just a few more configuration items, and then the operating system is ready to go.
1) A static IP makes everything easier, so switch the network settings for eth0:
>> sudo nano -w /etc/network/interfaces
change the eth0 line
iface eth0 inet dhcp to the following
(modify to meet your home network setup):
======/etc/network/interfaces====== ... iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 ... ======/etc/network/interfaces======
2) Create a local user, and put it in the users and sudo group:
>> sudo adduser YOURUSERIDHERE >> sudo usermod -a -G users YOURUSERIDHERE >> sudo usermod -a -G sudo YOURUSERIDHERE
3) Update the system to ensure that it has the latest and greatest copies of all the libraries:
>> sudo apt-get update; sudo apt-get upgrade
4) At this point, you're ready to go headless! Shut down the PI:
>> sudo /sbin/shutdown -h now
Once it's down (monitor the green status LEDs on the RPi circuit board to know when it has finished shutting down), unplug the monitor, keyboard, mouse and power cord. Attach the USB storage, then restart the RPi by plugging the power back in.
5) Once the RPi starts up (again, those green LEDs are the clue to its
state), you can
ssh in to the RPi from any other machine on the network
and finish all the configuration remotely from here on out (modify the following for
your static IP):
>> ssh YOURUSERIDHERE@192.168.1.10
Congratulations, you have a working Raspberry Pi!
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- Android Candy: Google Keep
- Readers' Choice Awards 2014
- Handling the workloads of the Future
- How Can We Get Business to Care about Freedom, Openness and Interoperability?
- Days Between Dates?
- Synchronize Your Life with ownCloud
- diff -u: What's New in Kernel Development
- Computing without a Computer
- December 2014 Issue of Linux Journal: Readers' Choice