Sunday, March 12, 2017

How to Setup a Shoutcast Radio VPS on Ubuntu

Have you ever wanted to use your VPS to host a Shoutcast Radio stream? In this article we will talk about how to install SHOUTcast Distributed Network Audio Server (DNAS 2.0) on your Ubuntu 16.04 VPS.
Once you have SHOUTcast installed, you will be able to use media players like Winamp or Mixxx to broadcast audio playlists onto the Internet.
Read more to learn how!
First, we will create local user in VPS to run DNAS server since it is not recommended to run DNAS server from a root account. Login to your VPS through SSH or Putty and create new user with your desired name using the following commands.
> su -

> adduser radio-user
The command will ask you for a password for the new user created. Choose one and type it in. You will need this password later so be sure to store it in a safe location.
We will now need to logout from the current root user and login with newly created user. Execute the following commands:
> exit

> su - radio-user

$ pwd
It’s now time to create two different directories. One will be used for downloading the software and the second will be use to install it. Type the following commands:
> mkdir ShoutCastDowload

> mkdir myShoutCastServer
Now let’s enter into the download directory:
> cd ShoutCastDowload
We will now need to download and extract the latest version of SHOUTcast server archive from the website. In order to select that we will have use our browser and connect to the following webaddress:
http://download.nullsoft.com/shoutcast/tools/
Use one of the following commands depending on which architecture your VPS has:
— For 32-bit OS —
> wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux-latest.tar.gz

> tar xfz sc_serv2_linux-latest.tar.gz
— For 64-bit OS —
> wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64-latest.tar.gz

> tar xfz sc_serv2_linux_x64-latest.tar.gz
Once the download of SHOUTcast server archive completes, we will need to locate sc_serv executable binary file and copy it to the installation directory and finally switch to the that directory. Use the following commands to do that:
> ls

> cp  sc_serv  ../myShoutCastServer/

> cd  ../myShoutCastServer/

> ls
We will now need to create two directories named control and logs.
> mkdir control

> mkdir logs

> ls
In the next step we will create a configuration file for the SHOUTcast server. We will need to create a new file named “sc_serv.conf” and edit it with a text editor of your choice. Before adding the following statements to this file, you will need to change all the password with some you choose. Make sure to use different password for the lines “adminpassword” and “password” or the server will not start.
— This is sample configuration file —
adminpassword=YYYYYY

password=XXXXXX

requirestreamconfigs=1

streamadminpassword_1=XXXXXX

streamid_1=1

streampassword_1=XXXXXX

streampath_1=http://radio-server.lan:8000

logfile=logs/sc_serv.log

w3clog=logs/sc_w3c.log

banfile=control/sc_serv.ban

ripfile=control/sc_serv.rip
As an alternative, you can also configure the server through web interface by creating a configuration file. Just go to your ShoutCastDowload directory and run the following command:
> ./setup.sh
Then you will have to type the following link into your web browser and follow the instructions:
http://your-IP-address:8000
Once you are done with the guided installation you will need to copy the configuration file to your home directory using the following command:
> cp sc_serv.conf ../myShoutCastServer

> cd ../myShoutCastServer

> ls
In order to start the server execute SHOUTcast server as a daemon use the following command:
> ./sc_serv daemon
Once SHOUTcast server is started, you can access its web interface in browser. Type your server IP Address on port 8000 and SHOUTcast server web interface should appear with no live streams available.
In order to make it easier to start and stop our new server, we need to create an executable script using the root user in /usr/local/bin/ as shown below and make it executable. Use the following commands to do that:
> su -

> vim /usr/local/bin/scradio
— Add following code and save it —
#!/bin/bash

case $1 in

start)

cd /home/radio-user/myShoutCastServer/

./sc_serv deamon

;;

stop)

killall sc_serv

;;

*)

echo "Usage radio start|stop"

;;

esac

 

> chmod +x /usr/local/bin/scradio

> exit
Now, you can use following commands to manage your SHOUTcast server.
> scradio start

> scradio stop
Congratulations! Our SHOUTcast server is now ready to receive playlists through remote media players and broadcast the audio content over the Internet.

No comments:

Post a Comment