Home » Guides » A Complete Guide To Install Airsonic on Linux: Debian, Ubuntu, Fedora, CentOS, Arch Linux, etc.

A Complete Guide To Install Airsonic on Linux: Debian, Ubuntu, Fedora, CentOS, Arch Linux, etc.

Airsonic is a free media server that offers web-based media streaming. Music lovers should look forward to the software as it makes it far easier to share music with your friends or simply listen to music on the go. As an open-source tool, it is based on Java and is a fork of Subsonic that can handle large music libraries with relative ease. But that’s not all. 

The tool is also perfectly capable of handling any audio or video format besides MP3, including formats that can be streamed over HTTP like WMA, FLAC, APE, etc. If you are looking for a free, yet competent management system for your music, then look no further. Thus, we have created this article to help our readers install Airsonic on Linux and its distributions.

Table Of Contents

What is Airsonic?

As mentioned already, Airsonic is a free, open-source, web-based media server and streamer that provides remote access to your music libraries. You can use it to stream your music on more than one player simultaneously.  Unlike typical servers, Airsonic is designed to handle hundreds of gigabytes of data. So, with Airsonic you do not have to worry about how large your music collection is. Furthermore, the tool supports transcoder plug-ins that make media conversion very simple. Thus, you can stream literally any audio format as long as you are on Airsonic, including obscure formats like WavPack and Shorten.

airsonic, install airsonic on linux
Airsonic

How To Install Airsonic On Linux?

You can install Airsonic on most Linux distributions with several methods that we have listed below. But before that, you have to install a few prerequisites, such as:

Installing OpenJDK

It is important to have Java on your system before installing Airsonic. Thus, you have to get either OpenJDK8 or Oracle JDK8 for the installation to work. Furthermore, after installing OpenJDK, you also have to set the default JAVA_HOME and then deploy Airsonic. To install OpenJDK, you must follow the steps below:

NOTE: If you are running Airsonic on a machine with ARM, then chances are you might experience extremely long startup times. If this happens, you should install Oracle’s JDK/JRE instead, as OpenJDK has known issues when working on ARM.

For Debian 9

Step 1. First, install the openjdk-8-jre package:

sudo apt install openjdk-8-jre

Step 2. Then, set the default JAVA_HOME by using the command below:

sudo update-alternatives --config java

On Debian 8

Step 1. Open your /etc/apt/source.list:

sudo nano /etc/apt/source.list

Step 2. Then, add the backports repo to it:

deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib

Step 3. Now, update your package list:

sudo apt-get update

Step 4. Finally, install the openjdk-8-jre package

sudo apt-get install openjdk-8-jre

Step 5. Lastly, set the default JAVA_HOME by using the command below:

sudo update-alternatives --config java

For Ubuntu

Step 1. Again, install the openjdk-8-jre package:

sudo apt-get install openjdk-8-jre

Step 2. And similarly set default JAVA_HOME by using the command:

sudo update-alternatives --config java

On RHEL

Step 1. Run the YUM command to install Java:

sudo yum install java

Step 2. Set default JAVA_HOME:

export JAVA_HOME=(/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-2.el8_5.x86_64/jre

Method 1. Install Airsonic On Linux Using Tomcat WAR

If you want to install and run Airsonic using Tomcat, you will need to get at least Tomcat8:

Step 1. First, download the latest Airsonic .war package

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

Step 2. Then, import the public key

gpg --keyserver keyserver.ubuntu.com --recv 0A3F5E91F8364EDF

Step 3. Now, download the signed checksums file and verify the package:

wget https://github.com/airsonic/airsonic/releases/download/v10.6.2/artifacts-checksums.sha.asc
gpg --verify artifacts-checksums.sha.asc
sha256sum -c artifacts-checksums.sha.asc

Now, you are ready to deploy Airsonic on different Linux distributions

On Debian 8/Ubuntu

Step 1. Create the Airsonic directory and assign ownership to the Tomcat system user

sudo mkdir /var/airsonic/
sudo chown -R tomcat8:tomcat8 /var/airsonic/

Step 2. Stop the tomcat8 service:

sudo systemctl stop tomcat8.service

Step 3. Remove the Airsonic files from the $TOMCAT_HOME:

sudo rm /var/lib/tomcat8/webapps/airsonic.war
sudo rm -R /var/lib/tomcat8/webapps/airsonic/
sudo rm -R /var/lib/tomcat8/work/*

Step 4. After that, move the file from the $TOMCAT_HOME/webapps folder and assign ownership to the system user

sudo mv airsonic.war /var/lib/tomcat8/webapps/airsonic.war
sudo chown tomcat8:tomcat8 /var/lib/tomcat8/webapps/airsonic.war

Step 5. Restart Tomcat:

sudo systemctl start tomcat8.service

On Debian 9/Ubuntu (18.04+)

The steps are the same as the previous version, just use Tomcat9 instead of 8 for the installation to work.

On FreeBSD

Step 1. First, install Tomcat 8.5

pkg install tomcat85

Step 2. Then, have tomcat start on boot:

# sysrc tomcat85_enable=YES
tomcat_enable: NO -> YES

Method 2. Install Airsonic On Linux Without Tomcat

Step 1. Download the latest Airsonic .war package

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

Step 2. Then, download and import Andrew DeMaria public key:

gpg --keyserver keyserver.ubuntu.com --recv 0A3F5E91F8364EDF

Step 3. After that, download the signed checksums file and verify the package:

wget https://github.com/airsonic/airsonic/releases/download/v10.6.2/artifacts-checksums.sha.asc
gpg --verify artifacts-checksums.sha.asc
sha256sum -c artifacts-checksums.sha.asc

Step 4. Create the Airsonic directory and assign ownership to the user

sudo mkdir /var/airsonic/
sudo chown -R $USER:$GROUP /var/airsonic/

Step 5. Run Airsonic

java -jar airsonic.war

Using with Systemd

Step 1. First, set up a dedicated Airsonic user:

useradd airsonic

Step 2. Then, set up the Airsonic data directory:

mkdir /var/airsonic
chown airsonic /var/airsonic

Step 3. Download the war package:

wget https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war  --output-document=/var/airsonic/airsonic.war

Step 4. Now, set the systemd service:

wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic.service -O /etc/systemd/system/airsonic.service
systemctl daemon-reload
systemctl start airsonic.service
systemctl enable airsonic.service
wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic-systemd-env -O /etc/sysconfig/airsonic

Method 3. Build Airsonic From Source

Step 1. Clone the Airsonic repo:

git clone https://github.com/airsonic/airsonic.git
cd airsonic

Step 2. Now, build the Airsonic .war package

mvn clean package
ls -l airsonic-main/target/airsonic.war
airsonic-main/target/airsonic.war

Step 3. Finally, build the Airsonic Docker image

$ mvn clean package -P docker

Method 4. Use Docker To Install Airsonic

Step 1. First, install Docker

Step 1.1 – Set up Docker’s apt repository.

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 1.2 – Add the repo to the APT repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Step 1.3 – Install the Docker packages.

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 1.4 – Verify that the installation is successful by running the hello-world image:

sudo docker run hello-world

Step 2. Now, run the Airsonic Docker Image:

docker run -p 4040:4040 -d airsonic/airsonic

Method 5. Using Native Repositories To Install Airsonic On Linux

On Debian/Ubuntu

Step 1. First, update the APT repositories:

sudo apt update

Step 2. Then, update the repositories

sudo apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
wget -O- https://apt.syncthing.net/keys/syncthing-release.gpg | sudo gpg --dearmor -o /usr/share/keyrings/syncthing-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt update

Step 3. Install Airsonic

sudo apt install airsonic

Step 4. Finally, start and enable Airsonic:

sudo systemctl start airsonic
sudo systemctl enable airsonic

On Fedora/CentOS/RHEL

Step 1. Start by adding the EPEL repository:

sudo yum install epel-release

Step 2. Install OpenJDK

sudo dnf install java-11-openjdk

Step 3. Then, download Airsonic:

wget https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war -O /usr/local/airsonic/airsonic.war

Step 4. Finally, create a Systemd Service File

sudo nano /etc/systemd/system/airsonic.service

Step 4.1 –  Now, add the following content to the file:

[Unit]
Description=Airsonic Media Server
After=network.target
[Service]
User=airsonic
ExecStart=/usr/bin/java -jar /usr/local/airsonic/airsonic.war
SuccessExitStatus=143
TimeoutStopSec=20
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target

Step 5. Start and enable Airsonic

sudo systemctl daemon-reload
sudo systemctl start airsonic
sudo systemctl enable airsonic

On Arch Linux

Step 1. Install an AUR Helper ‘YAY’

sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Step 2. Then install Airsonic

yay -S airsonic

Method 6. Install Airsonic On Linux Using Snap

Step 1. First, install Snap

On Debian/Ubuntu

sudo apt update
sudo apt install snapd

For Fedora

sudo dnf install snapd
sudo ln -s /var/lib/snapd/snap /snap

For CentOS/RHEL

sudo yum install epel-release
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

On Arch Linux

sudo pacman -S snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

On OpenSUSE

sudo zypper install snapd
sudo systemctl enable --now snapd
sudo systemctl start snapd
sudo ln -s /var/lib/snapd/snap /snap

Step 2. Install Airsonic using Snap

snap search airsonic
sudo snap install airsonic-advanced
Gilbert John Avatar