These steps should help you to set up a media server on a Linux computer in your house so you can stream music, video, photos to other gadgets around the home such as another computer, a PS3, an Android phone, an iPhone etc., etc.
Why?: The question I got asked by my family was why is this a good thing? Clever lot really my family. My answer was this: None of the machines in the house that could operate as a media server is ever on 24×7. The main home computer, the PS3, my wife’s Sony Ericsson Xperia phone (!) etc all either get turned off at some point or other or leave the house occasionally. The Linux server stays put and quitely hums away in the garage just doing it’s job. With the consumption of media in the house going up and from a number of different devices, it is making more and more sense to have it available in one place. We don’t have a massive library of music, but even our relatively modest selection doesn’t fit on a basic smart phone or iPod such as our children have. Do we want to copy songs, photos etc on and off phones as our mood changes? No.
Should you contemplate this if you don’t have a Linux server in your house? Only if you’re happy to roll your sleeves up and learn some Linux admin skills.
NOTE: This guide will not be much help if you haven’t got a Linux server set up and don’t know how to do that. There are plenty of good guides around for that. This set of instructions assumes you have a Linux server already running. I have Ubuntu 10.04 (Lucid). I am not a Linux expert in any way shape or form but I managed this. The install wizard for Ubuntu is damn good and it suggests sensible defaults all the way through.
Step 1:Create a user on your Linux server that will be dedicated to managing your media.
Why?: Because we will create a shared folder a bit later on where all your media will live and we will share this to everyone. It’s safest not to share your own folders like this.
a) Create the new user (I’ve named the new user ‘mediasvr’ but you can use your own:
- su useradd -p /home/mediasvr -m mediasvr
b) Set the new user’s password
- su passwd mediasvr
Step 2: Create a folder structure that will be used to store the music, photos, videos you want to share.
Why: It’s good housekeeping to create a logical set of places to save all your valuable media. it will be easier to manage later on.
From your own Linux login, type:
- sudo su mediasvr
- cd ~
to make sure you’re in the home folder. Now create three folders:
- mkdir music
- mkdir video
- mkdir photos
these are optional. You could bung everything in the /home/mediasvr but you’re not that kind of girl! 😉
Step 3: Share the Linux folder with Windows machines.
Why?: Because you need to be able to drag and drop music and video from your family computer and/or laptops etc onto the Linux box so they become part of your media library.
How?: You need to install and configure Samba on Linux. Samba is a service that runs on your Linux server that allows you to make a folder on Linux visible to the rest of your network.
a) Refer to instructions relevant to your Linux O/S as to how to install Samba, but for Ubuntu, it was as easy as running the following command
- sudo apt-get install samba smbfs
b) Configuring. If you’ve never setup Samba before and start digging around on the internet, you will quickly be baffled by the range of options Samba provides. DO NOT LET IT WORRY YOU! Samba is like a 72-piece Swiss-army knife. You only need a few simple lines of config if you are using this in a secured network in your home. I’ll share mine with you which you should be able to paste in pretty much line-for-line.
The configuration of Samba is held in a file called smb.conf which should live in /etc/samba but it may depend on your Linux version so you may need to search for it using the command “whereis smb.conf”. Go to the folder and edit this file using this command:
- sudo nano smb.conf
…and add the following lines in somewhere under the comment line that says #==== Share Definititions ====
- comment = Family Media Server
- path = /home/mediasvr
- create mask = 0755
- force user = mediasvr
- force group = mediasvr
- guest ok = yes
- read only = no
- browseable = yes
- writeable = yes
What’s all this?: What you are telling Samba to do is create the illusion of a folder called “media” in the root of your Linux server that actually points to the home folder of your mediasvr user who we created in Step 1. above. The instructions underneath specify that guests can access this folder and that when they do, they should be treated as though they are the user mediasvr, that they can write to the folder and that external connections will be able to browse the folder structure.
Test it!: On another PC in your house, type this into your directory navigator or folder explorer:
…and you should see a folder in there called “media” that you can click on to see the contents. If it doesn’t work, try the IP address of the Linux server instead as there might be a DNS problem on you home network.
…that’s just an example of course. I have no idea what IP address your Linux server is configured for.
If that works, copy some MP3 and JPG files on so that we can use these for testing. Don’t get carried away just yet, in case you ahve to tear everything down and start again.
Step 4: Install Mediatomb on the Linux server.
Why?: Simply exposing a set of folders to other computers to your house does not make it a media server. True you can now access any files you place there from all kinds of gadgets in your house and where this might work for photos, it wouldn’t be great for music or videos. These files are bigger and many applications would want to load the whole file over to where they are running before playing them. You don’t really want to wait for a 4Gbyte movie to copy over before you can play it. What a media server does is streams a file across a bit at a time as it’s needed.
How?: Mediatomb is part of recent Linux Ubuntu builds but if you’re not sure, you can do this
- sudo apt-get update
- sudo apt-get install mediatomb
You may need to start Mediatomb.
- sudo invoke-rc.d mediatomb start
But check here first: Mediatomb FAQs
Step 5: Tell Mediatomb what you want to share.
Why?: Right now, Mediatomb is just sitting there twiddling its thumbs. It has no idea what you want to stream to other computers. So now you have to show it where you put your media.
Mediatomb provides a web-based interface to do this which is relatively intuitive and if you got this far, you probably don’t need my help to figure this out. From one of your home computers, type in a browser URL bar:
or, if you prefer, use the IP address, for example:
You should get a screen that looks a lot like this. You can see here I’ve navigated to the filesystem where my media is and the next step is to click the scan button shown circled in red top left.
a) Fire up your PS3 and it should find the media server straight away. I found that if I changed anything on the Linux side, I had to stop and restart the PS3 for the changes to take effect.
b) Try this too. Fire up your Media Player on Windows. You should see this appear: