Raspberry Pi - Installing Volumio in PiBang

This step-by-step tutorial will get you up and running with the brilliant Volumio music system, on a fresh install of PiBang server edition.

Volumio is an entirely new music system. It is designed to play all your music, whether it is a Hi-Res file or a Web Radio, with the highest quality. Control it with your favourite device; a smartphone, pc or tablet, and enjoy your music as you never did before.

in essence, Volumio is a client for the Linux music server mpd. It provides a web-based frontend which is accessible from most devices via a web browser with no extra software or plugins. Volumio is currently in BETA stage and is available as a pre-built image. Unfortunately, there isn’t much information about the underlying OS. So, I took the liberty of getting Volumio to run on an ‘unofficial’ but no less effective system and this tutorial is the result of much hard work and a lot of trial and error!

In this tutorial, we’re going to use the Web-UI portion of Volumio and install that on a very lightweight distribution called PiBang which itself is based on Debian GNU/Linux (like Raspbian) and inspired by Crunchbang GNU/Linux.

UPDATE: 18/02/14 - FauDrei suggested a couple of additions in the comments regarding NAS shares. I have now added these to the tutorialUPDATE: 12/02/14 – Added a couple of procedures regarding important file permissions and miscellaneous packages.

For the initial boot, we’re going to have to do it locally via your Pi. Upon bootup, you’ll see the familiar ‘wall of text’ Debian startup which finishes in displaying the raspi-setup window.

From the menu, we’re interested in only a few things.

Read the ‘info’ menu item first.

select ‘expand_rootfs’ to enable PiBang to fill up your SD card.

IMPORTANT: set_root_pass

for the root password, I’ve gone with ‘volumio‘ as this is the default root password for the volumio distro. Enter your new password twice.

Finally, select the bottom menu item ‘ssh‘ and ‘enable‘ the ssh server. Select ‘Finish’ in the bottom right and reboot your Pi.

From this point on, we’ll be using SSH exclusively. After the Pi reboots, load up PuTTY (if you’re on Windows) and connect to your Pi’s IP Address with user: root and password: volumio (the password we created in the previous step)

Firstly, we can make a couple of modifications to PiBang’s setup. PiBang uses the zsh shell as default (as opposed to Debian’s bash) while zsh is impressive in its own right, it isn’t necessary for our purposes and might in fact cause problems later on.

We’ll err on the side of caution in this instance and change the shell to bash with the following command.

chsh -s /bin/bash

If you want to check that the change was successful simply log out and in again with

su - root

and run

echo $SHELL

The output should read “/bin/bash”. Great.

PiBang also comes pre-installed with molly-guard. this package stops you from rebooting/shutting down the wrong remote server by asking you to specify the hostname you wish to reboot/shut-down. Again, this is great for certain circumstances but not in this case. Let’s remove it with

apt-get -y remove molly-guard

At this point, we’re going to want to add a new user called ‘pi’ as staying logged in as root is generally a bad idea.

adduser pi

and enter this user’s new password twice.

raspberry

Simply accept the blank values with Enter.
Now we need to add our new ‘pi’ user to the sudoers group with

sudo adduser pi sudo

We can now change to our new pi user and begin the Volumio install. Enter

su - pi

and you’re logged in as pi. Let’s begin.

When you’re starting with any new distro, it’s always good to update the system and upgrade (if necessary). We’ll do this with

sudo apt-get update ; sudo apt-get -y upgrade

This will automatically update PiBang to the latest version. The -y command switch automatically answers yes to any questions, so it’ll update without any user input.

Next we need git. git is included by default on PiBang server, but it won’t hurt to request it again here.

sudo apt-get -y install git-core

Next we need mpd and the alsa-utils. These are arguably the most important components of the system.

sudo apt-get -y install alsa-utils mpd

and the second most important components are that of the webserver, so go ahead and install them.

This will install the nginx webserver, our database software sqlite and php5 with the necessary addons. Samba enables us to share our drives over the network and is installed with

sudo apt-get -y install samba samba-common-bin

now we can create a couple of directories that are used by nginx and samba

sudo mkdir /var/www sudo mkdir /mnt/disk1 sudo mkdir -p /mnt/NAS

We need to set up our filesystem table with the correct device ID of your external music drive. In my case I have two USB drives connected to the Raspberry Pi and the second one contains my music. A great tutorial for figuring out your drive ID can be found here (steps 3 to 5). My device ID is /dev/sda2 and is an NTFS formatted drive. We’ll add this information to the /etc/fstab file. Open up an editor (I use nano)

sudo nano /etc/fstab

and at the end of the file, I’ll add this line

/dev/sda2 /mnt/disk1 ntfs-3g defaults 0 0

this tells PiBang to mount the sda2 device in the /mnt/disk1 folder we created earlier.
Next up is the ntfs driver and the auto mount utility.

sudo apt-get -y install ntfs-3g minidlna autofs

autofs enables automatic mounting of our external drive upon reboot. but we need to set it up by editing another config file.

sudo nano /etc/auto.master

add the following line to the end of the file

/media/ /etc/auto.ext-usb --timeout=10,defaults,user,exec,uid=1000

At this point, we have a fully fledged headless music server running mpd and you could go and install any of the various mpd clients to control it. However, you came here for Volumio so that’s what we’re going to set up. We’re going to clone the git source of Volumio directly into our webservers root directory and overwrite our system configuration files with those contained in the git source and here’s how…

Every time the Raspberry Pi boots up, it runs the commands in rc.local. Volumio comes with a custom rc.local, so we need to make sure it’s executable before copying it to the system. The same applies to the scripts contained in command, db and inc.

When the file permissions are set, we can copy the system files with

sudo cp -var /var/www/_OS_SETTINGS/etc /

and that will copy the necessary config files into our system root.
The final step is to create a symbolic link between our music files on our external drive and the music folder that mpd is looking at. Again, in my case, I have a folder called Music on my external drive so I use this command.

cd /var/lib/mpd/music ; sudo ln -s /mnt/disk1/Music

You can add a symbolic link for your NAS shares with

sudo ln -s /mnt/NAS /var/lib/mpd/music/NAS

You’re all done! the last thing to do is to restart the Pi with

sudo reboot

Give it 30 seconds or so to reboot, then open a web browser and go to your Pi’s IP address or enter ‘pibang/’ in your address bar. If all went well, you should see this…

Hit the Menu and go to library then click update MPD Database.

This will start the DB update and your music folders should start showing up under ‘Browse’ like this…

Enjoy your music and have fun!

Please feel free to comment on this post with any problems you may be having with setting this up. Another good source of information is the Volumio forums.
It’s worth mentioning here that some features are disabled/not working correctly but as this particular tutorial is more of a proof-of-concept than anything, I’m hoping that the community can iron our and bugs and extend some features in the not too distant future.