- Install Ruby and MPD.
On Raspberry Pi OS:
$ sudo apt install ruby-full mpd
- Start and enable MPD:
$ sudo systemctl enable --now mpd
In the case you need to configure MPD, check its documentation.
- Install PiFi:
$ sudo gem install pifi --no-document
- You'll need a list of radios at
/etc/pifi/streams.json
. Paste this for now:
$ sudo mkdir -p /etc/pifi
$ sudo wget https://raw.githubusercontent.com/rc2dev/pifi-radio/master/docs/streams.json.sample -O /etc/pifi/streams.json
Later, you can edit that list as described here.
- If the MPD server is on another host or a non-default port, you'll need a configuration file.
Download a sample and edit following the documentation:
$ sudo wget https://raw.githubusercontent.com/rc2dev/pifi-radio/master/docs/config.json.sample -O /etc/pifi/config.json
$ sudo -e /etc/pifi/config.json
Done! You can now run PiFi with pifi
and reach it at http://DEVICE_IP:3000
.
It makes sense to run PiFi as a different user, such as www-data
. You may also want it to autostart on boot. For that you can use a systemd service.
- Download the service sample.
$ sudo wget https://raw.githubusercontent.com/rc2dev/pifi-radio/master/docs/pifi.service.sample -O /etc/systemd/system/pifi.service
- Make any changes relevant to your system.
For example, if you leave User
and Group
as they are (www-data
), make sure that both exist in your system.
$ sudo -e /etc/systemd/system/pifi.service
Done! Now you can start PiFi with sudo systemctl start pifi
. For running at boot, enter sudo systemctl enable pifi
.
If this doesn't work, journalctl -u pifi
should tell you what to fix.
If you need something different from this, check this document.