Inicio > GNU/Linux, Software Libre > Servidor Airsonic

Servidor Airsonic

sábado, 4 de abril de 2020 Dejar un comentario Ir a comentarios

Airsonic es un fork de Subsonic. Es software libre, programado en Java y permite hacer streaming por HTTP de una gran multitud de formatos de música. Lo que más me gusta es que me permite explorar mi colección de música bajo la estructura de carpetas, nada de etiquetas.

Requiere tener instaladas una serie de dependencias:

apt install wget openjdk-8-jre ffmpeg

La instalación no es complicada:

useradd airsonic

mkdir -p /opt/airsonic

cd /opt/airsonic

wget https://github.com/airsonic/airsonic/releases/download/v10.5.0/airsonic.war

ln -s /usr/bin/ffmpeg

chown -R airsonic:airsonic /opt/airsonic

Y para que arranque al inicio crearemos un script de este estilo («nano /etc/systemd/system/airsonic.service»):

[Unit]
Description=Airsonic Media Server
After=remote-fs.target network.target
AssertPathExists=/opt/airsonic

[Service]
Type=simple
Environment=»JAVA_JAR=/opt/airsonic/airsonic.war»
Environment=»JAVA_OPTS=-Xmx700m»
Environment=»AIRSONIC_HOME=/opt/airsonic»
Environment=»PORT=8080″
Environment=»CONTEXT_PATH=/airsonic»
Environment=»JAVA_ARGS=»
EnvironmentFile=-/etc/default/airsonic
ExecStart=/usr/bin/java \
$JAVA_OPTS \
-Dairsonic.home=${AIRSONIC_HOME} \
-Dserver.context-path=${CONTEXT_PATH} \
-Dserver.port=${PORT} \
-jar ${JAVA_JAR} $JAVA_ARGS
User=airsonic
Group=airsonic

# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
# for details
DevicePolicy=closed
DeviceAllow=char-alsa rw
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
[email protected] @debug @module @mount @obsolete @privileged @reboot @setuid @swap
ReadWritePaths=/opt/airsonic

# You can uncomment the following line if you’re not using the jukebox
# This will prevent airsonic from accessing any real (physical) devices
PrivateDevices=yes

# You can change the following line to `strict` instead of `full`
# if you don’t want airsonic to be able to
# write anything on your filesystem outside of AIRSONIC_HOME.
ProtectSystem=full

# You can uncomment the following line if you don’t have any media
# in /home/…. This will prevent airsonic from ever reading/writing anything there.
ProtectHome=true

# You can uncomment the following line if you’re not using the OpenJDK.
# This will prevent processes from having a memory zone that is both writeable
# and executeable, making hacker’s lifes a bit harder.
#MemoryDenyWriteExecute=yes

[Install]
WantedBy=multi-user.target

Y si necesitamos añadir algún tipo de configuración especial crearemos un fichero con «nano /etc/default/airsonic» que, en principio, lleva el siguiente contenido:

# Set the location of the standalone war to use
JAVA_JAR=/opt/airsonic/airsonic.war

# Set any java opts separated by spaces
JAVA_OPTS=-Xmx700m

# Set a different location for the airsonic home.
# If this path is /opt/libresonic or even contains «libresonic»,
# the data from a previous libresonic can be used as is (i.e. without
# renaming libresonic.properties,db/libresonic*, etc
AIRSONIC_HOME=/opt/airsonic

# Change the port to listen on
PORT=8080

# Change the path that is listened to on
CONTEXT_PATH=/airsonic

# Add any java args. These are different than JAVA_OPTS in that
# they are passed directly to the program. The default is empty:
#JAVA_ARGS=

# Note that there are several settings for spring boot, not explicitly listed
# here, but can be used in either JAVA_OPTS or JAVA_ARGS. The full list
# can be found here:
# https://docs.spring.io/spring-boot/docs/1.4.5.RELEASE/reference/htmlsingle/#common-application-properties
# For example to set debug across the board:
#JAVA_ARGS=–debug

# Or to change the IP address that is listened to:
#JAVA_ARGS=–server.address=127.0.0.1

Habilitaremos el servicio:

systemctl daemon-reload

systemctl start airsonic

systemctl enable airsonic

  1. Sin comentarios aún.