This article will assist you in installing SHOUTcast Distributed Network Audio Server (DNAS 2.0) in CentOS 7 VPS.
Once SHOUTcast is installed on the server, you can use media players like Winamp or Mixxx to connect to a streaming server and broadcast audio playlists to the internet.
You can apply the tutorial in this article to other Linux distributions such as RHEL, Fedora, Ubuntu, Debian, and Linux Mint with appropriate commands changes according to your chosen Linux distribution.
- First, we will create a local user in VPS to run the DNAS server since it is not recommended to run the DNAS server from the root account due to security reasons.
Log in to your VPS through SSH and create a new user with your desired name. We have created the username radio-user to install the server. Once you create this user, log out from the root user and log in with the newly created user.
Then execute the following commands for the same –
$ su -
$ adduser radio-user
$ passwd radio-user
$ exit
$ su - radio-user
$ pwd
2. In the radio-user account, create two directories of your desired name. For example, we have created two directories - radioserver (Installation) and SHOUTcast (Download).
Once these directories are created, switch to SHOUTcast (Download) directory.
To perform these operations, execute the following commands
$ mkdir SHOUTcast
$ mkdir radioserver
$ cd SHOUTcast
3. Download the latest version of the SHOUTcast server archive according to your OS architecture from the official Nullsot Download page.
To download archive files, we will use the wget utility by executing the following commands –
--- To Download the SHOUTcast server archive for 32-bit OS---
$ wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_09_09_2014.tar.gz
---To Download the SHOUTcast server archive for 64-bit OS---
$ wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_x64_09_09_2014.tar.gz
4. Once the SHOUTcast server archive download completes, extract the downloaded zip file archive (sc_serv2_linux_architecture_date.tar.gz) and list all its files.
Locate the sc_serv executable binary file, copy it to the installation directory(radioserver), and switch to the radioserver directory.
Following are the commands to perform these actions –
$ tar xfz sc_serv2_linux_x64_09_09_2014.tar.gz
$ ls
$ cp sc_serv ../radioserver/
$ cd ../radioserver/
$ ls
5. Now, create two directories named control and logs at the server installation path (radioserver) using these commands –
$ mkdir control
$ mkdir logs
$ ls
Now, we will create the configuration file for the SHOUTcast server to run and operate it. Please create a new file named sc_serv.conf and edit it with the text editor of your choice. Add the following statements to this file (sample configuration file). There are some necessary settings you should change here, such as password statements.
- adminpassword – admin password to perform remote administration via the web interface.
- streampassword_1 – password required by the remote media player to connect and stream media content to the server.
$ nano sc_serv.conf
OR
$ vi sc_serv.conf
---Add the following statements to sc_serv.conf file (This is a sample configuration file)---
adminpassword=remote-admin-password
password=remote-media-player-password
requirestreamconfigs=1
streamadminpassword_1=password2
streamid_1=1
streampassword_1=password3
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
6. Alternatively, you can configure the server through the web interface by creating a configuration file.
Just go to the SHOUTcast directory and run builder.sh or setup.sh scripts. This will let you configure the server through your web browser at URL – http://your-IP-address:8000 OR http://your-IP-address:8000.
So, this created configuration file should be copied to the installation directory (radioserver).
7. To start the server, execute the sc_serv file from the radioserver directory. We want to execute this in the background, so we will use & the bash operator as shown below. Now the SHOUTcast server is up and running.
8. Once the SHOUTcast server starts, you can access its web interface in the browser. Type your server IP Address on port 8000, and the SHOUTcast server web interface should appear as shown below, with no live streams available.
9. Use the following daemon command to run the SHOUTcast server as a daemon.
$ ./sc_serv ## It will start the server in the foreground. Hit Ctrl + c to stop.
$ ./sc_serv daemon ## It will start the server as a daemon.
$ ps aux | grep sc_serv ## It will get server PID.
$ killall sc_serv ## It will stop the server daemon.
10. To start or stop the SHOUTcast radio server with simplified commands, we need to create an executable script (namely radio) through the root user at /usr/local/bin/, as shown below. Once this file is created, we will make it executable.
---Login as root and create file executable script radio---
$ su -
# nano /usr/local/bin/radio
---Add the following code to the radio file and save it---
#!/bin/bash
case $1 in
start)
cd /home/radio/server/
./sc_serv &
;;
stop)
killall sc_serv
;;
start_daemon)
cd /home/radio/server/
./sc_serv daemon
;;
*)
echo "Usage radio start|stop"
;;
esac
---Make the file executable and exit from the root account---
$ chmod +x /usr/local/bin/radio
$ exit
11. Now, you can use the following commands to SHOUTcast manage the server.
$ radio start_daemon ## It will start the SHOUTcast server as a daemon.
$ radio start ## It will start the SHOUTcast server in the foreground.
$ radio stop ## It will stop the SHOUTcast server.
12. Your SHOUTcast server is ready to receive sound or playlists through remote media players and broadcast the audio content over the internet.
You can use remote media players like Winamp for Windows and Mixxx for Linux OS.