Linux / 电脑技术 · 2023年8月30日 0

How to Install AirSonic Media Server on CentOS 8

On this page

AirSonic is a free, open-source and web-based media streaming server that allows you to access your music from the central location. Airsonic is compatible with any audio/video file format and also able to stream over HyperText Transfer protocol. It is a self-hosted media streamer written in the Java language and able to handle very large music collections. It runs on most operating systems including Windows, Linux and Mac OS.

In this tutorial, we will show you how to install AirSonic media streaming server on CentOS 8.

Prerequisites

  • A server running CentOS 8 with minimum 2 GB of RAM.
  • A root password is configured on your server.

Getting Started

By default, SELinux is enabled in CentOS 8 server. So you will need to disable it first.

You can do this by editing /etc/selinux/config file: nano /etc/selinux/config

Make the following changes: SELINUX=disabled

Save and close the file. Then, restart your system to apply the changes.

Install Java

AirSonic is based on Java so you will need to install Java to your system. You can install Java by just running the following command: dnf install java-1.8.0-openjdk-devel

Once the Java has been installed, you can verify the version of Java with the following command: java -version

You should see the following output: openjdk version “1.8.0_232” OpenJDK Runtime Environment (build 1.8.0_232-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

Install AirSonic

Before starting, you will need to create a user to run AirSonic.

First, create a user with the following command: useradd airsonic

Next, create a directory for AirSonic with the following command: mkdir /var/airsonic /var/media_files

Next, download the latest version of AirSonic from the Git repository with the following command: wget https://github.com/airsonic/airsonic/releases/download/v10.4.1/airsonic.war –output-document=/var/airsonic/airsonic.war

Next, give proper permission to the airsonic directory with the following command: chown -R airsonic /var/airsonic
chown -R airsonic /var/media_files

Next, download the pre-configured systemd unit file for AirSonic with the following command: wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic.service -O /etc/systemd/system/airsonic.service
wget https://raw.githubusercontent.com/airsonic/airsonic/master/contrib/airsonic-systemd-env -O /etc/sysconfig/airsonic

Next, reload the systemd daemon with the following command: systemctl daemon-reload

Next, start the AirSonic service and enable it to start on boot with the following commands: systemctl start airsonic
systemctl enable airsonic

You can now verify the status of AirSonic with the following command: systemctl status airsonic

You should get the following output: ? airsonic.service – Airsonic Media Server Loaded: loaded (/etc/systemd/system/airsonic.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2019-10-28 12:29:51 EDT; 2min 6s ago Main PID: 29564 (java) Tasks: 18 (limit: 5060) Memory: 315.0M CGroup: /system.slice/airsonic.service ??29564 /usr/bin/java -Xmx700m -Dairsonic.home=/var/airsonic -Dserver.context-path=/airsonic -Dserver.port=8080 -jar /var/airsonic/> Oct 28 12:31:49 centos8 java[29564]: 2019-10-28 12:31:49.876 INFO — l.c.StandardChangeLogHistoryService : Reading from DATABASECHANGEL> Oct 28 12:31:49 centos8 java[29564]: 2019-10-28 12:31:49.877 INFO — l.executor.jvm.JdbcExecutor : SELECT * FROM DATABASECHANGE> Oct 28 12:31:49 centos8 java[29564]: 2019-10-28 12:31:49.969 INFO — liquibase.changelog.ChangeSet : Marking ChangeSet: classpath> Oct 28 12:31:49 centos8 java[29564]: classpath:liquibase/db-changelog.xml : Custom Precondition Failed: DBMS Major Version Precondit> Oct 28 12:31:49 centos8 java[29564]: 2019-10-28 12:31:49.972 INFO — l.executor.jvm.JdbcExecutor : SELECT MAX(ORDEREXECUTED) FR> Oct 28 12:31:50 centos8 java[29564]: 2019-10-28 12:31:50.017 INFO — l.executor.jvm.JdbcExecutor : INSERT INTO DATABASECHANGELO> Oct 28 12:31:50 centos8 java[29564]: 2019-10-28 12:31:50.020 INFO — l.l.StandardLockService : Successfully released change> Oct 28 12:31:51 centos8 java[29564]: 2019-10-28 12:31:51.489 INFO — o.airsonic.player.dao.PlayerDao : Deleted 1 player(s) that hav> Oct 28 12:31:52 centos8 java[29564]: 2019-10-28 12:31:52.424 INFO — o.a.p.s.MediaScannerService : Automatic media library scan> Oct 28 12:31:53 centos8 java[29564]: 2019-10-28 12:31:53.093 INFO — o.a.p.service.PodcastService : Automa

You can also check the AirSonic running process with the following command: ps -ef | grep airsonic

You should see the following output: airsonic 29459 1 87 12:07 ? 00:02:08 /usr/bin/java -Xmx700m -Dairsonic.home=/var/airsonic -Dserver.context-path=/airsonic -Dserver.port=8080 -jar /var/airsonic/airsonic.war root 29496 6103 0 12:10 pts/0 00:00:00 grep –color=auto airsonic

Access AirSonic Web Interface

Before accessing the AirSonic web interface, you will need to open ports 80 and 8080 with firewalld. You can do it with the following commands: firewall-cmd –zone=public –add-port=80/tcp –permanent
firewall-cmd –zone=public –add-port=8080/tcp –permanent
firewall-cmd –reload

Next, open your web browser and type the URL http://your-server-ip:8080/airsonic. You will be redirected to the following page: