How to build a Linux Media Server – Headless – Alan Ashton’s Blog

How to build a Linux Media Server – Headless – Alan Ashton’s Blog

Install Ubuntu Linux 12.04 (Or any version) on Headless Unit

This post is a bit of a departure for me as I am not talking about CRM for once. However I guess I feel that I have something to share so…


Have had lots of issues with my old Headless WHS server which is an Acer Aspire Easystore H340. Despite all the troubles I think that the box itself is a thing of beauty and I really did not want to replace the hardware as with this box I have a 4 disk Nas Server with appropriate memory and CPU power. My only real issue is the operating system which tend to reboot three times every day. I actually stopped windows update which cuts a little of the rebooting but still wanted to throw the thing out of the window.

So I started to look at replacing the OS. This is tough as the box is;

• a headless unit
• has no place for a cheap graphics card (more later)
• Needs fiddly jumpers setting to use a keyboard

So I thought and my options were limited to;

Buy a video card for my headless unit
My unit only takes a 1x video card which are expensive. I would rather build a new machine than spend $100 on a video card that I use once. Also they are difficult to come by. Would also have to get my hands on a monitor. Not really a suitable solution.

Buy Video Motherboard debug cable
You can actually buy a cable for this unit. This is made by a company online. They will ship the cable out for $65 dollars but postage is $30. Fair enough but would still have to get a monitor, see point one for the reasons that I did not go down this route

Install Unattended Ubuntu
Never could get the thing to run through without the installer asking a question and so this never worked despite a huge time investment and being so close I could smell it. This was my last resort and I fell at the final fence.

So by chance after many months of hard research and not getting anywhere I chanced upon the article by Max Beatty

This guy used an external drive and Hyper v. I totally stole this idea but used VirtualBox which kept me away from the scary prospect of inadvertently rebuilding my laptop which would be an easy mistake to make with the final step.

1 * 2TB Western Digital Green Hard Disk $130
1 * Sata Disk Enclosure with esata $35

I already had esata compatibilty on my laptop and the Acer Aspire (not really required for the Nas but handy for moving files from the old installation to the new afterwards.

The reason for the new drive was really to give me a backup in case this all did not work. That way I could keep my WHS running (and crashing) until the new server was built.

Also if this idea of mine did not work then I had at the very least a new External Hard Drive.

If the solution did not work all I had to do was restore the WHS hard disk to the Acer H340 and WHS would be back (Yikes)

Setup VirtualBox

1. Attach Removable External Storage Disk to whatever pc/laptop that you have a screen for.

• Hard Disk with Hard Disk Caddy containing the drive will become the primary Ubuntu Drive

2. Link disk to virtualBox vmdk file

• Install VirtualBox
• Create Virtial Box Machine for Ubuntu Server
• Create vmdk which is a virtial box disk that links to your new external hard drive. There are many online tutorials for this.

cd %programfiles%\oracle\virtualbox

VBoxManage internalcommands createrawvmdk -filename “C:\users\\.VirtualBox\UbuntuLiveHd.vmdk” – rawdisk \\.\PhysicalDrive1

Check Physical drive location

One thing that I did not see in any of the tutorials and led to an error after creation of the vmdk when accessing was that VirtualBoc should be Run as Administrator.

3. Add Ubuntu (of your choosing) iso to set to boot on the VirtualBox

Install Ubuntu (Debian) server

In fact this could be any Linux OS really. I ended up using WattOS
This is a very fast and lightweight linux distro based on Ubuntu. Therefore its much the same as Ubuntu to install but uses less resource intensive software.

• Start the Ubuntu VirtualBox machine
• Install Ubuntu to your requirements
• Ensure that you install XRDP and add the Ubuntu 2d desktop fix
cd /home/youruser
echo “gnome-session –session=ubuntu-2d” > .xsession
sudo /etc/init.d/xrdp restart

Apparently this will not work with Ubuntu 12.10 but you could try another desktop for this. Try googling the issue.

The above step is not required for WattOs

• At this point you are really ok to continue but I chose to do the complete setup on my laptop just in case I broke something and then could not login over remote Desktop or SSH.

• Further Installed and configured Samba Shares

• Installed and configured Torrent Clients

Remove ethernet card link

This is key. DO NOT FORGET THIS PART. Although if you do you will be back to the virtual machine one more time.
Ubuntu store the Physical Ethernet card address in the Ubuntu file system. If this card is found in the file Ubuntu will look for this card and try to use it.

This is going to be an issue as the next step in the process is to remove the drive from the external hard drive enclosure and then insert into a bootable position back in the Nas server. The Nas server will almost definitely have a different network card and therefore will never show up on the network.

So we need to remove the link to this NIC
The file is located at

So use gedit
Sudo gedit /etc/udev/rules.d/70-persistent-net.rules
Am no linux guru yet but am pretty sure this is how its done

And remove the following info. Remove all of this. Its all one line but will look like its spread over three or four lines.
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:00:00:00:00:00″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

Now I tried to do some more config after this and my system slowed to a halt eventually so ENSURE that the edit is the last thing that you do before shutting down your new Ubuntu server.

New Server Start

• Take the disk out of the drive enclosure
• Place inside your soon to be brand new Ubuntu server
• Start her up
• Check your network to see what IP address your box booted up into if you used DHCP on install or use the specified IP Address if you gave it one with Remote Desktop.
Yes I use Windows Remote Desktop
You will need to enter your user name and password that you setup on the install and there you are logged into your new Ubuntu Server

• If you ever get an issue where you cannot get onto the Headless server due to some unforeseen collapse of the operating system then all you need to really do is take the hard drive and insert into your VirtualBox environment and fix the issue.

Software Installs for Media Server

uTorrent Server – BitTorrent
I installed utorrent Server which is now available for linux. I find this one of the best utorrent clients that runs pretty lightly and works like a charm.

Deluge – BitTorrent
I use deluge as one of my torrent site is private and they do not like the use of uTorrent. They seem happy enough with Deluge though and so I need both

I installed and use Samba to share out my folders to the windows and Mac world in my home network and to my media player – WDTVLive. This all works perfectly.
I also share out a folder to auto upload torrents. This I then add to the favorite folders on both my windows and Mac machines. From there I can browse torrents and save them to the Auto Downloads folder which then gets picked up on the server by uTorrent or Deluge (I have two different folders)

Media Server Software
I don’t use this at all and so I have no recommendations. I found that a lot of what is available is very bloated and does far too much for my requirements. As it happens the WDTVLive box can see a network share and so I just use network shares. I would love to hear of any good media servers that aggregate though.

I always loves PS3 Media server which is available for Linux but it really only gives me a folder view. That said I am going to keep an eye on this to see if they add an aggregated view at some point.
So my struggling old WHS server that lost network connectivity twice a day and more often that not dropped whilst watching recorded content on the TV now runs like a dream.

It rarely uses more than 5% of the processor unless I am remoted into the box which uses a lot of resource and has never lost connectivity of its own volition. It uses little of the available RAM and I only have 2GB.

WHS cannot compete for me.

I never used any of the client backup functionality of WHS though which is not in Linux but then why would anyone use Client backup in a home solution these days. It does not make sense as the server is really in no better position that the Client in terms of safety. I just use online sync backup which means that if I lose the PC (and I have) then I just install the sync software on a new build and my files are back in a few hours.