How to Install Airsonic Media Server on CentOS 7

Airsonic is an open-source web-based media server that allows users to manage, stream, and share their audio and video files. It is a versatile and powerful tool, with support for various media formats, as well as integration with third-party services like Last.fm and Tidal. This guide walks you through the complete process of installing Airsonic on a CentOS 7 system.

Prerequisites

Before starting, ensure that you have

  • A CentOS 7 system with root or sudo access.

  • A stable internet connection.

  • Basic knowledge of command line.

Step 1: Update Your System

First, update your CentOS 7 system to the latest version by running the following commands

sudo yum update
sudo yum upgrade

Step 2: Install Java

Airsonic requires Java to run, so we need to install it first. Install the OpenJDK 11 package by running the following command

sudo yum install java-11-openjdk

To confirm that Java has been installed, run the following command

java -version

Step 3: Create a Dedicated User for Airsonic

For security purposes, it is recommended to create a separate user to run the Airsonic service. Use the following command to create a new user named airsonic

sudo useradd -r -m -U -d /opt/airsonic -s /sbin/nologin airsonic

Step 4: Download and Configure Airsonic

Download the latest Airsonic standalone WAR file from the official GitHub repository

sudo wget https://github.com/airsonic/airsonic/releases/download/v10.6.2/airsonic.war -P /opt/airsonic

Adjust permissions for the downloaded file

sudo chown airsonic: /opt/airsonic/airsonic.war

Create a new systemd service file for Airsonic

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

Paste the following content into the file

[Unit]
Description=Airsonic Media Server
After=remote-fs.target network.target

[Service]
User=airsonic
Group=airsonic
Environment="JAVA_OPTS=-Xmx700m"
ExecStart=/usr/bin/java $JAVA_OPTS -Dairsonic.home=/opt/airsonic -Dserver.context-path=/airsonic -Dserver.port=8080 -jar /opt/airsonic/airsonic.war
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Save the file and exit the text editor.

Step 5: Start and Enable Airsonic Service

Start the Airsonic service with the following command

sudo systemctl start airsonic

Enable Airsonic to start at boot

sudo systemctl enable airsonic

Step 6: Configure Firewall

If you have a firewall enabled on your system, add a rule to allow incoming traffic on the default Airsonic port (8080)

sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

Step 7: Access Airsonic Web Interface

Open your web browser and navigate to http://your_server_IP:8080/airsonic. You will see the Airsonic login page. Use the default username admin and password admin to log in. Make sure to change the default password immediately after logging in for the first time to ensure security.

Step 8: Configure Airsonic

After logging in, you will be presented with the Airsonic dashboard. Here, you can customize settings, add media folders, and configure transcoding options.

To add media folders, go to Settings > Media Folders and click the Add media folder button. Provide the path to your media folder and choose a folder type (Music or Video). Click Save to add the folder.

To configure transcoding options, go to Settings > Transcoding. Airsonic comes with preconfigured transcoding settings for various media formats, but you can customize them according to your needs.

Optional Enhancements

Reverse Proxy with Nginx

To access Airsonic using a domain name, you can set up a reverse proxy using Nginx

sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo systemctl enable nginx

Create a new Nginx server block configuration file

sudo nano /etc/nginx/conf.d/airsonic.conf

Add the following configuration, replacing yourdomain.com with your domain

server {
   listen 80;
   server_name yourdomain.com;

   location / {
      proxy_pass http://localhost:8080/airsonic/;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
   }
}

SSL Certificate with Let's Encrypt

To secure your Airsonic server with HTTPS, install Certbot

sudo yum install certbot python2-certbot-nginx
sudo certbot --nginx -d yourdomain.com

Set up automatic certificate renewal by adding a cron job

sudo crontab -e

Add the following line to run renewal daily at 2 AM

0 2 * * * /usr/bin/certbot renew --quiet

External Database (PostgreSQL)

For improved performance, you can configure Airsonic to use PostgreSQL instead of the default H2 database

sudo yum install postgresql-server postgresql-contrib
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql

Create a database and user for Airsonic

sudo -i -u postgres
createuser airsonic
createdb -O airsonic airsonicdb
exit

Update the Airsonic service file to use PostgreSQL by modifying the Environment and ExecStart lines in /etc/systemd/system/airsonic.service to include database connection parameters.

Third-Party Integrations

Airsonic supports integration with various services

  • Last.fm Go to Settings > Personal and enter your Last.fm credentials in the Last.fm Scrobbling section.

  • Tidal Go to Settings > Network and enter your Tidal API token in the Tidal Settings section.

  • Google Drive Go to Settings > Media Folders and choose Google Drive as the folder type when adding a new media folder.

Conclusion

You have successfully installed and configured Airsonic on CentOS 7. With this powerful media server, you can stream music and videos, manage your media library, and access your content from any device. The optional enhancements like reverse proxy, SSL certificates, and external database provide additional security and performance benefits for production deployments.

Updated on: 2026-03-17T09:01:38+05:30

360 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements