Building a Media Server using an Intel NUC
This page describes how I have build my media server using a barebone PC (Intel NUC).
This barebone is connected to a USB DAC (for high quality audio) and to the TV (for videos and pictures).
It replaces my Windows PC that was running Logitch Media Server and the Squeezebox receiver.
You can control the Logitch Media Server by an app on your smartphone or tablet.
Videos and pictures are played using the XBMC program (also controllable from an app).
Nowadays it is cheaper to use a Raspberry PI and attach an SSD drive (see my other page).
Hardware barebone PC
I bought a barebone PC (e.g. cheap one): Intel NUC Kit DN2820FYKH with Celeron processor.
This barebone is not completely silent because it has a fan. You can reduce the fan speed in the BIOS and/or have place it in a cabinet.
Also I bought:
- memory (e.g. Crucial 8 GB SODIMM DDR3-1600)
- 2.5 inch harddisk (e.g. WD Red WD10JFCX 1 TB)
For installation you also need to attach a (wired) network, mouse, keyboard and monitor.
Update BIOS
Click here for the download center.
Download the '.bio' file and put it on a USB stick.
Next boot the barebone PC, press F2 for Setup and next F7 to install the update.
In the BIOS you can also adapt the fan speed to a lower value.
Install Linux
You can use at least: Mint Cinnamon, Mint MATE or Ubuntu. In the examples below, Mint Cinnamon is used.
Download the 64 bit 'iso' file and create a bootable USB disk using Universal-USB-Installer.
Insert the USB disk and press F10 for boot options.
After Linux has started, click on the icon "Install Linux".
Let the computer logon automatically.
Once the installation has completed, take the following steps.
Update software:
Menu -> Administration -> Update Manager -> install pending updates
Alternatively, you can run the following command from a terminal:
sudo apt-get upgrade
Configure Screensaver:
Menu -> System Settings -> Screen Locker -> uncheck both ckeckboxes
Configure Remote Desktop Sharing:
Menu -> All Applications -> Desktop Sharing ->
check: Allow other users...
check: Allow other users to control your desktop
uncheck: You must confirm each access to this machine
The Vino VNC server uses encryption. Because the free VNC clients do not provide encryption, you must disable encryption on the server from the command line:
gsettings set org.gnome.Vino require-encryption false
On your PC, install a VNC client (TighVNC or RealVNC worked for me).
Note: you only have to install the client, not the server.
From now on, you can control the barebone remotely using the VNC client!
Configure for Suspend:
The build in Power Management tool does not work well (limited to 1 or 2 hours).
Therefore install Xfce4-power-manager:
Menu -> Software Manager
Configure to start Xfce4-power-manager at startup:
Menu -> System Settings -> Preferences -> Startup Applications
Configure Xfce4-power-manager for suspend time (e.g. 4 hours).
Personally, I let not suspend my barebone.
To prevent a login prompt after waking up the barebone, enter command:
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'
Configure Wake On Lan (see here):
Menu -> Software Manager -> install ethtool
Enter command: sudo nano /usr/bin/wakewol
Add text:
#!/bin/bash
ethtool -s eth0 wol g
Enter command: sudo chmod 755 /usr/bin/wakewol
Enter command: sudo nano /etc/network/interfaces
Append line:
post-down /usr/bin/wakewol
Problem with sound
After one of the installation steps (may be the upgrade?), the audio was not working any more.
In the Sound Preferences, a dummy device was listed in the output tab.
It could be repaired by adding the following line to /etc/modprobe.d/alsa-base.conf:
options snd-hda-intel index=-2
Install Logitech Media Server
Start the terminal program and enter:
wget http://downloads.slimdevices.com/LogitechMediaServer_v7.8.0/logitechmediaserver_7.8.0_all.deb
sudo dpkg --install logitechmediaserver_7.8.0_all.deb
The server will be automatically started at boot time.
Determine the IP address of your barebone: Menu -> System settings -> (scroll down to) Networking -> Wired
Now configure by starting an internet browser on any computer with e.g. URL: http://<IP address>:9000/
You can skip entering a Squeezebox account.
Next you are asked to select the location of your music, e.g.: home/paul/music
Next you are asked for the playlist folder (first create a folder "PlayLists" somewhere).
You can always change these settings afterwards.
When Logitech Media Server is installed on a Windows OS, the PC will not go to standby while playing music.
On Linux, this does not happen. There is one plugin available that should do the job. Unfortunately, it did not work for me.
This is what I tried:
Install the "Server Power Control" plugin that prevents sleep mode while playing music:
Start a browser and navigate to: http://<IP address>:9000/
Click on the Settings button (right bottom corner) and go to the Plugins tab.
At the bottom, enter the following URL in Additional Repositories:
http://srvrpowerctrl.googlecode.com/svn/beta.xml and press the Apply button (bottom right).
Now you can enable this plugin and restart Logitech Media Server with command:
sudo /etc/init.d/logitechmediaserver restart
Enter the following command (see here and here):
sudo /var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/ReallyPreventStandby/bin/unix/debian-install.sh
But unfortunately it does not prevents standby!
Prevent port conflict with XBMC:
Go to the Plugins tab and adjust the settings for plugin CommandLineInterface.
Change the port number to: 9091 (otherwise a conflict exists with XBMC)
How to stop the media server
sudo /etc/initd/logitechmediaserver stop
Using a CD player
You can attach a USB DVD player/burner to play audio CD's.
You must also enable the CDPlayer plugin:
From any browser: use the IP address of the raspberry followed by ":9000". E.g.: 192.168.2.18:9000
- In the lower right corner you will see the Settting icon.
- Open the Plugins tab.
- Check "CDPlayer"
Before you can use the CDPlayer plugin, you must run the following command to install the cdda2wav tool:
sudo apt-get install icedax
Add media files
Before you can copy media files to the barebone, you have to share the media folders.
The "Shared Folders" tool in the Control Panel did not work for me.
So I installed package: system-config-samba.
Now lauch application "Samba" from the menu.
Add a share for Music and make it writable, visible and accesible for the group and for everyone.
Change the permission of folder Music: edit properties of this folder and give Others full access:
Folder access: Create and delete files
Now you can copy your media files from your PC to the barebone like this:
In Windows Explorer, type the IP address in the navigation bar. e.g. \\192.168.2.42
Alternatively, you can add a network location in Windows Explorer: right click on "this computer" and add a network location.
There are shares for music, videos, pictures.
For Mac OS check this site.
start Finder application.
Press: Command+K
Connect to: SMB://192.168.42/Music
In order map this drive automatically at boot time:
Start System Preferences application. Next: Users & Groups.
Click on ‘Accounts’
Click on “Login Items”
Click on the + button to add another login item
Locate the network drive you previously mounted and click “Add”
After copying your music files, you should be able to play them from a browser (http://192.168.2.42:9000/) when you have a (physical) Squeezebox player installed.
Backup media files
I keep the media files on my daily working Windows PC.
The hardware address (MAC address) can be found here: Menu -> System Settings -> (scroll down to) Networking.
Download tool: mc-wol.exe
The media files on the barebone are updated with the following batch file script from my Windows PC:
REM first wake up the barebone
mc-wol.exe 00:08:74:AF:85:3E
REM wait some time in order to let barebone get awake
ping 1.1.1.1 /N 5 /W 1000 > NUL
REM copy all new and changed files to the barebone
set disk=\\192.168.2.42
robocopy.exe "d:\music" /COPY:DT "%disk%\Music" /E
robocopy.exe "d:\videos" /COPY:DT "%disk%\Videos" /E
robocopy.exe "%USERPROFILE%\Pictures" /COPY:DT "%disk%\Pictures" /E
Note: the barebone can go to sleep during this operation.
The first time copying files can take hours, so temporarily prevent the barebone to suspend.
Running the script a second time will be very fast because only new files are copied.
On Mac OS, you could make a script with 'rsync'.
Install SqueezeLite
SqueezeLite is the preferred audio player.
Add the package: Menu -> Software Manager -> Search for: squeezelite
Configure this application to startup at boot time with a delay of 4 seconds.
If you don't use Mint Cinnamon, you cannot configure the delay in Startup Applications.
But this is what you can do:
Create file: /home/<username>/StartSqueezeLite with contents:
#!/bin/bash
sleep 4
/usr/bin/squeezelite -n MusicPlayer - s localhost
Set the file permission of this file to Execute. Next:
Menu -> System Settings -> Startup Applications -> Add
Name: squeezelite
Command: /home/<username>/StartSqueezeLite
The default audio output is the headphone jack.
Now you can start a browser with http://<IP Address:9000/ and play music!
Of course, using a high end USB DAC gives a much better result.
In that case, you have to change the output parameter.
Start the terminal application and enter: /usr/bin/squeezelite -l
Now all output devices are listed. Find your DAC.
Change the previous command line now for example to:
Command: /usr/bin/squeezelite -n MusicPlayer -s localhost -o sysdefault:CARD=DAC
Also:
Menu -> System Settings -> Sound Preferences : switch to the USB DAC
How to rip FLAC
Foobar is an excellent free ripper and can be downloaded from here.
Also you need to download the Encoder Pack (required for FLAC conversion) from here.
Configuration changes to consider:
- File -> Open Audio CD -> Drive Settings:
Ripping security: Standard
Check: Limit drive speed while reading
- File -> Open Audio CD -> Rip -> Proceed to the Converter Setup dialog:
Ouput format: FLAC
Destination: %tracknumber%. %title%
Save the preset
Using a CD player
You can attach a USB DVD player/burner to play audio CD's.
You must also enable the CDPlayer plugin.
Before you can use the CDPlayer plugin, you must run the following command to install the cdda2wav tool:
sudo apt-get install icedax
Install XBMC
XBMC is a media server and player for music, video and pictures.
Add the package: Menu -> Software Manager -> Search for: xbmc
Configure this application to startup at boot time:
Menu -> System Settings -> Startup Applications -> Add
Name: XBMC
Command: /usr/bin/xbmc
XBMC configurations:
- Configure the location of your media files.
- Configure Display mode (otherwise the system will never suspend):
Settings -> System -> Video Output -> Display Mode = Windowed
- Configure the audio output for HDMI: Services -> Audio:
On 2 places on this page you have to select HDMI.
- Configure enable remote control from your tablet or smartphone:
Settings -> Services -> Remote Control
Settings -> Services -> Webserver -> set port to 8088 (possible conflict with port 8080)
Install an XMBC controller on your smartphone or tablet.
You may need to install a newer version with command:
sudo -apt-get upgrade
Install Spotify plugin
Enable the Triode third party Spotify plugin.
Restart Logitech Media Server with command:
sudo /etc/init.d/logitechmediaserver restart
(I had to restart the server many times before it came available, may be I should have waited longer)
Configure the plugin with your Spotify Premium account.
You may have to check: Always stream via helper
Note: also a plugin exists for Tidal.
Install Inguz Room Correction plugin
Logitech media server allows you to install a room correction plugin.
Installation, configuration and measurements for room correction is a bit more complex.
See here for global instructions how to install and configure.
There are some minor changes, so take the following steps:
Install package: Menu -> Software Manager -> Search for: mono-complete
Install plugin:
Download plugin and extract to /usr/share/squeezeboxserver/Plugins
sudo chown squeezeboxserver /usr/share/squeezeboxserver/Plugins/InguzEQ
sudo mkdir /usr/share/InguzEQ
sudo chown squeezeboxserver /usr/share/InguzEQ
sudo /etc/init.d/logitechmediaserver restart
Check that the plugin exists in Logitech media server
sudo /etc/init.d/logitechmediaserver restart
Install Filter processor:
Download Filter processor and extract to /usr/sbin (you must be root).
Next enter the following commands in a terminal:
cd /usr/sbin
sudo wget http://inguzaudio.com/DSP/debian/InguzDSP
sudo chmod +x DSPUtil.dll
sudo chmod +x InguzDSP
sudo chmod +x InguzDSP.exe
sudo mkdir /usr/share/squeezeboxserver/.wapi
Now it is time to create room correction files with an electret microphone.
Have a look the Align tool.
Room correction files must be saved to: /usr/share/InguzEQ/Impulses
Therefore create this folder and make a writable share for this.
Note: when sharing this folder for everyone, also change the folder permission to: drwxrwxrwx
Configure PicorePlayer on Raspberry PI
If the media server is located too far from your audio system, you can use a Raspberry PI as a replacement for a Squeezebox Receiver.
This is how:
Download the PicorePlayer image file for your Raspberry PI (I or II).
Download Win32DiskImager and use this tool to copy the image to an SD card.
Connect Raspberry PI to your network using a cable.
Find the IP address of the Raspberry PI (you can consult your router or use an IP scanner on your phone).
Start a browser on your PC and type the address (e.g. 192.168.2.22).
Now you can configure the wireless USB adapter (if you use this) and the audio output.
For my Arcam irDAC, you need to specify "USB" and the output parameter: iec958:CARD=A20,DEV=0
Also, set the USB switch on the Arcam to type II.
As simple as that!