Installing Mopidy with Spotify and Iris

What is MPD and Mopidy?

The Music Player Daemon is a open-source and free music player server without a interface. In order to use in you need a client, we will be using Iris a web UI plugin for Mopidy. With the right setup this allows us to control the music over the network. To be a bit more exact we will be using Mopidy, a Python based server, which is compatible with Spotify as well as local and streaming sources(SoundCloud, Google Play Music and more). It's very extensible using Python PIP to install plugins.

What do we need

UPDATE: This works on a Raspberry PI as well.

The most important thing is a PC running Ubuntu with internet and access to the terminal or SSH. Some basic knowledge on using basic terminal functions is advised. We will also need a Spotify Premium account for this to work.

Setting up the repo and installing

  1. Add the repo's GPG key:
    wget -q -O - | sudo apt-key add -
  2. Add the repo to your sources
    sudo wget -q -O /etc/apt/sources.list.d/mopidy.list
  3. Install Mopidy, Mopidy-Spotify and Mopidy-MPD
    sudo apt update && sudo apt install mopidy mopidy-spotify mopidy-mpd
  4. Install Python's PIP3 to get Mopidy-Iris
    sudo apt install python3-pip
  5. Now we can use this tool to get the web UI extension
    sudo python3 -m pip install Mopidy-Iris

If you had no error's or problems during all installs we are now ready to start configuring Mopidy.

Configuring everything

Depending if you want to run Mopidy as a service or on a useraccount the config file location will change. If you run it as a service the configs location would be:


And if you run it on your user account it will be:


I will not be running Mopidy as a service and just start it from a terminal window when I want to use it. So that's what my guide focuses on. If you want to run it as a service check out the Mopidy documentation here. First we need a bit of information from Spotify, a client id and secret. We can obtain these using a special page made by the guys over at Mopidy. This will provide you with the first thing we need to add to our config, the client_id and client_secret, we just need to add a few more value's to our spotify section in the config, afterwards it should look something like this.

username = your_username
password = your_password
client_id = your_client_id
client_secret = your_client_secret

Some other interesting settings we can change in this section are:

  • bitrate - Audio bitrate in kbps. 96, 160, or 320. Defaults to 160. Higher is better.
  • volume_normalization - Whether volume normalization is active or not. Defaults to true.
  • toplist_countries - Comma separated list of two letter ISO country codes to get toplists for. Defaults to blank, which is interpreted as all countries that Spotify is available in.

Even tough it not needed I suggest setting the locale and country for Iris to your country as it defaults to AU. I live in the Netherlands and prefer software to be in english so I set mine as:

country = nl
locale = en_US

If you would now run Mopidy everything should already be working just fine. To test it you can load the web interface in a browser located at: http://localhost:6680/, if Iris is properly installed you should be able to open it from there.

Extra settings

Here are a few settings to might be interesting to you:

hostname = ::
default_app = iris

The hostname setting makes the WebUI accessible from other devices in your network, by default only the localhost can access it. And the default_app make sure to load you straight into Iris when accessing the WebUI.