Make It Useful Again: Turn That Old PC Into a DIY Home Media Server

Stephen Kennedy - Lead Web Developer

One of the more ridiculous aspects of technology is just how quickly a piece of tech can become outdated. There's an old joke among hardware enthusiasts that by the time you can afford the best hardware available, it's already been usurped by something better and more expensive.

Tandy 3 Computer from 1980.

Speaking of which, you think my new rig will run Crysis?

But as networked electronics begin to work their way into all aspects of our lives, this doesn't have to be the case. While your old Windows 7 machine might not be the best desktop computer anymore, that doesn't mean it deserves to be placed in the closet to pine in the darkness for better days. Today, let's talk about taking an older computer with outdated specs and re-purposing it to be a home media server, designed to make viewing your personal video library as easy and convenient as logging into Netflix, and all this project will cost you is time, and depends on your familiarity with Linux frustration.

A computer with a wooden case and a missing top panel, showing the components inside.

This is a media server in a modded case. A way to take this project to the next level.

With home media servers, one of the more important things to consider is how you are going to be consuming the media. Not all devices are created equal when it comes to playing media of varying formats, and it will be your media server's job to provide media that the device can actually understand. There are two ways to go about this.

The first, and probably best all-around method, is something called "real-time transcoding," which only means that the device delivering (serving) the content (our media server) will translate the content from one format to another in real-time while sending the translated data over the network. This is the most compatible method, but the major downside for a project like this is that real-time transcoding involves a ridiculous number of calculations to be done very very quickly. This means we need a relatively powerful processor to accomplish it—we're talking i5 to i7 performance with above 3GHz clock speeds—and if you have a processor with that kind of speed that doesn't have heat-throttling or other performance issues, then you're probably not going to be looking at a project like this, since you might be better served upgrading the hardware around the processor to continue the life of that device.

The second, and the method we'll be using for this tutorial, is something that is a lot closer to a static file server, rather than the transcoding server discussed above. This means that you'll have to consider which devices will be accessing the media and format the media to best fit those devices. In most cases, .mp3 for audio and .mp4 for video are some of the most widely compatible formats, so we'll want to convert any media we put onto the server into those formats if possible (this is also considering transcoding, but it won't be done in real-time, so we can take as long as we need to perform those calculations). We'll then be serving those files over a specific protocol that most streaming media devices use as a standard.

A diagram displaying one central server serving the same information to several clients simultaniously

The power of your server and the bandwidth of your network will determine the number of simultanious clients your server can support, but the goal of this project is to allow multiple people in your network to enjoy content simultaniously.

Alright, before we get into the nitty-gritty of this tutorial, you are going to need some familiarity with some skills the average computer user may not have encountered before. For this reason, I will be including some resources to get you started. Before you start, you should make an honest assessment of your skills. On the one hand, you weren't going to use this computer anymore, so all you're really losing here is time, but on the other hand, it is very possible for you to make a mistake that may be quite hard to recover from—maybe impossible. If you are not comfortable with this risk, contact someone who has a little more technical knowledge to help you out, and as always, we here at Armor love these kinds of projects. If you bring it into us, we will happily configure all of this for you at a very competitive price.

Alright, first of all, we're going to ditch Windows completely. Windows is a relatively resource heavy operating system, and it isn't very good at doing what we want out of the box (but if you really want to use Windows to do this, there are many tutorials, but historically, Windows 10 support for this feature has been underwhelming at best). Instead, we're going to be installing a variant of the Linux operating system called Ubuntu. We picked Ubuntu simply because it's what we use on Linux machines in the shop, and it is what our customers will have likely encountered before. If you have a favored distro of Linux that you are more familiar with, you should be able to get a similar setup working with a few tweaks.

The Ubuntu Logo

While Ubuntu provides a relatively familiar environment, there are some very large differences to Windows. I strongly suggest looking through this guide if you haven't had experience with it before.

Here comes the first hurdle: to install the correct version of Ubuntu, we need to know what kind of processor we are dealing with. Most processors these days are 64-bit, and if we have one of those, we want to be able to use that extra power, but the 64-bit version of Ubuntu won't work on a 32-bit processor, so you'll need to check. This is relatively easy to do in Windows, we just need to look at our system summary.

On Windows 8/10, right click on the Windows icon on your taskbar and select the option labeled "System." This will open the About panel of your system settings. In the "Device specifications" section there is a line labeled "System type"; it should say "[64/32]-bit operating system, x[64/86]-based processor." In most cases, both numbers will be the same, but the important one is the second number. x64 is a 64-bit processor, x86 is a 32-bit processor.

On Windows 7, left click the Windows icon on your taskbar and choose "Run." In the popup, type "msinfo32" and press enter. This should open a window labeled "System Information"; we are looking for a line labeled "System Type" with a value of x[64/86]-based PC. x64 is a 64-bit processor, x86 is 32-bit.

Now that we know what processor we're dealing with, we'll download the copy of Ubuntu that we need. If you have a 64-bit processor, we can download Ubuntu directly from their site. You're looking for the version with the highest number that is labeled "LTS" with your processor's bits listed; this is their long-term-support release and is set up to auto-update with security and maintenance updates until the date listed on the download. At that point, you'll need to manually upgrade to the new LTS release, but these are usually supported over a period of five years at a time. I recommend using the Torrent links, as they are simple and offer a quicker download by leveraging P2P transfer rates, but if you are unfamiliar with what a Torrent is, then you can use the alternative mirrors below. Follow the steps listed to download the correct image.

Next, we need to take that ISO and turn it into a bootable USB drive. You'll need a USB drive with enough space to hold the image, and a piece of software to format the drive as bootable. It is possible to do this without downloading any additional software, but it involves using command line utilities. To avoid that, we recommend a piece of software called Rufus. You can learn how to use it here. You'll be using the ISO image of Ubuntu that we downloaded in the previous step.

Now, you'll need to install the operating system on our soon-to-be media server. You may have to fiddle with the BIOS to configure the computer to boot from USB. Unfortunately, while most BIOS are relatively similar, they aren't always, so I have to point you at manufacturer documentation to demonstrate how to do this. For most BIOS configurations, you can do this by changing the boot order and enabling the boot from USB feature. Many motherboards have this turned off by default for security reasons. If you run Windows 8 or 10, you might have run into a road-block that kept you from even getting to the BIOS menu. Recent versions of Windows have added some additional security to help prevent someone from replacing your operating system without your knowledge, but it adds a few extra steps in our process. This again may vary based on your machine, so here is Microsoft's official documentation on the process.

Once that is done, simply reboot the computer with the USB drive inserted, and it should boot to the Ubuntu setup program. They have generated a friendly guide for this; I'll direct you to step 5, since we've already covered the first 4. When you get to step 5, we'll be choosing the first option, "Erase disk and install Ubuntu," be sure you've backed up your files before this point. Choose whatever options you think best or are recommended by the tutorial for the rest of the install process.

Once the installation is done, be sure to remove the USB drive to prevent booting into the installer again. You should also log into your BIOS again, return your boot order to normal, and disable USB booting if you so desire.

The Registered Logo for the DLNA

DNLA is a universal standard. Many manufacturers are looking to migrate to a newer more versitile standard, but most devices still support it.

Once you have booted into Ubuntu, we'll be installing our DNLA server. There are many flavors of DNLA servers, including the popular (and paid) Kodi, but we'll be utilizing a very lightweight solution, perfect for older hardware, called MiniDLNA.

If you are unfamiliar with Linux, installing applications is relatively easy, for the most part, but it does involve heavy use of the Linux terminal. So go ahead and open your terminal (on a fresh install of Ubuntu, you may need to open the application search, top left icon. Once there, you'll need to temporarily upgrade your permission level to that of a root user, "sudo" the command: "apt-get install minidlna", or altogether "sudo apt-get install minidlna". This will prompt you for your password, but once confirmed, it will download and install the application.

Once the server is installed, we will need to configure it. We'll be using the terminal text editor Nano, since we won't be doing very much: "sudo nano /etc/minidlna.conf". Find the line, "media_dir=/var/lib/minidlna", and below that start another line beginning with, "media_dir=". At this point, you can decide if this directory will be restricted to a specific media type (this is good for organizing and browsing your collection on other devices) or will just be a catch-all. If you would like to restrict the media for a folder, simply prepend the directory statement with one of the following flags: "A" for audio, "P" for photos, or "V" for video. The flags can be combined to allow multiple media types ("media_dir=AV,/var/lib/minidlna/videos"), but the default behavior is to allow all three. The comma is only needed if the flags are present, but simply type out the location of where you will be placing your media files. Below that, add the line "inotify=yes" and then press CTRL + O to save the file output, follow the instructions the editor gives to confirm the filename and the save action. When this is done, press CTRL + X to exit Nano.

Now, transfer your files into the directories you set for MiniDLNA and then re-open the terminal. We will need to fully restart miniDNLA before it will see the changes we made to the configuration file, so we will run the following two commands: "sudo minidland -R" to restart the server and "sudo service minidlna force-reload" to have it scan the directories to identify the media files you just transferred. Depending on the version of MiniDLNA, the previous commands may no longer function, that is okay since we configured the server to auto scan. If this is the case, simply restarting the whole computer will serve the same purpose. On Ubuntu, this is relatively easy: just click the power icon and choose the Restart option.

To check that everything is working we'll need two things: the first is the IP address of the server we just set up, and the second is another device with a web browser. To get the IP, simply click the network icon (a WiFi icon if on wireless, two plugs connected for LAN) and select Connection Information from the drop-down menu. Your media server's local IP address will be listed here. Labeled, "IP Address", enter that address with ":8200" at the end, and you should see a screen titled, MiniDLNA status; this will list the number of files the server was able to detect and let you know if the software is running. If everything worked, you're ready to access that media from other devices; otherwise, go back through and double check your configuration file and network connection. I know that I originally had some issues configuring mine for the directory I wanted to use, but that ended up boiling down to a small syntax error that became apparent after a few minutes.

As we discussed before we started, MiniDLNA does not do any transcoding. If you would like to access media on a certain device, you must make sure that media is converted to a format which that device can play. Usually .mp4 for video, .mp3 for audio, and .jpg for images, as the most widely supported formats, and your media should probably be converted accordingly, but check your device specifications to be certain. VLC Media Player on PC and Android is capable of playing DLNA media streams and can read most media formats if you want to get up and running quickly with your new streaming lifestyle.

Are you interested in learning more about the networking technologies that allow in-home media streaming to work? Would you like more tutorials for projects like this one? Let us know below.




Thursday April 5th, 2018#tutorial #recycle #streaming