How to build the best Raspberry Pi media server
5th Jul 2013 | 12:00
Make your own set-top box
Who needs the likes of Sky Anytime or Virgin Media's on-demand services when you can build your own personally tailored digital media library?
Imagine being able to watch your movies and TV shows or listen to your entire music collection from any room in your home without having to dig out CDs, sit through DVD intros or browse a library of content, 90 per cent of which you have no interest in. In this tutorial, we'll show you what kit you need to make that dream a reality.
We'll open with a quick look at how you can build your own cheap set-top box for accessing your digital media using the versatile Raspberry Pi, and then we'll reveal what you need to look for in the computer - PC or Mac - that you intend to press into service as your media hub, storing, organising and delivering media to every other device on your network.
We'll also take an in-depth look at XBMC, our choice for both media server and client. We'll reveal the different ways you can get it onto your system, plus how you can customise it to cover all your media sharing and playback needs, plus use it in conjunction with another popular media server - Plex.
Build a set-top box
Even the smartest TVs aren't that smart - yet. If you're in the market for a set-top box offering easy access to internet media as well as the video, music and photos stored on your network, then you could opt for a plug-and-play system such as the Roku LT or WD TV Live for around £50/US$50 or £90/US$110/AU$150, respectively.
Both have their limitations - you're tied into whatever online services they're able to provide, for example - so why not build your own custom set-top box using the Raspberry Pi Model B? Buy it from the official RS Components store and you can also easily add the additional components you'll need, such as a PSU, case, SD card and cables, although you might want to source a compatible 8GB Class 10 SD card from elsewhere for maximum speed.
You'll also need your own keyboard and mouse to set it up - non-Bluetooth wireless models should work, but you may want to unplug the USB connector and plug it back in after rebooting the Raspberry Pi each time. Once set up, however, it should also work with various remote controls, including the official XBMC remote app for Android and iPhone.
The Raspberry Pi has enough grunt to act as a media server - such as with SqueezePlug - but for the purposes of this tutorial we're suggesting you use it as a cheap media centre only.
Build a media server
While you can use your day-to-day PC or Mac as your media server, it's probably easier to press into service a dedicated machine for the task. This could be an older computer otherwise destined for the scrapheap, or you might be in the market to purchase a brand new desktop or laptop for the job - if so, a living room-friendly box such as those offered by Zotac fits the bill perfectly.
Either way, you need to make sure your wannabe media server meets the following specifications, which will make it capable of streaming HD video to the rest of your network.
First, it needs either a beefy processor (2GHz dual-core processor or better) or graphics chipset that supports hardware accelerated video decoding. Chipsets meeting these requirements include Nvidia's GeForce 8 series or later, Intel's GMA X4500HD or later, and AMD's Radeon R700 (HD4000) or later.
So practically any modern PCI-E graphics card will fit the bill really, meaning that upgrading will cost you next to nothing. Sadly, older PCs with the depreciated AGP slot will have to rely on the processor being beefy enough to handle the strain.
In terms of memory, 4GB is ample, while you might want to investigate the fastest boot media you can find, so powering up your server takes seconds rather than minutes. That means a fast SD card, USB flash drive or SSD hard drive - assuming your media is stored on another drive, you only need a boot partition of around 8-32GB in size to cover your needs.
You'll obviously also need a hard drive to store your media on - internal or USB 3.0 is preferable, but even USB 2.0 is quick enough for streaming purposes.
Depending on where you site your media server - if it's doubling up as a media centre in the living room, then it might be hidden under the TV - you might also want to consider investing in a wireless keyboard/mouse combination. For those on a tight budget, Ebuyer's own Xenta Wireless Touchpad Keyboard is a good choice, and we've tested it successfully with XBMCbuntu.
One final consideration is your network. If you can plug your media server directly into your router, then that's all well and good, but if it's too far away then be prepared to invest in a HomePlug/Powerline network adaptor from the likes of Faculty-X if you find HD files stuttering over Wi-Fi. Pick a 500Mbps pass-through model with Gigabit ports for maximum performance.
Choose your media server
As you're going to use this machine as a dedicated media server, there's no need to install Windows - or indeed a vanilla Linux build - on it. Instead, we recommend you install a customised version of XBMC configured to work straight out of the box.
You've got two basic choices here. OpenElec is the more streamlined version, perfect for lower-end PCs and designed to run direct from an SD card or USB flash drive. Those wanting optional access to the underlying Ubuntu OS for more advanced tweaks should consider XBMCbuntu instead.
In both cases you'll need to download the correct version for your principal chipset: XBMCbuntu offers a choice of AMD or Intel/Nvidia, while OpenElec has builds for ION, Fusion, Intel and Atom among others. If you can't identify the correct one using the FAQ, choose one of the two generic builds.
XBMCbuntu downloads a basic ISO file that you burn to a CD or USB stick. OpenElec is installed from a USB drive, and a Windows installer (create_livestick.exe) is provided to make the process as simple as possible.
You then simply boot from your CD or USB stick and follow the instructions to either run as a Live CD or install to your chosen drive - internal hard drive, USB stick or SD card.
Take the time to familiarise yourself with how XBMC works - you'll find both the XBMC Wiki and OpenElec Wiki are invaluable here. Start by running through the System > Settings section to configure how XBMC is set up - if you're using it as a media server, for example, visit Services > UPnP to select Share video and music libraries through UPnP, and switch it on.
If you plan to hide away your media server from view, and don't want to have it hooked up to a keyboard or monitor, then select Services > Webserver to make it possible for you to control your media server from another computer on your network via its web browser. Don't like the default skin? Change it from the System > Settings > Appearance > Skin section. If you're hankering for a vertical theme, try PM3.HD.
When it comes to adding video and music to your libraries, take the time to make sure they're named correctly with the help of our guide. This ensures they'll appear correctly in XBMC, making it easier to find the TV episode or movie you're looking for.
One of XBMC's biggest plus points is its versatility, thanks to the dozens of plug-ins and add-ons that make it so much more versatile. The XBMC Wiki reveals how to install them, and you'll find all sorts of goodies hidden away.
Make sure you explore the Videos section if your server doubles up as a media centre - here you'll find add-ons for accessing all kinds of online content from around the world, including catch-up TV services.
If you've installed XBMCbuntu, then you also have access to the underlying Linux installation. To access XBMCbuntu, click the power button in XBMC, but choose Quit. Select XBMCbuntu from the drop-down menu and log in using the password you created during the XBMCbuntu installation process.
From here you'll find yourself in a modified version of Ubuntu. Click Start > System Tools > Synaptics Package Manager to add additional components. Use the Search tool to find what you're looking for - you only really need to access XBMCbuntu to add components not available to XBMC itself, such as exFAT-Fuse if your media is stored on an ExFAT-formatted disk.
Speaking of exFAT, you'll also need to install gedit in order to add the requisite command to the fstab file to make XBMCbuntu automatically mount your exFAT drive each time you start your media server - something like /dev/sdb1 /media/exfat exfat-fuse defaults,nobootwait,user should do the trick.
When you've finished tweaking in XBMCbuntu, make sure you click Start > Logout > Logout, then select XBMC and log back in. This ensures your PC boots straight into XBMC the next time you start it.
Plex Media Server
If you're wedded to Plex Media Server rather than XBMC, then installing it as your principal media server inside XBMCbuntu is simple - you then use XBMC as your media centre on this PC.
First, download and install the Ubuntu version of Plex Media Server, then set it up via Start > Sound and Video > Plex Media Manager. Finally, download both PleXBMC and PleXMBC Helper to your Downloads folder.
To complete the configuration of Plex with XBMC, go to System > Settings > Add-Ons > Install from zip file. Select Home > Downloads and install each add-on in turn. You're now able to browse your Plex media from within XBMC (select Videos > Add-ons > PleXBMC to do so).
Switch on and access the server
When it comes to turning XBMC into a media server, you'll find the setting you need - Share video and music libraries through UPnP - under Settings > Services > UPnP.
Once enabled, you can access any video and music added to your XBMC library from another UPnP-capable device on your network, including other computers, that Raspberry Pi set-top box you created earlier and most smart TVs.
You can also access your media via your tablet or phone - you'll find an official free XBMC app for Android, while iPhone, iPad and iPod touch users can try the likes of AirPlayer or Media Link Player Lite apps.
If you've got Plex Media Server running in the background, you can also purchase the Plex apps through the relevant app store. Note that these will only give you access to any content you've set up using Plex Media Server, though.