Setting up OSMC on a Raspberry Pi
Posted 11 February 2015, 21:50 | by Ben Duguid | Perma-link
I've had a Raspberry Pi (original model B) sitting around at home for about a year, and I've been wondering what to do with it for most of that time. I've finally decided that as we're decluttering the house* we need a better way to access all the music that currently sits on the media shares of an original Windows Home Server that we use for backups and media storage.
So I've got together the following hardware:
A Windows Home Server, with the Guest user enabled as follows:
- No password
- Read Access to the Music, Videos and Photos shares
- A Raspberry Pi Model B
- A tiny USB wifi dongle (or one very much like that)
- An 8GB SD card (they recommend a class 10, mine's currently a class 4)
- A USB mouse
- A TV with an HDMI port and its remote (for initial configuration)
- A stereo amplifier with an AUX port and some speakers (we're running the Pi headless)
The software needed was:
- The OSMC Installer (I went for the Windows one) - currently Alpha 4
- A SSH client - what confused me here was the reference to PuTTY in the docs - I thought I had that as part of GitExtensions but Plink (described as "a command-line interface to the PuTTY back ends") is not really - so I used Bash that was installed by Git and that worked a treat - but I'm sure the proper PuTTY client would be fine as well
The process I followed was then (I'm mostly documenting this so that if I have to do it again, I'll have one location to refer to):
- Install OSMC on the SD card, setting up the wireless connection during the installer - this is currently the only way to configure this
- Insert the SD in the Pi, insert the wifi dongle and mouse and connect it to the TV before powering on
- Revel in the wonder that is OSMC running on your telly box.
- Change the skin - there are few known issues with the default skin - I'm currently using Metropolis, but might switch to Conq as it seems even lighter (and I'm not really going to be seeing it).
- Choose a web server addin of your choice - I'm currently really liking Chorus, which works nicely on Chrome and is responsive enough to have a "remote" view on mobile devices.
- Set the Audio output to at least "audio jack" (or possibly both if you want to test it on the TV first)
- I wanted to change the webserver port to 80, but that's only been fixed post Alpha 4.
- I also turned on AirPlay "just in case" - although most of the devices don't have anything suitable to stream.
On my computer, fire up bash and connect to the Pi via SSH:
ssh [email protected]
- Enter the password when prompted and you should be in
Set up the mount points - you need to create local folders to hold the mounted network drives first, so I went for the following steps which creates them under the osmc users home directory:
sudo mkdir media/music
sudo mkdir media/photos
sudo mkdir media/videos
You can then try mounting your network drive - and I suggest you do so that you can iron out any issues - as a point of note, it appears that you can either use an absolute path or one relative to your current location:
sudo mount -t cifs -o guest //[servername]/music music
This basically says:
Mount a device using the CIFS module:
mount -t cifs
Pass the option "guest" to use the guest user:
The network path to mount:
The mount location:
media(in this case the folder below the current location)
- Mount a device using the CIFS module:
- If that works, you should be able to change into your music directory and see the folder structure that exists on your server.
You now need to get these to mount every time the Pi boots (hopefully not all that often ). OSMC comes with the nano editor pre-loaded, so open your File System Table file as follows:
sudo nano /etc/fstab
Then I added the following lines:
//[servername]/music /home/osmc/media/music cifs guest,x-systemd.automount,noauto 0 0
//[servername]/photos /home/osmc/media/photos cifs guest,x-systemd.automount,noauto 0 0
//[servername]/videos /home/osmc/media/videos cifs guest,x-systemd.automount,noauto 0 0
These are similar to the mount command above:
The network path to mount:
The full path to the mount location:
The mount type:
The comma separated mount options:
A bit more information about these options: as we need to wait until the network is up and running before we can mount the drives, luckily the people behind OSMC have thought of that:
Use "guest" credentials (standard option for cifs):
Use the OSMC custom auto-mount script:
Do not use the standard auto-mount:
- Use "guest" credentials (standard option for cifs):
Two further options about closing/hanging options I think:
- The network path to mount:
Saved the changes (Ctrl+o), exited nano (Ctrl+x) and exited the console (
- Back in OSMC, I then rebooted the Pi. If all's gone well, it should restart without any errors.
- I then went and added the new mounted folders to their respective libraries within OSMC, not forgetting to tell it to build the music library from the added folder.
Phew - quite a lot of steps, but I'm now sitting here listening to my music collection on the stereo with a "permanent" solution.
Now that I know it works, what would I change? I'd probably spend more than a fiver on the wifi dongle, and I might get a better SD card too - the playback can be a little stuttery... seeing as we're about to move into our loft room, grabbing a new Raspberry Pi 2 and popping it up there looks like a no-brainer
Filed under: OSMC, Raspberry Pi