Difference between revisions of "Subsonic"

From ArchWiki
Jump to: navigation, search
(Additional config)
(Remove outdated sections. Trim down and clarify what remains.)
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
'''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]].
  
==Additional config==
+
==Configuration==
===Run subsonic daemon NOT as root===
+
  
By default, subsonic runs as root. This can be changed at any time after installation, even if the daemon has never run.
+
After performing any configuration, remember to restart the daemon.
  
Stop the daemon, if it's running:
+
# systemctl restart subsonic
 +
 
 +
For details on using systemctl, see [[Systemd#Using_units]].
 +
 
 +
===Configure permissions===
  
# rc.d stop subsonic
+
By default, Subsonic runs as root. The following instructions make Subsonic run as user "subsonic".
  
Add a system user "subsonic" without home folder and add it to "audio" group if you want to use the [http://www.subsonic.org/pages/features.jsp jukebox] feature:
+
Stop the daemon if it's running. Add a system user named "subsonic". Add it to the "audio" group if you want to use the [http://www.subsonic.org/pages/features.jsp jukebox] feature.
  
 +
# systemctl stop subsonic
 
  # useradd --system --groups audio subsonic
 
  # useradd --system --groups audio subsonic
  
Change folder owners as follow. Path may change, and the ones listed below are the current (2013-02-05) defaults. If the {{ic|transcode}} folder does not exist, you should [[#Install Transcoders]].
+
Create several folders and customize their permissions.
  
  # chown -R subsonic:subsonic /tmp/subsonic
+
  # cd /var/subsonic
  # chown -R subsonic:subsonic /var/subsonic
+
  # chown -R subsonic:subsonic .
  # chown -R root:root /var/subsonic/transcode
+
  # test -d transcode || mkdir transcode
  # chown -R root:root /var/subsonic/jetty/*/webapp
+
  # chown -R root:root transcode
  
 
Change this line in {{ic|/var/subsonic/subsonic.sh}}:
 
Change this line in {{ic|/var/subsonic/subsonic.sh}}:
Line 30: Line 34:
 
  sudo -u subsonic ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
 
  sudo -u subsonic ${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
  
and restart the subsonic daemon.
+
===Install transcoders===
  
# rc.d start subsonic
+
By default, Subsonic uses FFmpeg to transcode videos and songs to an appropriate format and bitrate on-the-fly. After installation, you can change these defaults so that, for example, Subsonic will transcode FLAC files using FLAC and LAME instead of FFmpeg. You should therefore [[pacman|Install]] the {{Pkg|ffmpeg}}, and you may also want to install {{Pkg|flac}} and {{Pkg|lame}}.
  
===Install Transcoders===
+
For security reasons, Subsonic will not search the system for any transcoders. Instead, the user must create symlinks to the transcoders in the {{ic|/var/subsonic/transcode}} folder. Create the {{ic|transcode}} folder if it does not already exist, then make the necessary symlinks.
 
+
By default, Subsonic uses FFmpeg to transcode videos and songs to an appropriate format and bitrate on-the-fly. After installation, you can change these defaults so that, for example, Subsonic will transcode FLAC files using FLAC + LAME instead of FFmpeg. At a minimum, you should [[pacman|Install]] the {{Pkg|ffmpeg}} package from the [[Official Repositories|official repositories]]. You may also want to install {{Pkg|flac}} and {{Pkg|lame}}.
+
 
+
For security reasons, Subsonic will not search the system for any transcoders. Instead, the user has to create links to the necessary transcoders in the {{ic|/var/subsonic/transcode}} folder. Create the {{ic|transcode}} folder if it does not already exist, then make the necessary symlinks.
+
  
 
  # mkdir /var/subsonic/transcode
 
  # mkdir /var/subsonic/transcode
Line 45: Line 45:
 
  # ln -s `which flac`
 
  # ln -s `which flac`
 
  # ln -s `which lame`
 
  # ln -s `which lame`
 
Finally, restart subsonic daemon.
 
 
# rc.d start subsonic
 
 
=== Systemd Setup ===
 
 
The subsonic installation includes a systemd service file. To install it:
 
 
# cp /var/subsonic/subsonic.service /usr/lib/systemd/system/subsonic.service
 
 
Then, run:
 
 
# systemctl --system daemon-reload
 
 
And finally enable it:
 
 
# systemctl enable subsonic.service
 
  
 
=== HTTPS Setup ===
 
=== HTTPS Setup ===
  
To enable HTTPS browsing and streaming, open /var/subsonic/subsonic.sh in an editor and change this line:
+
To enable HTTPS browsing and streaming, edit {{ic|/var/subsonic/subsonic.sh}} and change this line:
  
 
  SUBSONIC_HTTPS_PORT=0
 
  SUBSONIC_HTTPS_PORT=0
Line 73: Line 55:
  
 
  SUBSONIC_HTTPS_PORT=8443
 
  SUBSONIC_HTTPS_PORT=8443
{{Note|The port 8443 seems hard-coded in somewhere. When I attempted to change it to port 8080 it would automatically redirect my browser to port 8443 after I manually accepted the invalid HTTPS certificate. I was still able to re-navigate to port 8080 after the warning page and have it work on that port.}}
 
And restart the service.
 
  
# systemctl restart subsonic
+
{{Note|port 8443 seems hard-coded somewhere. When attempting to change it to port 8080 it will automatically redirect the browser to port 8443 after manually accepting the invalid HTTPS certificate. You will still be able to re-navigate to port 8080 after the warning page and have it work on that port.}}
  
 
==Troubleshooting==
 
==Troubleshooting==
Line 86: Line 66:
 
===FLAC playback===
 
===FLAC playback===
  
The FFmpeg transcoder doesn't handle FLAC files well, and clients will often fail to play the resultant streams. (at least, on [[User:Ichimonji10|my]] machine) Using FLAC + LAME instead of FFmpeg solves this issue. This workaround requires that the FLAC and LAME transcoders have been installed, as explained in [[#Install Transcoders]].
+
The FFmpeg transcoder doesn't handle FLAC files well, and clients will often fail to play the resultant streams. (at least, on [[User:Ichimonji10|my]] machine) Using FLAC and LAME instead of FFmpeg solves this issue. This workaround requires that the FLAC and LAME transcoders have been installed, as explained in [[#Install Transcoders]].
  
 
Start Subsonic and go to {{ic|settings > transcoding}}. Ensure that the default FFmpeg transcoder does not get used on files with a "flac" extension, then add a new entry. You'll end up with something like this:
 
Start Subsonic and go to {{ic|settings > transcoding}}. Ensure that the default FFmpeg transcoder does not get used on files with a "flac" extension, then add a new entry. You'll end up with something like this:
Line 97: Line 77:
 
| mp3 flac || flac || mp3 || flac --silent --decode --stdout %s || lame --silent -h -b %b -
 
| mp3 flac || flac || mp3 || flac --silent --decode --stdout %s || lame --silent -h -b %b -
 
|}
 
|}
 +
 +
==Madsonic==
 +
Madsonic is a fork of Subsonic with extra features, does not require a registration fee (read completely free) and is available in AUR.
 +
 +
Once you start the server, pay close attention to the Transcoding options, as you will probably have to change the command from "Audioffmpeg" to "ffmpeg".
  
 
==External links==
 
==External links==
 
* [http://www.subsonic.org Official web site]
 
* [http://www.subsonic.org Official web site]

Revision as of 22:23, 18 August 2013

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.

Configuration

After performing any configuration, remember to restart the daemon.

# systemctl restart subsonic

For details on using systemctl, see Systemd#Using_units.

Configure permissions

By default, Subsonic runs as root. The following instructions make Subsonic run as user "subsonic".

Stop the daemon if it's running. Add a system user named "subsonic". Add it to the "audio" group if you want to use the jukebox feature.

# systemctl stop subsonic
# useradd --system --groups audio subsonic

Create several folders and customize their permissions.

# cd /var/subsonic
# chown -R subsonic:subsonic .
# test -d transcode || mkdir transcode
# chown -R root:root transcode

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

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

to this:

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

Install transcoders

By default, Subsonic uses FFmpeg to transcode videos and songs to an appropriate format and bitrate on-the-fly. After installation, you can change these defaults so that, for example, Subsonic will transcode FLAC files using FLAC and LAME instead of FFmpeg. You should therefore Install the ffmpeg, and you may also want to install flac and lame.

For security reasons, Subsonic will not search the system for any transcoders. Instead, the user must create symlinks to the transcoders in the /var/subsonic/transcode folder. Create the transcode folder if it does not already exist, then make the necessary symlinks.

# mkdir /var/subsonic/transcode
$ cd /var/subsonic/transcode
# ln -s `which ffmpeg`
# ln -s `which flac`
# ln -s `which lame`

HTTPS Setup

To enable HTTPS browsing and streaming, edit /var/subsonic/subsonic.sh and change this line:

SUBSONIC_HTTPS_PORT=0

To this:

SUBSONIC_HTTPS_PORT=8443
Note: port 8443 seems hard-coded somewhere. When attempting to change it to port 8080 it will automatically redirect the browser to port 8443 after manually accepting the invalid HTTPS certificate. You will still be able to re-navigate to port 8080 after the warning page and have it work on that port.

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.

FLAC playback

The FFmpeg transcoder doesn't handle FLAC files well, and clients will often fail to play the resultant streams. (at least, on my machine) Using FLAC and LAME instead of FFmpeg solves this issue. This workaround requires that the FLAC and LAME transcoders have been installed, as explained in #Install Transcoders.

Start Subsonic and go to settings > transcoding. Ensure that the default FFmpeg transcoder does not get used on files with a "flac" extension, then add a new entry. You'll end up with something like this:

Name Convert from Convert to Step 1 Step 2
mp3 default ... NOT flac ... mp3 ffmpeg ...  
mp3 flac flac mp3 flac --silent --decode --stdout %s lame --silent -h -b %b -

Madsonic

Madsonic is a fork of Subsonic with extra features, does not require a registration fee (read completely free) and is available in AUR.

Once you start the server, pay close attention to the Transcoding options, as you will probably have to change the command from "Audioffmpeg" to "ffmpeg".

External links