How to update a standalone Airsonic
- Stop the current running Airsonic:
$ sudo systemctl stop airsonic.service
$ cd /var/airsonic/
$ sudo mv airsonic.war airsonic.war.10.1.1.bak
$ sudo wget https://github.com/airsonic/airsonic/releases/download/v10.1.2/airsonic.war --output-document=/var/airsonic/airsonic.war
- Put good rights to all folder (new airsonic.war is not owned by airsonic), and verify it has been applied:
$ sudo chown -R airsonic:airsonic /var/airsonic
$ ls
total 151M
-rw-r--r-- 1 airsonic airsonic 760K Oct 11 19:52 airsonic.log
-rw-r--r-- 1 airsonic airsonic 11M Oct 3 00:20 airsonic.log.1
-rw-r--r-- 1 airsonic airsonic 978 Oct 11 04:00 airsonic.properties
-rw-r--r-- 1 airsonic airsonic 70M Jul 28 22:10 airsonic.war
-rw-r--r-- 1 airsonic airsonic 70M Dec 16 2017 airsonic.war.10.1.1.bak
drwxr-xr-x 2 airsonic airsonic 4.0K Oct 11 19:49 db
drwxr-xr-x 2 airsonic airsonic 20K Sep 14 16:08 lastfmcache
drwxr-xr-x 7 airsonic airsonic 4.0K Jul 22 10:36 lucene2
-rw-r--r-- 1 airsonic airsonic 741 Oct 11 19:50 rollback.sql
drwxr-xr-x 16 airsonic airsonic 4.0K Oct 4 17:45 thumbs
drwxr-xr-x 2 airsonic airsonic 4.0K Jul 22 10:54 transcode
- Start updated Airsonic and restart proxy server:
$ sudo systemctl start airsonic.service
$ sudo service nginx restart
Nothing too hard, basically, you need to replace the airsonic.war by the updated one.
Stand-alone WAR installation integrated within systemd
Let's see how to install a stand-alone Airsonic on a Raspberry 3 integrated with Systemd.
First of all, we need Java to be installed:
$ sudo apt-get install openjdk-8-jre
By following these systemd setup instructions, Airsonic will be available at http://localhost:8080/airsonic.
- Setup dedicated airsonic user:
$ sudo useradd airsonic
- Setup Airsonic data dir:
$ sudo mkdir /var/airsonic
$ sudo chown airsonic /var/airsonic
- Download the stand-alone WAR:
$ sudo wget https://github.com/airsonic/airsonic/releases/download/v10.1.1/airsonic.war --output-document=/var/airsonic/airsonic.war
- Setup systemd service:
$ sudo wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic.service -O /etc/systemd/system/airsonic.service
$ sudo systemctl daemon-reload
$ sudo systemctl start airsonic.service
$ sudo systemctl enable airsonic.service
$ sudo wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic-systemd-env -O /etc/sysconfig/airsonic
Note: On Debian systems you need to replace /etc/sysconfig with /etc/default)
-
Go configure http://localhost:8080/airsonic.
Set up a reverse proxy: nginx
- Go edit nginx configuration:
$ sudo nano /etc/nginx/sites-available/default
-
location ^~ /airsonic {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- Restart nginx:
$ sudo service nginx restart
Now the Airsonic server should be accissible from outside uside http://publicadress.com/airsonic
Source 1 : Stand-alone WAR installation
Source 2 : The url I'm opening is http://publicadress.com/airsonic but it will be redirected to http://publicadress.com/login, which brings up error 404.
Set up the transcoder
$ sudo apt-get install ffmpeg
Then we need to link Airsonic with the transcoder ffmpeg.
$ sudo mkdir /var/airsonic/transcode
$ cd /var/airsonic/transcode
$ sudo ln -s /usr/bin/ffmpeg /var/aisonic/transcode/ffmpeg
$ ls -alh
total 8.0K
drwxr-xr-x 2 airsonic airsonic 4.0K Jul 22 10:54 .
drwxr-xr-x 5 airsonic tomcat8 4.0K Jul 22 10:48 ..
lrwxrwxrwx 1 root root 15 Jul 22 10:54 ffmpeg -> /usr/bin/ffmpeg
$ sudo chown -R airsonic:airsonic /var/airsonic
$ ls -alh
total 8.0K
drwxr-xr-x 2 airsonic airsonic 4.0K Jul 22 10:54 .
drwxr-xr-x 5 airsonic airsonic 4.0K Jul 22 10:48 ..
lrwxrwxrwx 1 airsonic airsonic 15 Jul 22 10:54 ffmpeg -> /usr/bin/ffmpeg
Interact with server from Android
I use the Ultrasonic application:
Source 1, 2, 3,
Startup log example
$ sudo systemctl status airsonic
● airsonic.service - Airsonic Media Server
Loaded: loaded (/etc/systemd/system/airsonic.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-01-18 21:09:56 CET; 20min ago
Main PID: 538 (java)
Tasks: 33 (limit: 1597)
CPU: 3min 15.474s
CGroup: /system.slice/airsonic.service
└─538 /usr/bin/java -Xmx700m -Dairsonic.home=/var/airsonic -Dserver.context-path=/airsonic -Dserver.port=8080 -jar /var/airsonic/airsonic.war
Jan 18 21:11:50 raspberrypi java[538]: 2022-01-18 21:11:50.554 INFO --- l.l.StandardLockService : Successfully released change log lock
Jan 18 21:11:51 raspberrypi java[538]: 2022-01-18 21:11:51.540 INFO --- o.a.p.service.SettingsService : Java: 1.8.0_312, OS: Linux
Jan 18 21:11:53 raspberrypi java[538]: 2022-01-18 21:11:53.290 INFO --- org.airsonic.player.Application : Detected Tomcat web server
Jan 18 21:12:31 raspberrypi java[538]: 2022-01-18 21:12:31.557 INFO --- o.a.p.service.PodcastService : Automatic Podcast update scheduled to run every 24 hour(s), starting at Tue Jan 18 21:17:31 CET 2022
Jan 18 21:12:33 raspberrypi java[538]: 2022-01-18 21:12:33.840 INFO --- o.a.p.s.search.IndexManager : Index was found (index version 18).
Jan 18 21:12:33 raspberrypi java[538]: 2022-01-18 21:12:33.900 INFO --- o.a.p.s.MediaScannerService : Automatic media library scanning scheduled to run every 1 day(s), starting at 2022-01-19T03:00:00.887
Jan 18 21:13:03 raspberrypi java[538]: 2022-01-18 21:13:03.363 INFO --- org.airsonic.player.Application : Started Application in 154.011 seconds (JVM running for 170.609)
Jan 18 21:17:31 raspberrypi java[538]: 2022-01-18 21:17:31.553 INFO --- o.a.p.service.PodcastService : Starting scheduled Podcast refresh.
Jan 18 21:17:31 raspberrypi java[538]: 2022-01-18 21:17:31.565 INFO --- o.a.p.service.PodcastService : Completed scheduled Podcast refresh.
Jan 18 21:18:01 raspberrypi java[538]: 2022-01-18 21:18:01.772 INFO --- o.a.p.f.BootstrapVerificationFilter : Servlet container: Apache Tomcat/8.5.51
$
Choose where to mount the disk:
mkdir /home/pi/HDD
Partition is NTFS, so if we wanna write on it:
sudo apt-get install ntfs-3g
To know the UUID of the HDD:
sudo blkid
Edit how to mount disk partition:
sudo nano /etc/fstab
Add this line and save:
UUID=AADEEA03DEE9C7A1 /home/pi/HDD ntfs-3g uid=1000,gid=1000,auto,umask=000 0 0
Mount all filesystems mentioned in fstab to be mounted as indicated :
sudo mount -a
Install java:
sudo apt-get install openjdk-8-jre
Download the Subsonic .deb package and install it:
sudo dpkg -i subsonic-x.x.deb
Change user (i have set pi instead of root) :
sudo nano /etc/default/subsonic
For troubleshooting interesting files are here: /var/subsonic
It was interesting because it allowed me to understand why Subsonic web interface was OK but impossible to play a file :
cat /var/subsonic/subsonic.log
[2018-01-14 10:59:44,539] INFO TranscodeInputStream - Starting transcoder: /var/subsonic/transcode/ffmpeg -i /home/pi/Music/Paul Kalkbrenner - Berlin Calling/07_Paul_Kalkbrenner_-_Torted_Original Mix.mp3 -map 0:0 -b:a 128k -v 0 -f mp3 -
[2018-01-14 10:59:44,551] INFO InputStreamReaderThread - (/var/subsonic/transcode/ffmpeg) /var/subsonic/transcode/ffmpeg: 1: /var/subsonic/transcode/ffmpeg: Syntax error: "(" unexpected
It was a problem linked with ffmpeg. I think the problem comes from the fact that ffmpeg given in deb is made for ubuntu/debian but probably not ARM processor. THis is why I install ffmpeg from repository and then linked Subsonic folder to this ffmpeg freshly installed:
sudo apt-get install ffmpeg
sudo rm /var/subsonic/transcode/ffmpeg
sudo ln -s /usr/bin/ffmpeg /var/subsonic/transcode/ffmpeg
Restart Subsonic:
sudo service subsonic restart
Configure Subsonic using web interface and admin account.
It worked! I could play my music from Astana, Kazakhstan while it was actually stocked in my Raspberry in Paris!
In my opinion it works quiet nice! Not laggy I mean.