[How to] Install Airsonic on FreeNAS iocage jail

Joined
Dec 25, 2016
Messages
2
Thanks
3
#1
Versions:

FreeNAS-11.2-BETA1
Airsonic 10.1.2 Stand-alone WAR (all platforms)
iocage jail (11.1-RELEASE-p6)

*** Create airsonic iocage ***

iocage create --name "airsonic" --release 11.1-RELEASE boot=on vnet=on ip4_addr="vnet0|192.168.1.217/24" defaultrouter="192.168.1.1" host_hostname="airsonic" allow_raw_sockets="1"


*** Add storage ***

iocage fstab --add airsonic /mnt/tank/media/Music /media nullfs rw 0 0


*** Some troubleshooting commands ***

#iocage start airsonic
#iocage stop airsonic
#iocage set boot=off airsonic
#iocage set ip4_addr="vnet0|192.168.1.217/24" airsonic
#setenv EDITOR /usr/local/bin/nano
#iocage fstab -e airsonic


*** Enter airsonic jail ***

iocage console airsonic


*** Install packages ***

pkg update
pkg upgrade
pkg install nano wget
pkg install java/openjdk8

mkdir /var/airsonic/
mkdir /usr/local/airsonic
cd /usr/local/airsonic
wget https://github.com/airsonic/airsonic/releases/download/v10.1.2/airsonic.war --no-check-certificate


*** OPTIONAL - Copy configuration from old warden jail to new iocage jail ***

exit
cp -Raf "/mnt/pool/jails/airsonic/var/airsonic" "/mnt/iocage/jails/airsonic/root/var" # database and config
cp "/mnt/pool/jails/airsonic/etc/rc.d/airsonic" "/mnt/iocage/jails/airsonic/root/etc/rc.d/" # rc script
iocage console airsonic
chown -R ${USER}:${GROUP} /var/airsonic # root:wheel


*** Install ffmpeg dependencies and Ports Tree with MP3 (lame) support ***
Install the dependencies required to build and use ffmpeg:

pkg install yasm binutils texi2html frei0r v4l_compat gmake pkgconf perl5 fontconfig freetype2 opencv-core schroedinger libtheora libv4l libva libvdpau libvorbis libvpx libx264 xvid gnutls libiconv


Now install the FreeBSD Ports Tree

portsnap fetch
portsnap extract


Build ffmpeg
Navigate to the ffmpeg port directory

cd /usr/ports/multimedia/ffmpeg


Configure ffmpeg build

make configure


This will bring up a menu. Scroll down using arrow keys to “LAME” and hit the spacebar to enable it. Press enter to continue.
The ffmpeg source files will automatically be downloaded then you will be presented with an additional prompt to install documentation. I uncheck with spacebar then press enter to continue.
Start build and installation of ffmpeg

make install clean


Building ffmpeg will take some time depending on the capabilities of your machine, please be patient.
Symlink ffmpeg to where Airsonic expects the transcoder to be.

ln -s /usr/local/bin/ffmpeg /var/airsonic/transcode/ffmpeg


*** Test airsonic (command line start) ***

#java -jar airsonic.war
/usr/local/bin/java -jar /usr/local/airsonic/airsonic.war


*** Create rc autostart script ***

nano /etc/rc.d/airsonic # ...and paste text from the bottom
chmod +x /etc/rc.d/airsonic
sysrc "airsonic_enable=YES" # make service start at jail startup (changes /etc/rc.conf)
service airsonic start # start service


*** Some troubleshooting commands ***

service airsonic stop
service airsonic start
netstat -an | grep 8080 # Check if listening at port 8080
cat -v airsonic # Check if script file have any CR at line end (shows: ^M)
tr -d '\r' < infile > outfile # Eliminate CRs


*** Navigate to Airsonic in a browser ***
Default context and port (command line test start):
Configured context and port (automatic service start):

*** Path to update spanish translate ***

airsonic.war\WEB-INF\classes\org\airsonic\player\i18n\ResourceBundle_es.properties

document:
ResourceBundle_es.properties
Old translation web:
New translation web:

**** Content of airsonic rc script file (/etc/rc.d/airsonic) ***
/etc/rc.d/airsonic


#!/bin/sh
#
# $FreeBSD: airsonic $
#
# PROVIDE: airsonic REQUIRE: LOGIN KEYWORD: shutdown
#
# Configuration settings for airsonic in /etc/rc.conf:
#
# airsonic_enable (bool):
# Set to "NO" by default. Set it to "YES" to enable airsonic.
#
# airsonic_home (str):
# Set to "/var/airsonic" by default.
#
# airsonic_host (str):
# Set to "0.0.0.0" by default. Specify which IP address to listen to.
#
# airsonic_port (int):
# Set to "4040" by default. Specify which port to listen on for HTTP(S).
#
# airsonic_context_path (str):
# Set to "/" by default. Specify the last part of the airsonic URL, typically "/" or "/airsonic".
#
# airsonic_init_memory (int):
# Set to "192" by default. Specify the memory initial size (Java heap size) in megabytes.
#
# airsonic_max_memory (int):
# Set to "384" by default. Specify the memory limit (Java heap size) in megabytes.
#

. /etc/rc.subr

name=airsonic
desc="Airsonic is a free, web-based media streamer, providing ubiquitous access to your music"
rcvar=${name}_enable
pidfile="/var/run/${name}.pid"

load_rc_config "${name}"

: ${airsonic_enable:="NO"}
: ${airsonic_user:="root"} #: ${airsonic_user:="media"}
: ${airsonic_group:="wheel"} #: ${airsonic_group:="media"}
: ${airsonic_home:="/var/airsonic"}
: ${airsonic_address:="0.0.0.0"}
: ${airsonic_port:="4040"}
: ${airsonic_ssl:="NO"}
: ${airsonic_context_path:="/airsonic"}
: ${airsonic_init_memory:="192"}
: ${airsonic_max_memory:="512"}
: ${airsonic_chdir:="/usr/local/airsonic"}

start_cmd=airsonic_start
stop_cmd=airsonic_stop
restart_cmd=airsonic_restart
status_cmd=airsonic_status
start_precmd="export LC_CTYPE='en_US.UTF-8'"

# -Dairsonic.defaultMusicFolder=${airsonic_home}/artists \
# -Dairsonic.defaultUploadFolder=${airsonic_home}/incoming \
# -Dairsonic.defaultPodcastFolder=${airsonic_home}/podcasts \
# -Dairsonic.defaultPlaylistImportFolder=${airsonic_home}/playlists/import \
# -Dairsonic.defaultPlaylistExportFolder=${airsonic_home}/playlists/export \
# -Dairsonic.defaultPlaylistBackupFolder=${airsonic_home}/playlists/backup \

command="/usr/sbin/daemon -p ${pidfile} -f -u ${airsonic_user}"
procname="/usr/local/bin/java"
command_args="-Dairsonic.home=${airsonic_home} -Dserver.address=${airsonic_address} -Dserver.port=${airsonic_port} -Dserver.context-path=${airsonic_context_path} -Xms${airsonic_init_memory}m -Xmx${airsonic_max_memory}m -Djava.awt.headless=true -jar ${airsonic_chdir}/airsonic.war"
command_args1="-Dairsonic.home=${airsonic_home} -Dserver.port=${airsonic_port} -jar ${airsonic_chdir}/airsonic.war"

airsonic_start() {
echo "Starting Airsonic"
echo "${command} ${procname} ${command_args}"
cd ${airsonic_chdir}
${command} ${procname} ${command_args}
}

airsonic_stop() {
echo "Stopping Airsonic"
kill `cat ${pidfile}`
rm ${pidfile}
}

airsonic_restart() {
airsonic_stop
sleep 1
airsonic_start
}

airsonic_status() {
if airsonic_check; then
echo "Airsonic running"
return 1
else
echo "Airsonic not running"
return 0
fi
}

airsonic_check() {
if [ -f ${pidfile} ]; then
return 0
else
return 1
fi
}

run_rc_command "$1"


Regards
 
Joined
Jan 15, 2018
Messages
1
Thanks
0
#3
Luis Miguel, thank you for solution.

When I was try to install Airsonic, I've error on stage ffmpeg configuring.
env: /usr/local/bin/perl5.26.3: No such file or directory
I was solved it by command
ln -s /usr/local/bin/perl5.26.2 /usr/local/bin/perl5.26.3
 
Last edited:
Joined
Oct 19, 2013
Messages
48
Thanks
1
#4
Top