Home / How To / How to install AirSonic Media Server on CentOS 8

How to install AirSonic Media Server on CentOS 8



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 all audio / video file formats and can also stream over the HyperText Transfer protocol. It is a self-host media streamer written in the Java language and can handle very large collections of music. 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 at least 2 GB of RAM.
  • A root password is configured on your server.

Getting Started

By default, SELinux is enabled on the CentOS 8 server. So you have 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 the system to apply the changes.

Installing Java

AirSonic is based on Java so you need to install Java on your system. You can install Java by running only the following command:

  dnf install java-1
.8.0-openjdk-devel

Once Java is installed, you can verify the Java version with the following command:

  java version [19659010] 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)

Installing AirSonic

Before you start, you must create a user to run AirSonic.

First create a user with the following command:

  useradd airsonic 

Then create a directory for AirSonic with the following command:

  mkdir / var / airsonic / var / media_files 

Then 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 

Then authorize the airsonic directory with the following command:

  chown - R airsonic / var / airsonic 
chown -R airsonic / var / media_files

Then retrieve the preconfigured 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 3.819459019uutwget https://raw.githubuse rcontent. com / airsonic / airsonic / master / contrib / airsonic-systemd-env -O / etc / sysconf ig / airsonic 

Then reload the system daemon with the following command:

  systemctl daemon-reload 

Next, start the AirSonic service and enable it to start with the following commands:

  systemctl start airsonic 
systemctl enable airsonic

You can now verify AirSonic status 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 setting: disabled)
Active: active (active) since Mon 2019-10-28 12:29:51 EDT; 2min 6s ago
Main PID: 29564 (java)
Details: 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 DATABASE CHANGE>
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 Condition 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 DATABASE CHANGELO>
Oct 28 12:31:50 centos8 java [29564]: 2019-10-28 12: 31: 50.020 INFO --- l.l.StandardLockService: Release Modified>
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) who have>
Oct 28 12:31:52 centos8 java [29564]: 2019-10-28 12: 31: 52.424 INFO --- o.a.p.s.MediaScannerService: Automatic Media Library Search>
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 control the AirSonic process with the following command:

  ps -ef | grip 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 grip - color = auto airsonic

Access AirSonic Web Interface

Before you get to the AirSonic web interface, you must open ports 80 and 8080 with firewall. You can do this with the following commands:

  firewall-cmd - zone = public --add-port = 80 / tcp --permanent 
firewall-cmd --zone = public --add-port = 8080 / tcp --permanent
firewall-cmd - load

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

 airsonic media server login

Enter the default name and password as admin / admin and click the Log in the button. You should see the following page:

 Getting Started

Then you must change the default administrator password. To do so, click on Change administrator password . You should see the following page:

 Settings

Select admin user, select the change password check box, type the new password and click the Save button to change the default password.

Then you need to set the media folder to store your music and videos. To do so, click on the settings > Media folders . You should see the following page:

 Media folders

Now type / var / media_files in the folder pane and click the Save button.

Configuring Nginx as Reverse Proxy

Then you must configure Nginx as a reverse proxy for Airsonic on port 8080. To do so, first install Nginx web server with the following command:

  dnf install nginx 

When you have installed, you create an Nginx virtual host configuration file:

  nano /etc/nginx/conf.d/airsonic.confebrit19659010??Add the following lines: 

  server {
listen 80;
server_name your-server-ip;
access_log av;
error_log off;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect av;
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_max_temp_file_size 0;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}

Save and close the file when done. Then test Nginx for all syntax errors with the following command:

  nginx -t 

You should see the following output:

  nginx: configuration file /etc/nginx/nginx.conf syntax is ok
nginx: The /etc/nginx/nginx.conf test configuration file is successful

Then start the Nginx service and enable it to start after restarting the system with the following command:

  systemctl start nginx 
systemctl enable nginx

Now you can access AirSonic by visiting URL http:. // your-server-ip / airsonic

Conclusion

Congratulations! you have installed an AirSonic media server with Nginx as a reverse proxy on CentOS 8. Now you can host your own media server and share music with your friends and family. Feel free to ask me if you have any questions.


Source link