How to turn a spare Linux machine into a media server
4th Oct 2009 | 09:00
Your home hub awaits
Linux is brilliant at serving files. It's this ability that keeps the enterprise world turning to Linux for its heavy lifting jobs and that keeps the world Googling 24/7.
But it's just as good at serving files from a computer tucked away under the stairs or stuck in the loft, and a server in your house is now becoming an essential accessory.
Mobile phones, games consoles and even televisions are rapidly developing the ability to read, display and play files held on a media centre PC, and Linux is the perfect free software solution. All you need is a relatively low-powered PC, a decent amount of storage and somewhere safe to hide it.
1. Install the software
We've chosen to use Ubuntu Server Edition for two reasons. First, it's the same distribution that most people know and love, only optimised for use on a server. Second, you still have access to exactly the same packages and repositories as you do with with the desktop version, which makes installing and using software easy.
Put the disc into the machine you want to use as the server and select your language followed by 'Install Ubuntu Server'. Unlike the desktop version, there's no graphical installer. Instead you'll need to choose your configuration settings from the pages of options that appear throughout the installer.
Don't let this put you off; there aren't any questions that can't easily be answered, and the installation is effectively no different from a standard desktop installation.
The first question asks you again for the language, the second for your location and the third for your keyboard layout. After a brief pause, you'll be asked for a hostname. You might want to change this to something like 'mediaserver', rather than the default 'ubuntu' to avoid confusion with any other Ubuntu installations you may have running on the same network.
2. Partition the disk
The next installation step is disk configuration. This is a much more important consideration for a media server than it is for a standard desktop installation, because of the sheer volume of files that you'll be storing on it.
The most convenient solution is to use an old disk of around 10GB (or less) for the Linux installation and a high capacity drive for your media content. You can then select 'Guided – Use Entire Disk' on the installation page, then select the disk to install to and give Ubuntu complete control over how it creates the installation. Your media storage disk can be configured later.
PARTITION YOUR DRIVE:If you create a separate root partition, you'll be able to update your system without worrying about your files
The second-best option is to create two partitions on a single drive, using the smaller partition for the root file system and the other partition for your data. This way, you can update the root partition if you need to, or easily back up your data partition without infecting it with system files.
After skipping through the partition section you'll be asked for your real name, username and password. You should give this a little more thought than with the desktop, as it's likely that your server will be on all the time and accessible from the internet, so a secure username/password combination is vital.
Press Continue to skip the HTTP proxy installation, and choose to install security updates automatically when asked. Finally, don't select any of the default server packages unless you want to enable SSH for remote administration, then click on Continue to install the system.
3. Configure MediaTomb
We're now only a couple of steps away from completion. When your machine restarts after installing all the main packages, you need to log in and type sudo apt-get install mediatomb into a terminal. This will grab the media-streaming software and install it on your system.
All you need to now is type mediatomb to run the server. Watch the output, because you should see something like the following:
2009-07-16 15:20:52 INFO: MediaTomb Web UI can be reached by following this link: 2009-07-16 15:20:52 INFO: http://192.168.1.89:49152/
This is the port and the IP address for the server, and you should now be able to point a web browser on the same network at this address and use the simple user interface to add the files and folders that contain your various bits of media.
After a few moments, the media should appear on any UPnP streaming client, such as those on a Playstation 3 and XBox 360.
First published in Linux Format Issue 123
Liked this? Then check out 50 handy Ubuntu time-saving tips
Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register