How to Install a Subsonic Media Streamer on Alibaba Cloud

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Subsonic is an open source and free to use web-based streaming application that lets you share your favorite videos and music on your own media server. Subsonic media streamer provides you a centralized way to access your music from anywhere in the world.

In this tutorial, we will be installing and setting up Subsonic on an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get $300 — $1200 worth in Alibaba Cloud credits for your new account. If you don’t kabout how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1.5GB RAM and 1 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  • Set up your server’s hostname and create user with root privileges.

Setting Up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.

# sudo apt update && sudo apt upgrade

Software-properties-common package is required to get the supported files for installation of Java. To install software-properties-common execute the command.

# sudo apt-get install software-properties-common -y

Install Java Using PPA

You can install Oracle Java or OpenJDK. In this tutorial, you will need to install Oracle Java. To do so, you will need to follow the steps below.

Step 1:

Add the required PPA repository for installing Java. To do so, execute the following command,

# sudo add-apt-repository ppa:webupd8team/java

After executing above command, you will be asked to press Enter to continue or Ctrl+C to return control and cancel the process. Hit Enter to proceed with installation.

Step 2:

You will need to update the source list. To do so, you will need to execute the following command.

# sudo apt-get update

Step 3:

You can install Oracle Java. To install Oracle Java 8, execute the following command.

# sudo apt-get install oracle-java8-installer

You will be asked to type ‘y’ and hit Enter to continue. Hit Enter and you will see the license agreement prompt.

Hit Enter to continue, and you will see the Oracle Binary Code license terms prompt.

Select Yes and hit Enter in order to accept the license terms of Oracle Binary Code, the setup will be continued.

Install Subsonic

To install Subsonic, you will need to follow the steps below.

Step 1:

Get download link of latest release of Subsonic from its official website and execute the following command to download a copy of Subsonic.

# wget https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.3.deb

Step 2:

Execute the following command to de-package the downloaded Debian file.

# sudo dpkg -i subsonic-6.1.3.deb

Step 3:

By default, subsonic has root user which is not secure. Hence, to avoid security issues, you will need to change user for subsonic. To do so, execute the following command which will open a file in nano editor. Find SUBSONIC_USER=root, change root to your own username, in my case, I will use aareez and save the file.

Step 4:

you will need to restart your Subsonic Media Server by executing the command below.

# sudo systemctl restart subsonic

Step 5:

You can access your Subsonic Media Server via http://your_ecs_ip_address:4040 which means you will need to access port 4040. In case, you get any error while accessing, you will need to create security rule and update your firewall settings from Alibaba Cloud Security Group Rules. For updating firewall settings, go to the section specified for firewall settings. After accessing the Subsonic Media Server, you will see the following screen.

Image for post

Step 6:

To store your media files, you will need to specify a directory for Subsonic Media Server. To do so, execute the commands below to create folder and assign rights to that folder.

# sudo mkdir /var/music
# sudo chown aareez:aareez /var/music

Step 7:

Log in to Subsonic Media Server by using default username and password.

Username: admin

Password: admin

After logging in successfully, you will see the following screen.

Image for post

Change your administrator password to avoid any illegal access of your Subsonic Media Server.

Image for post

Select user as admin and type your new password and hit save button.

You will need to set up your media folder next. Type media folder address as you created in the above step and hit save button.

Image for post

Finally, you need to configure network settings as shown below.

Image for post

If you have any domain name, you can use it here but for enabling it, you will need to install Nginx and setup reverse proxy to forward the request to port 4040.

Set Up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm

Install Nginx and Set Up Reverse Proxy

In this step, you will setup reverse proxy to access Subsonic Media Server so that you can access it via domain name without using any port in the end of address.

To install Nginx server, execute the command below.

# sudo apt-get install -y nginx

Start and enable nginx server so that on system reboot, it can start automatically. To do so, execute the commands below.

# sudo systemctl start nginx
# sudo systemctl enable nginx

On successful installation, you will see the welcome screen.

To install Node.js, execute the command below.

# sudo apt-get install nodejs

Execute the following command to create an Nginx configuration file using nano editor.

# sudo nano /etc/nginx/conf.d/subsonic.conf

Add the following text in the opened file and save it.

server {
listen 80;
listen [::]:80;
server_name softpedia.xyz; location / {
proxy_pass http://localhost:4040/;
}
}

Restart your Nginx server using the command below.

# sudo systemctl restart nginx

Install SSL Certificate

To install SSL certificate using Let’s Encrypt SSL, follow the steps below.

Update your system by executing command below.

# sudo apt-get update

Add the certbot repository.

# sudo add-apt-repository ppa:certbot/certbot

Update the package to load the added certbot repository.

# sudo apt-get update

Install python-certbot-nginx using the command below.

# sudo apt-get install python-certbot-nginx

Issue SSL certificate to your domain by executing the command below.

# sudo certbot --nginx -d softpedia.xyz

Restart nginx server using the command below.

# sudo systemctl restart nginx

Congratulations! You have successfully installed and configured Subsonic media server on your ECS Ubuntu instance.

Reference:https://www.alibabacloud.com/blog/how-to-install-a-subsonic-media-streamer-on-alibaba-cloud_594745?spm=a2c41.12842891.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store