Music Server
My requirements for a Music Server were the following:
- it must be able to play live streams from internet radio stations
- it has to be able to output to AirPlay as I use two old Apple TVs as connectors to my speakers
- it should run on a Raspberry Pi; running on Pi 4 would be nice, as I have several of them, but requiring a Pi 5 would not cause serious issues
After some research in the Web, I found OwnTone.
Installation of OwnTone
The starting page for the installation of OwnTone in general can be found here. It provides links to detailed instructions for the different targets.
As I want to install it on a Raspberry Pi, I used the description provided here.
-
General Preparations
I installed the latest Raspberry Pi OS, using the Imager; at the time of writing (2024-08-04) this is the 64-bit Bookworm version, with Desktop and SSH enabled.
Next I installed some basic software (described here) and Java (described here) and then I configured the software.
I switched off WiFi and assigned a fixed IP address to the music server.
-
Create the Folders for the Music
I decided to store the files in the users
homefolder; there already exists a folderMusic. So I created the necessary folders there:cd ~/Music mkdir Audiobooks Compilations Podcasts - Add the repository key for the OwnTone repository:
wget -q -O - http://www.gyfgafguf.dk/raspbian/owntone.gpg | sudo gpg --dearmor --output /usr/share/keyrings/owntone-archive-keyring.gpg - Add the repository for Bookworm :
sudo wget -q -O /etc/apt/sources.list.d/owntone.list http://www.gyfgafguf.dk/raspbian/owntone-bookworm.listAccording to the documentation, there are also versions for *Bullseye’ and ‘Buster’ available.
- Install the software
sudo apt update sudo apt install owntone -y - For the next steps, it is useful when OwnTone is currently not running, therefore we make sure that it does not run:
sudo service owntone stop - Move the data files to the target location in the
homefolder.mkdir -p ~/.local/share/owntone/cache ~/.local/share/owntone/log sudo mv /var/cache/owntone/* ~/.local/share/owntone/cache/ sudo chmod <user>:<group> ~/.local/share/owntone/cache/* sudo rmdir /var/cache/owntone sudo rm /var/log/owntone - Edit the configuration file
/etc/owntone.confto suit the individual needs. The line numbers may vary.… 10 general { 11 # Username 12 # Make sure the user has read access to the library directories you set 13 # below, and full access to the databases, log and local audio 14 uid = "<user>" 15 16 # Database location 17 db_path = "/home/<user>/.local/share/owntone/cache/songs3.db" 18 19 # Database backup location 20 # Uncomment and specify a full path to enable abilty to use REST endpoint 21 # to initiate backup of songs3.db 22 db_backup_path = "/home/<user>/.local/share/owntone/cache/songs3.bak" 23 24 # Log file and level 25 # Available levels: fatal, log, warning, info, debug, spam 26 logfile = "/home/<user>/.local/share/owntone/log/owntone.log" 27 loglevel = log 28 … 54 55 # Location of cache database 56 cache_path = "/home/<user>/.local/share/owntone/cache/cache.db" 57 … 70 } 71 72 # Library configuration 73 library { 74 # Name of the library as displayed by the clients (%h: hostname). If you 75 # change the name after pairing with Remote you may have to re-pair. 76 name = "Music on %h" 77 78 # TCP port to listen on. Default port is 3689 (daap) 79 port = 3689 … 84 # Directories to index 85 directories = { "/home/<user>/Music" } … 235 236 # Allows creating, deleting and modifying m3u playlists in the library directories. 237 # Only supported by the player web interface and some mpd clients 238 # Defaults to being disabled. 239 allow_modifying_stored_playlists = true … 246 # By default OwnTone will - like iTunes - clear the playqueue if 247 # playback stops. Setting clear_queue_on_stop_disable to true will keep 248 # the playlist like MPD does. Note that some dacp clients do not show 249 # the playqueue if playback is stopped. 250 clear_queue_on_stop_disable = true 251 } 252 …I do not have a speaker system directly connected to the music server, therefore the local audio output is disabled.
… 252 253 # Local audio output 254 #audio { 255 # Name - used in the speaker list in Remote 256 # nickname = "Computer" 257 … 294 #} 295 … - Start/restart the OwnTone service:
sudo service owntone start - Wait for the library scan to complete. The progress can be followed with one of the commands below:
tail -f /home/<user>/.local/share/owntone/log/owntone.log sudo service owntone status journalctl -xeu owntone.service systemctl status owntone.service - Connect to the music server with a browser through the URL
http://<server>:3689/and finish the configuration there.
Finally I had to move the music files to the ~/Music folder to make it available.
For internet radio stations, I have created a Radio.m3u in ~/Music that contains the links to the respective streams.