Difference between revisions of "Subsonic"

From ArchWiki
Jump to: navigation, search
m (update templates, see Help:Style)
(27 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Audio/Video (English)]]
+
[[Category:Audio/Video]]
[[Category:Daemons and system services (English)]]
+
 
+
 
'''Subsonic''' is a music server that lets you store your music on one machine and play it from other machines, cell phones, via a web interface, or various other applications. It can be installed using the {{AUR|subsonic}} package on [[AUR]].
 
'''Subsonic''' is a music server that lets you store your music on one machine and play it from other machines, cell phones, via a web interface, or various other applications. It can be installed using the {{AUR|subsonic}} package on [[AUR]].
  
Line 9: Line 7:
 
Stop subsonic daemon is running
 
Stop subsonic daemon is running
  
  # sudo /etc/rc.d/subsonic stop
+
  # rc.d stop subsonic
  
 
Add a system user "subsonic" without home folder and add it to "audio" group if you want to use the "jukebox" feature
 
Add a system user "subsonic" without home folder and add it to "audio" group if you want to use the "jukebox" feature
  
  # sudo useradd --system --groups audio subsonic
+
  # useradd --system --groups audio subsonic
  
 
Change folder owners as follow. Path may changes; these are the default ones:
 
Change folder owners as follow. Path may changes; these are the default ones:
  
  # sudo chown -R subsonic:subsonic /tmp/subsonic
+
  # chown -R subsonic:subsonic /tmp/subsonic
  # sudo chown -R subsonic:subsonic /var/subsonic
+
  # chown -R subsonic:subsonic /var/subsonic
  # sudo chown -R root:root /var/subsonic/transcode
+
  # chown -R root:root /var/subsonic/transcode
  # sudo chown -R root:root /var/subsonic/jetty/*/webapp
+
  # chown -R root:root /var/subsonic/jetty/*/webapp
  
 
Change this line in {{ic|/var/subsonic/subsonic.sh}}
 
Change this line in {{ic|/var/subsonic/subsonic.sh}}
  
  {{Codeline|<nowiki>${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \</nowiki>}}
+
  ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
  
 
with this one
 
with this one
  
  {{Codeline|<nowiki>sudo -u subsonic ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \</nowiki>}}
+
  sudo -u subsonic ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
  
 
Restart subsonic daemon
 
Restart subsonic daemon
  
  # sudo /etc/rc.d/subsonic start
+
  # rc.d start subsonic
 +
 
 +
===Install LAME and FFmpeg for Transcoding ===
 +
Subsonic requires LAME to be installed to transcode songs in mp3 format to lower bit rates. Also requieres FFmpeg to transcode from other formats (as ogg, flac, wav or wma) to mp3 format or to stream video files.
 +
If not already installed, [[pacman|Install]] the {{Pkg|lame}} and {{Pkg|ffmpeg}} package, available in the [[Official Repositories|official repositories]].
 +
 
 +
Put a symlink to LAME in the transcode directory for subsonic.
 +
 
 +
# ln -s /usr/bin/lame /var/subsonic/transcode/lame
 +
 
 +
Put a symlink to FFmpeg in the transcode directory for subsonic.
 +
# ln -s /usr/bin/ffmpeg /var/subsonic/transcode/ffmpeg
 +
 
 +
Restart subsonic daemon
 +
# rc.d start subsonic
 +
 
 +
=== Systemd Setup ===
 +
 
 +
Create a service file in /usr/lib/systemd/system called subsonicd.service with this content:
 +
 +
{{bc|
 +
[Unit]
 +
Description&#61;Subsonic
 +
After&#61;network.target
 +
 
 +
[Service]
 +
Type&#61;forking
 +
ExecStart&#61;/var/subsonic/subsonic.sh
 +
ExecStop&#61;/bin/kill -15 $MAINPID
 +
 
 +
[Install]
 +
WantedBy&#61;multi-user.target
 +
}}
 +
 
 +
Then, run:
 +
 
 +
# sudo systemctl --system daemon-reload
 +
 
 +
And finally enable it:
 +
 
 +
# sudo systemctl enable subsonicd.service
  
 
==Troubleshooting==
 
==Troubleshooting==
Line 38: Line 76:
 
You must have at least one UTF-8 [[locale]] installed.
 
You must have at least one UTF-8 [[locale]] installed.
  
If you start subsonic using {{ic|/etc/rc.d/subsonic}}, and your /etc/[[rc.conf]] has {{Codeline|<nowiki>DAEMON_LOCALE="no"</nowiki>}}, then the subsonic daemon will be started with the C locale, and Java will skip any folders with "international characters" (e.g. ßðþøæå etc.). Either set {{ic|DAEMON_LOCALE}} to {{ic|"yes"}} (but this will affect '''all''' rc.daemons), or add a line to the beginning of {{ic|/var/subsonic/subsonic.sh}} which sets {{ic|LANG}} to an installed UTF-8 locale, e.g. {{Codeline|<nowiki>LANG=nn_NO.utf8</nowiki>}}.
+
If you start subsonic using {{ic|/etc/rc.d/subsonic}}, and your /etc/[[rc.conf]] has {{ic|<nowiki>DAEMON_LOCALE="no"</nowiki>}}, then the subsonic daemon will be started with the C locale, and Java will skip any folders with "international characters" (e.g. ßðþøæå etc.). Either set {{ic|DAEMON_LOCALE}} to {{ic|"yes"}} (but this will affect '''all''' rc.daemons), or add a line to the beginning of {{ic|/var/subsonic/subsonic.sh}} which sets {{ic|LANG}} to an installed UTF-8 locale, e.g. {{ic|<nowiki>LANG=nn_NO.utf8</nowiki>}}.
  
 
==External links==
 
==External links==
 
* [http://www.subsonic.org Official web site]
 
* [http://www.subsonic.org Official web site]

Revision as of 11:31, 16 December 2012

Subsonic is a music server that lets you store your music on one machine and play it from other machines, cell phones, via a web interface, or various other applications. It can be installed using the subsonicAUR package on AUR.

Additional config

Run subsonic daemon NOT as root

Stop subsonic daemon is running

# rc.d stop subsonic

Add a system user "subsonic" without home folder and add it to "audio" group if you want to use the "jukebox" feature

# useradd --system --groups audio subsonic

Change folder owners as follow. Path may changes; these are the default ones:

# chown -R subsonic:subsonic /tmp/subsonic
# chown -R subsonic:subsonic /var/subsonic
# chown -R root:root /var/subsonic/transcode
# chown -R root:root /var/subsonic/jetty/*/webapp

Change this line in /var/subsonic/subsonic.sh

${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \

with this one

sudo -u subsonic ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \

Restart subsonic daemon

# rc.d start subsonic

Install LAME and FFmpeg for Transcoding

Subsonic requires LAME to be installed to transcode songs in mp3 format to lower bit rates. Also requieres FFmpeg to transcode from other formats (as ogg, flac, wav or wma) to mp3 format or to stream video files. If not already installed, Install the lame and ffmpeg package, available in the official repositories.

Put a symlink to LAME in the transcode directory for subsonic.

# ln -s /usr/bin/lame /var/subsonic/transcode/lame

Put a symlink to FFmpeg in the transcode directory for subsonic.

# ln -s /usr/bin/ffmpeg /var/subsonic/transcode/ffmpeg

Restart subsonic daemon

# rc.d start subsonic

Systemd Setup

Create a service file in /usr/lib/systemd/system called subsonicd.service with this content:

[Unit]
Description=Subsonic
After=network.target

[Service]
Type=forking
ExecStart=/var/subsonic/subsonic.sh
ExecStop=/bin/kill -15 $MAINPID

[Install]
WantedBy=multi-user.target

Then, run:

# sudo systemctl --system daemon-reload 

And finally enable it:

# sudo systemctl enable subsonicd.service

Troubleshooting

UTF-8 file names not added to the database

You must have at least one UTF-8 locale installed.

If you start subsonic using /etc/rc.d/subsonic, and your /etc/rc.conf has DAEMON_LOCALE="no", then the subsonic daemon will be started with the C locale, and Java will skip any folders with "international characters" (e.g. ßðþøæå etc.). Either set DAEMON_LOCALE to "yes" (but this will affect all rc.daemons), or add a line to the beginning of /var/subsonic/subsonic.sh which sets LANG to an installed UTF-8 locale, e.g. LANG=nn_NO.utf8.

External links