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 tutorial
UPDATE: 12/02/14 – Added a couple of procedures regarding important file permissions and miscellaneous packages.

What you’ll need

  • Raspberry Pi (I’m using a 512MB version)
  • 2GB SD card
  • A TV or Monitor for the initial boot
  • Internet Access from your Pi (I’m using Ethernet)

Head over to http://pibanglinux.org/ and download the server edition. Write the image to an SD card, pop it into your Raspberry Pi and carry on…

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.

  1. Read the ‘info’ menu item first.
  2. select ‘expand_rootfs’ to enable PiBang to fill up your SD card.
  3. IMPORTANT: set_root_pass

raspi01

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)

initialssh

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.

sudo apt-get -y install nginx sqlite3 php5-fpm php5-curl php5-sqlite php5-cli

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…

sudo git clone https://github.com/volumio/Volumio-WebUI.git /var/www

that will pull down the source into /var/www

It’s extremely important that we set some file permissions here. certain scripts need to be executable for Volumio to function correctly. Simply enter the following commands

chmod 775 /var/www/_OS_SETTINGS/etc/rc.local
chmod 755 /var/www/_OS_SETTINGS/etc/php5/mods-available/apc.ini
chmod -R 777 /var/www/command/
chmod -R 777 /var/www/db/
chmod -R 777 /var/www/inc/

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…

vol

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

vol

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

vol

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.

Comments

  1. FauDrei says

    One step further:

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

    With this you get Volumio’s NAS library option working (after issuing those commands you can define access to network based music libraries via Volumio web GUI).

    Perhaps it is very similar procedure for enabling “/mnt/USB/” (Volumio’s automounting of USB disk based libraries), but I have not tested it.

    Anyhow – great writeup! …any chance of pointing us further on how to disable PiBang’s constant logging into “/var/log/” (and any other unnecessary SD card wearing OS features/apps).

    • Neil says

      Brilliant. Thanks! I’ll update the post with those changes. I couldn’t get the Volumio USB automount working, so I used another method. Sounds like you may have the solution there though. I’ve been thinking about the logging too. Obviously it’s great for devs, but it might be better to log to the Ramdisk to save the sd card. I’ll look into it. Cheers!

  2. maerstroji says

    This is an excellent article and a great tutorial.
    With the steps in the tutorial I have compiled my SD card.
    However when it comes to he stage of file permissions, the output states ‘not permitted’.
    I am unable to fathom on what needs to be done to overcome this obstacle.

    • Neil says

      Jim, you need to make sure that you delete the /var/www directory before you clone into it.
      the rm -rf command is up there :)

  3. Joseph says

    Excellent guide.
    Now Volumio is playing away happily.
    One issue though…Can’t reboot or ShutDown via WebUI….it says “Shutdown player initiated” but nothing happens.
    Could it be a file-permission issue or sth?
    Any tip???
    Thanks a lot for the wonderful guide.

  4. Han says

    Thank you very much for this article.
    With it, I installed volumio in raspbian and have enjoyed music.
    However i’d like to use internet radio.
    What should i do??

  5. Marius says

    Thank you for the great tutorial.

    It took me a while to understand that volumio does not work with apache2, but now that I do, I installed and started nginx and works like a charm.

  6. Ed says

    Thank you for a well written walkthrough!

    @Joseph
    Installing “mpc” solved the shutdown option via WebUI in my case

    run the following command to install:
    apt-get install mpc

Leave a Reply

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