XBMC: Perfect Home Media Server.

Intro & Hardware

Since I’ve recently made the move from Mac OSX to Linux, I’ve been toying with the idea of swapping my standard (and expensive) cable TV for something slightly more suitable…

I’ve used XBMC (xbox media center, which nowadays has nothing to do with xbox) for a while on other systems and with some config, I reckon it could make a good TV.

I had some old hardware laying around, a HP xw4400, Dual Core Duo Intel CPU, 4GiB RAM, new DVD drive and new 1TiB HDD and the standard 300ish GiB HDD, I slapped a cheap £30 graphics card in there so it can handle HD well and a gigabit NIC, wired of course.

I ran an Ethernet from my AirPort Extreme router to the TV with the HP computer (connected by HDMI) and started on the software…

Software and Server

After toying with #! (crunchbang 10 – also see my Skype hack) and realising, although it is an amazing OS, it’s certainly not up to scratch for an everyday-telly.

I found that XBMC had it’s own Ubuntu based OS called XBMCbuntu 12, and as it is based on Ubuntu it’s very stable and versatile.

After installing, it turns out, it’s based on the LXDE Ubuntu (the new-ish lightweight desktop edition) with some custom settings and skins. (there is very little online documentation for the XBMCbuntu OS)

The only viable documentation I could find is located on the XBMC Wiki [http://wiki.xbmc.org/index.php?title=XBMCbuntu] and even that is lacking somewhat.

The Install

As XBMCbuntu is basally standard Ubuntu, the install was as routine as it always is with Ubuntu derivatives.

Note: the live OS login details are Username: xbmc Password: (none).

Make sure you click on “Login Automatically” when setting up the user, changing this later can get tricky… To change this after the install try Googling around or just reinstall the OS 😛

After the install it can boot into 3 different sessions:

  1. XBMC – this is plain old XBMC with no desktop environment, as this session has the same name as the XBMC program, I’ll refer to the program as XBMC App.
  2. XBMCbuntu – this is the LX Desktop Environment (which you can load XBMC App on) and because this session has the same name as the OS, I’ll refer to the OS as XBMCbuntu OS from now on.
  3. Openbox – a very limited (yet awesome) window manager, not Desktop Environment. LXDE uses Openbox.

By default, if memory serves me correctly, XBMCbuntu OS when first installed tries to boot directly into the plain XBMC session, which is not quite what I’m after as even though XBMC App is very good at what it does, it cannot replace the Desktop Environment for running other programs (such as Firefox) or managing files quite yet.

XBMCbuntu OS will always use the last used session when automatically logging in so we only need to change the session once to have our TV boot into a Desktop Environment every time – then we can manually start XBMC App by clicking the desktop icon or setting it to autostart, we can always get back to the DE underneath by closing XBMC App by clicking the ‘power’ icon in the bottom-left of the default XBMC App skin and choosing “Exit”.

To change the session, simply logout.

  • From the LXDE session (aka XBMCbuntu), just go to Menu > Logout
  • From XBMC session, go to the ‘Power’ button on the bottom-left of the default XBMC App skin and choose ‘Exit’.

Once logged out, go to the dropdown box and choose which session you would like to use, in my case, XBMCbuntu (LXDE).

Config

Note: I had a problem with the text being massive or really small, I can’t quite remember – but to fix it, all you need to do is manually change the xorg.conf DPI settings – there is loads on Google about this…

Setting up extra internal HDD

Next I needed to setup the new internal 1TB HDD which will store all the movies and TV Shows for XBMC App. (mine was already formatted to ext4, you can always install gparted via synaptic if yours needs formatting, I recommend using ext3 or ext4).

To easily setup a HDD, use MountManager which can be installed via synaptic and have it mount the HDD to “/mnt/1TB” or something similar, later you can then get XBMC App to look in there for the movies and TV shows.

Installing Other Software

First things first, to make package/software installing easy and not all via the terminal, install Synaptic Package Manager, by entering this in a Terminal (Menu > System Tools > XTerm):

sudo apt-get install synaptic

Now we wont need to constantly use the terminal to install software, which is nice when your using a primarily GUI orientated environment for a TV.

File Management and Useful Programs

By default XBMCbuntu OS comes with PCManFM a lightweight file manager, I much prefer Thunar and Thunar’s Bulk Renaming facility can come in handy for renaming lots of TV Shows.

I also installed Firefox over the default Chromium, Xarchiver for unpacking rar/zip/tar files, leafpad or geany for editing config files and Transmission bit-torrent client for downloading all my Linux based OS’s, see my Transmission post for info about optimising.

Netflix

Check out my installing Netflix on Ubuntu or XBMCbuntu post. (soon to come)

HID – Remote Control

One of the major issues with replacing your TV with a media server like this is the lack of a remote control. Now, I do have a wireless keyboard and mouse but they can be quite inconvenient when watching TV from the sofa.

I would much prefer to use my iPhone/iPad/other computer to control the TV.

While using XBMC App, you can use one of the many iOS apps such as Constellation (my fav – just turn the phone sideways to see the remote) which can operate XBMC out-of-the-box, without any additional software.

However, if you want to operate the Desktop Environment without using the keyboard and mouse, the best way is to use VNC, IMHO.

  • When at another computer you can use a VNC client as usual.
  • When on the sofa, you can use HippoRemote, for iOS – which basically turns your iPhone into a laptop-trackpad-style mouse. (I highly recommend)

Auto-Starting Programs

You might want to automatically start some programs with your LXDE (XBMCbuntu session), such as:

  • Transmission (minimised to try – see my custom shortcut)
  • VNC Server
  • or even XBMC App its self.

Luckily with LXDE, this is easy. You only need to add a desktop shortcut to a particular folder.

To make your own desktop shortcuts (e.g. for a custom VNC server bash sript) you need to make a text file called “whatever.desktop” containing these lines:

[Desktop Entry]
Version=1.0
Type=Application
Name=Name of Shortcut
Icon=/path/to/icon
Exec=program name or path/to/program

You can download some of my example .desktop shortcuts and bash scripts (including Youtube TV, Minecraft and VNC Server) here: XBMCbuntu_Shortcuts_and_Scripts_v1.tar.gz.

Or you can just right click on a menu item and click “Add to Desktop” and copy the shortcut from the desktop.

When you’ve got the shortcuts for the programs you’d like to autostart, simply copy them into the folder:

/home/USER/.config/autostart/

Where “USER” is replaced with your username also remember that folders starting with a dot are hidden.

If the autostart folder doesn’t exist, just create it.

Custom Programs

Above I mentioned a few custom shortcuts that I use to load YouTube TV (a little known service from youtube which can be accessed from [https://youtube.com/tv/]) and my VNC server bash script.

VNC Server – after you install x11vnc (a rather good VNC server), you can have it autostart by using a shortcut in the “~/.config/autostart/” folder pointing to this bash script:

#!/bin/bash
/usr/bin/x11vnc -display :0 -forever -bg

If your using the shortcuts I made and offered up for download above, just copy this code into and text editor like leafpad and save to “/home/USER/Programs/vnc-server-0.sh” and don’t forget to edit the username in my downloadable shortcuts! (to allow the .sh file to run, you need to make it executable by right-clicking it and going to Properties > Permissions and ticking “Allow this file to run as a program”)  or use the code in the download above.

File Transfer and SSH

SSH comes installed by default in XBMCbuntu OS, so you might want to secure that by following my posts about SSH Basics and Safer SSH.

XBMC: Perfect Home Media Server.

One thought on “XBMC: Perfect Home Media Server.

Leave a Reply

Your email address will not be published. Required fields are marked *