CherryMusic is a browser-based music streaming jukebox. With CherryMusic on Ubuntu you can create your own personal Spotify-like server for your local music collection. The music can be stored locally on the server or on a NAS. You will be able to play your entire music collection through a web browser. If you can access your Linux server through the internet you can enjoy your music from anywhere. Personally I use this free Dynamic DNS service to make CherryMusic access convenient. You can of course use your private VPN server too. CherryMusic support reverse proxies for additional ease. This will work on Ubuntu 14.x and Ubuntu 15.x and later.
Pi Unit | ||||||||
---|---|---|---|---|---|---|---|---|
Raspberry Pi 3 | Quad Core | |||||||
Raspberry Pi 2 | Quad Core | |||||||
Raspberry Pi | Single Core | |||||||
Banana Pi | Dual Core | |||||||
Banana Pi Pro | Dual Core |
CherryMusic essentially turns your Ubuntu server into your personal Spotify for your music collection giving you a cloud music server.
Install CherryMusic on Ubuntu
Update your repos and upgrade your packages
sudo apt-get update && sudo apt-get upgrade -y
Install CherryMusic dependencies
sudo apt-get install python python-pip git python-unidecode sqlite -y
Install CherryPy 3.6.0
sudo pip install CherryPy==3.6
Install imagemagick for displaying album thumbnails, lame mp3 encoder, flac encoder and vorbis tools (for ogg music). If you do not have any flac or ogg files you can remove the vorbis-tools and flac.
sudo apt-get install imagemagick lame vorbis-tools flac -y
Pull the latest CherryMusic for github and put it in the installation folder
sudo git clone --branch devel https://github.com/devsnd/cherrymusic.git /opt/cherrymusic
Change ownership of the CherryMusic folder to your user that has permissions to your music collection
sudo chown -R user:user /opt/cherrymusic
Run the CherryMusic initial setup, adjust the port you want to use.
You can open the CherryMusic web interface on its local IP http://ip.address:7600 on any machine in your home network
python /opt/cherrymusic/cherrymusic --setup --port 7600
Complete the initial CherryMusic setup by choosing the path to your music downloads and click Save and start CherryMusic
Now create the CherryMusic admin user. When you're done, hit Ctrl+C or Ctrl+Z back in your SSH session to terminate the CherryMusic process.
Then complete the rest of the guide to start CherryMusic automatically on boot.
Options can be adjusted in here if you want to change the music path or port.
nano ~/.config/cherrymusic/cherrymusic.conf
When you're done making changes hit Ctrl+X, Y and Enter to save
CherryMusic init.d Script
This will autostart CherryMusic on boot for Ubuntu server.
Create the CherryMusic init.d script
sudo nano /etc/init.d/cherrymusic
Paste this working CherryMusic init.d script, change the user to your user that has permissions to the music on your system.
#!/bin/sh
### BEGIN INIT INFO
# Provides: Cherrymusic
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Cherrymusic
# Description: Cherrymusic for music streaming
### END INIT INFO
# Documentation available at
# http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html
# Debian provides some extra functions though
. /lib/lsb/init-functions
DAEMON_NAME="cherrymusic"
DAEMON_USER=user
DAEMON_PATH="/usr/bin/python"
DAEMON_OPTS="/opt/cherrymusic/cherrymusic"
DAEMON_PWD="${PWD}"
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
DAEMON_PID="/var/run/${DAEMON_NAME}.pid"
DAEMON_NICE=0
DAEMON_LOG='/var/log/cherrymusic'
[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"
do_start() {
local result
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
if [ $? -eq 0 ]; then
log_warning_msg "${DAEMON_NAME} is already started"
result=0
else
log_daemon_msg "Starting ${DAEMON_DESC}" "${DAEMON_NAME}"
touch "${DAEMON_LOG}"
chown $DAEMON_USER "${DAEMON_LOG}"
chmod u+rw "${DAEMON_LOG}"
if [ -z "${DAEMON_USER}" ]; then
start-stop-daemon --start --quiet --oknodo --background \
--nicelevel $DAEMON_NICE \
--chdir "${DAEMON_PWD}" \
--pidfile "${DAEMON_PID}" --make-pidfile \
--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
result=$?
else
start-stop-daemon --start --quiet --oknodo --background \
--nicelevel $DAEMON_NICE \
--chdir "${DAEMON_PWD}" \
--pidfile "${DAEMON_PID}" --make-pidfile \
--chuid "${DAEMON_USER}" \
--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
result=$?
fi
log_end_msg $result
fi
return $result
}
do_stop() {
local result
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
if [ $? -ne 0 ]; then
log_warning_msg "${DAEMON_NAME} is not started"
result=0
else
log_daemon_msg "Stopping ${DAEMON_DESC}" "${DAEMON_NAME}"
killproc -p "${DAEMON_PID}" "${DAEMON_PATH}"
result=$?
log_end_msg $result
rm "${DAEMON_PID}"
fi
return $result
}
do_restart() {
local result
do_stop
result=$?
if [ $result = 0 ]; then
do_start
result=$?
fi
return $result
}
do_status() {
local result
status_of_proc -p "${DAEMON_PID}" "${DAEMON_PATH}" "${DAEMON_NAME}"
result=$?
return $result
}
do_usage() {
echo $"Usage: $0 {start | stop | restart | status}"
exit 1
}
case "$1" in
start) do_start; exit $? ;;
stop) do_stop; exit $? ;;
restart) do_restart; exit $? ;;
status) do_status; exit $? ;;
*) do_usage; exit 1 ;;
esac
Make the CherryMusic init.d script executable
sudo chmod +x /etc/init.d/cherrymusic
Tell the Ubuntu system to use the CherryMusic startup script
sudo update-rc.d cherrymusic defaults
If the CherryMusic init.d script fails you can use a cronjob.
Add a cronjob to make CherryMusic automatically start on boot.
crontab -l | { cat; echo "@reboot cd /opt/cherrymusic ; /usr/bin/python cherrymusic"; } | crontab -
Reboot to make sure CherryMusic is autostarting on boot
sudo reboot
If it fails you can always start CherryMusic manually
python /opt/cherrymusic/cherrymusic
You can now finishing setting up CherryMusic by going to the web interface after it reboots. It is fairly self-explanatory and easy to set up.
The CherryMusic default port and web inteface is http://ip.address:7600
If you want to be able to access CherryMusic outside your home network with a free Dynamic DNS address follow this guide and then port forward 7600 on your router or which ever custom port you set.