Install Airsonic on Raspberry Pi 3
Written by pmd - - no commentsStand-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:
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/airsonicNote: 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
Then we need to link Airsonic with the transcoder ffmpeg.
$ 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:
Startup log example
● 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
$