Category Archives: Ubuntu

Finishing the RTMP WordPress project

If you have been following these tutorials, you should now have a fully functional Nginx RTMP server as well as a WordPress site optimized for showing live streams.

We just need to install a few more things and this project will be complete!

The first package we need is wp-cli. This program will allow us to modify our WordPress site from the CLI! Cool!

 user@websvr:~$ wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar 

Check to see if it works by typing

 user@websvr:~$ php wp-cli.phar --info 

If it works, we can make it an executable so you just type “wp” to call it.

user@websvr:~$ chmod +x wp-cli.phar

user@websvr:~$ sudo mv wp-cli.phar /usr/local/bin/wp 

That’s all we have to do to enable wp-cli. Next we need to install xmlstarlet, a utility to parse xml files.

 user@websvr:~$ sudo apt-get install xmlstarlet 

After that installs, we are finished adding software to the server.  Everything else should be included in your distro.

The script we will be using automatically generates .m3u playlist files that will need a directory in the webserver to reside. I like to use an ‘assets’ folder, but you can name it anything you’d like. Make a folder in the www root of your webserver, where WordPress is installed. After we create the folder, we must ‘chown’ it, which means change owner. Change ownership to the user that will be running the script.

 user@websvr:~$ sudo mkdir /var/www/html/assets/

user@websvr:~$ sudo chown user /var/www/html/assets/ 

 

What follows is a custom script that will allow the WordPress site to update based on the status of the nginx RTMP server. It will require some input before you run it, but once its set it can take care of itself.


#!/bin/bash

#MASTER contains a list of registered usernames for the event. To clear it, simply delete the file!
MASTER="rtmp_users.list"

#Enter the path to this script. Follow this syntax. Note the absence of a trailing '/' (ex: /home/user/scripts)
SCRIPT_PATH=
#Enter the path to your WordPress installation. Follow this syntax. Note the absence of a trailing '/' (ex: /var/www/html)
WP_PATH=
#Enter the URL of the Nginx statistics page. (ex: http://10.0.0.241/stats)
NGINX_STATS=
#Enter the path to the HTML assets folder. This is where the server will hold the .m3u files. YOU MUST CHOWN this folder! (ex: /var/www/html/assets)
ASSETS=
#Enter the URL to the assets folder. (ex: http://10.0.0.241/assets)
WEB_ASSETS=
#Enter the RTMP server path. (ex: rtmp://10.0.0.242/live)
RTMP_PATH=
#Optional: Enter the path to a background image for JWPLayer. (ex: http://10.0.0.241/assets/site_logo.png)
IMAGE_PATH=
#Changes directory to the script-path for execution (required for cron)
cd $SCRIPT_PATH
#Creating the master list file.
MASTER="rtmp_users.list"
/bin/touch $MASTER
/bin/touch toadd.list
/bin/rm toadd.list
/bin/touch toadd.list
#Getting the current statistics from the streaming server
wget -O stats.xml $NGINX_STATS
#Parsing the XML file to get all the handles/keys currently streaming. These should correspond with the usernames of the streamers.
xmlstarlet sel -t -m '//name' -v . -n <stats.xml | grep -v live > livestreams.list
#The loop below cycles through the livestreams.list file and compares each line to the current master list. If it doesn't exist, it adds it to the master list. It also adds it to the list of things we need to add to the website.
while read NAME
do
if ! /bin/grep -Fxq $NAME $MASTER; then
echo $NAME >> $MASTER
echo $NAME >> toadd.list
fi
done <livestreams.list
#Getting the existing post titles and ID's from WordPress. These will be compared to the currently active streams.
/usr/local/bin/wp --path=$WP_PATH post list --post_type=page --fields=ID,post_title > $SCRIPT_PATH/id_title.list
#Loop to find names to add. If they don't exist, a new page is created for them. This will display at the top of the menu. It is currently empty at this stage.
while read NEW; do
if ! /bin/grep $NEW id_title.list; then
/usr/local/bin/wp --path=$WP_PATH post create --post_type=page --post_status=publish --post_title=$NEW
fi
done <$MASTER
#The loop below checks to see if the stream is currently live or dead (depends on if its in the livestreams.list file). If its live, it generates a page with the relavent
#stream information customized for the user. If its dead, it will generate a dead page to notify browsers that the user is not currently streaming. This loop will update
# ALL streams in the master_rtmp.list as often as the cronjob is executed.
while read STREAM; do
ID=`/usr/local/bin/wp --path=$WP_PATH post list --post_type=page --fields=ID,post_title | /bin/grep $STREAM | /usr/bin/awk '{print $1}'`
if /bin/grep $STREAM livestreams.list; then
echo $STREAM" is online"
/bin/echo $RTMP_PATH/$STREAM > $ASSETS/$STREAM.m3u
/bin/echo "<html>" >> $STREAM.livetemplate.html
/bin/echo "<head>" >> $STREAM.livetemplate.html
/bin/echo "<script src=http://jwpsrv.com/library/UjjVOi7iEeSiiiIAC0MJiQ.js></script>" >> $STREAM.livetemplate.html
/bin/echo "</head>" >> $STREAM.livetemplate.html
/bin/echo "<body>" >> $STREAM.livetemplate.html
/bin/echo "<div id="$STREAM"></div>" >> $STREAM.livetemplate.html
/bin/echo "<script>// <![CDATA[" >> $STREAM.livetemplate.html
/bin/echo "jwplayer('"$STREAM"').setup({ file: '"$RTMP_PATH/$STREAM"', image: '//"$IMAGE_PATH"', title: '$NEW', width: '100%', aspectratio: '16:9' });" >> $STREAM.livetemplate.html
/bin/echo "// ]]></script>" >> $STREAM.livetemplate.html
/bin/echo $STREAM" is online and streaming as of "`date` >> $STREAM.livetemplate.html
/bin/echo "<a href="$WEB_ASSETS/$STREAM".m3u>VLC LINK</a> (Right Click and Save-as)" >> $STREAM.livetemplate.html
/bin/echo "</body>" >> $STREAM.livetemplate.html
/bin/echo "</html>" >> $STREAM.livetemplate.html
LIVE_HTML=`cat $STREAM.livetemplate.html`
/usr/local/bin/wp --path=$WP_PATH post update $ID --post_content="$LIVE_HTML"
/bin/rm $STREAM.livetemplate.html
else
/bin/echo $STREAM" is offline"
/bin/echo "<html>" >> $STREAM.deadtemplate.html
/bin/echo "<head></head>" >> $STREAM.deadtemplate.html
/bin/echo "<h1>"$STREAM" is not streaming as of "`date`" </h1>" >> $STREAM.deadtemplate.html
/bin/echo "<body>" >> $STREAM.deadtemplate.html
/bin/echo "Page is regenerated every 60 seconds, please check again shortly." >> $STREAM.deadtemplate.html
/bin/echo "If this is your stream and it should be running, please contact an event administrator." >> $STREAM.deadtemplate.html #This string can be modified to meet your requirements.
/bin/echo "</body>" >> $STREAM.deadtemplate.html
/bin/echo "</html>" >> $STREAM.deadtemplate.html
DEAD_HTML=`cat $STREAM.deadtemplate.html`
/usr/local/bin/wp --path=$WP_PATH post update $ID --post_content="$DEAD_HTML"
/bin/rm $STREAM.deadtemplate.html
fi
done <$MASTER
#CLEANUP to remove some temp files that we don't need. These could be converted into arrays at a later point, but it makes it very simple to use files/grep.
/bin/rm stats.xml
/bin/rm id_title.list
/bin/rm livestreams.list
/bin/rm toadd.list
#This last line is useful for logging. If you run this script as a cronjob and send the output to a log file, you will see when the last time the script ran.
/bin/echo "Script finished at" `date` 

Create a folder in the home directory of the user that will be running the script. Inside that folder, create a new file.

 user@websvr:~$ nano nginx_watcher.sh 

Edit the file

Paste the script into this file, and save it. Make the file executable by typing

 user@websvr:~$ chmod +x nginx_watcher.sh 

 

We are almost finished! Start a stream to the Nginx-RTMP server using your streaming software.  Then on the webserver, run the script by typing

 user@websvr:~$ ./nginx_watcher.sh 

If all goes well, there will be no errors reported, and your WordPress site will have a new page set up for the stream. The live video should be playable through JWPlayer, and an m3u file will be available for download. You should also be able to stop the stream, run the script again, and the page will be updated to state the the stream is offline.

The last step is to create a cronjob for this script to run every minute. This will allow users to begin streaming and a page for them will be created no more than 1 minute after.

Type

 user@websvr:~$ crontab -e 

and create a job run every minute. Here’s mine:

 */1 * * * * /home/user/nginx_water/nginx_watcher.sh >> /home/user/nginx_watcher/log/nginx_watcher.log 2>&1 

That will run the script every minute and send the output to a log file.

After that, your Nginx-RTMP/WordPress Frankenstein should be ready to roll!

Screenshots of it working!

Screenshot of the webpage when someone is actively streaming.

Screenshot of the webpage when someone is actively streaming.

Screenshot of the webpage when that same person has stopped streaming.

Screenshot of the webpage when that same person has stopped streaming.

I plan on releasing some prebuilt virtual machines soon for download for those who just want to get something running. THEY’RE HERE!

If you have any questsions, please leave a comment  below. If you have any suggestions for the script, I’d love to hear them. Thanks for reading.

Customizing WordPress for RTMP

If you are following along in this mini-series, you should now have a fully functional nginx based RTMP server capable of receiving and broadcasting live video streams. As cool as that is, its not very user friendly, especially for potential viewers.

In this post we will go over the steps to get a frontend set up for our RTMP server. This will serve as a central hub for our streaming environment. It will host information about how to watch the streams, how to broadcast to the server, as well as some cool statistics. You will need the following.

  • Fully functional WordPress installation – This guide will not cover WordPress installation or configuration. There are dozens of quality guides on the internet for this. Basically you need an Ubuntu server running the LAMP stack.

So, let’s start!

Log into your fully up to date WordPress installation via the web browser. I have found a few customization options that make the website look better for streaming.

  1. Change the theme to “TwentyTwelve”. Its a simple, clean theme that won’t distract viewers.2012
  2. Remove all widgets from the side panel. This will clean up the pages even more. Removing the “meta” widget will remove the “login” link on the side of pages. To login in the future, you will have to go to your WordPress admin URL (ex. 10.0.0.242/wp-admin) .widgets
  3. Create a menu via the Appearance menu. In the menu options, click the checkbox for “Automatically add new top-level pages to this menu”. Also select Primary Menu. This will automatically make our links on the website when the script makes new pages. menu
  4. Create some informational pages for your viewers/streamers to learn about how to use the website to stream/watch streams. Here’s some screenshots of mine.
    How to stream

    A basic how-to guide on streaming to the RTMP server with OBS. This page also includes directions for Xsplit as well.

    statsfor nerds

    A simple iframe within a page that shows the RTMP stats. Not necessary, but its kind of cool 🙂

how to watch

A basic how to watch page with download links for VLC.

Local RTMP server with Website

I am starting a mini-series of posts on how to set up Nginx-RTMP and WordPress to create a local version of Twitch.tv. I will post detailed guides on installing and configuring all software required for this project.

Project requirements are as follows:

  • 1 or 2 Linux computers/VMs. All testing has been done with Ubuntu Server 14.04 64bit.
  • Nginx-RTMP with the stats plugin compiled.
  • A working WordPress installation. (not covered in this series)
  • Various command line utilities that will be covered in depth during the guide.

The end product will be a fully functional streaming server capable of handling 1gbps of video traffic, with a custom WordPress frontend for users to use to access the streams. The entire system is automated and requires minimal user input. A basic use-case is below.

Bob wants to stream his Dota game for the entire LAN party to see. The LAN has a limited bandwidth internet connection, so using a service like Twitch.tv is out of the question. However, the LAN execs have configured a local RTMP solution for him to use.

Bob configures his streaming software like he would normally, except he points his stream to the local RTMP server. He uses his gamer handle (b0b) as a stream key. At this point, Bob’s job is finished. He can start playing his game.

On the backend, a script reads that a new stream has started. It checks to see if this stream has been played before, or if this is a new stream all together. If its new, it adds the stream to the local database and creates a page on the WordPress site dedicated to Bob’s stream.  It then runs through every stream that has been registered to the server during the event. If the stream is active, like Bob’s, it updates the page with a JWPlayer configured specifically for Bob’s stream. It also generates an .m3u file with a playlist entry pointing towards Bob’s stream mount point.  Viewers can just navigate to Bob’s page on the WordPress site and start watching from within their web browser.

If some of the previously registered streams are offline, it updates their page with an offline message telling users to check back soon. By using this process, every single page is updated every 60 seconds via a cronjob.

So that’s a basic overview of what this setup can do.  It can listen for, create, and distribute live RTMP streams to viewers automatically and painlessly. And because all traffic is local, no internet bandwidth is wasted for redundant connections to websites like Twitch.tv or hitbox.

I will be making many more posts about how to set this up for your own event, so stay tuned. If you have any questions or comments, please leave a message below.

Part 1 – Install nginx rtmp tutorial here!

Part 2 – Customize WordPress tutorial here!

Part 3 – Finishing the RTMP WordPress Project here!

Part 4 – Virtual Machine Download here!

Install Mcmyadmin on Ubuntu 14.04 Server

I followed this guide: https://www.digitalocean.com/community/questions/how-to-install-mcmyadmin-and-start-it-up-for-the-first-time-not-a-question-a-howto-guide

It worked great until the end. Upon running the script, SSH session would get flooded with errors. At first it appeared that they were Java errors, but upon further inspection it appeared to be related to my SSH session itself. I was using SecureCRT, and by default some of the color codes from the Linux terminal are not enabled. Here is the error I was getting.

Running in 64-bit mode.
McMyAdmin Core Exception: Argument cannot be null.
Parameter name: format
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Argument cannot be null.
Parameter name: format
at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0
at System.String.Format (System.String format, System.Object arg0) [0x00000] in <filename unknown>:0
at System.TermInfoDriver.set_ForegroundColor (ConsoleColor value) [0x00000] in <filename unknown>:0
at System.ConsoleDriver.set_ForegroundColor (ConsoleColor value) [0x00000] in <filename unknown>:0
at System.Console.set_ForegroundColor (ConsoleColor value) [0x00000] in <filename unknown>:0
at nu.a (a A_0) [0x00000] in <filename unknown>:0
at nu.a () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0

 

As you can see, its all talking about colors. Mcmyadmin attempts to mirror Powershell in its color scheme, and that includes changing the background color to blue. For whatever reason SecureCRT doesn’t allow for this to happen, and the result is a bunch of errors. By switching to Putty, I was able to get the server up without an issue. I’ll include some screenshots below to show what I am talking about.

securecrt
SecureCRT throwing an error while connected.

putty
Putty working fine. Notice the blue background.

I hope this post helps anybody having issues with this problem. I couldn’t find anything online that helped. Comment below if you have questions.

Open source Craigslist clone

logo

A few days ago I had the urge to start a new project aimed at college students. I recall hearing someone say that they wished there was a place for them to find people to “hook-up” with on campus. That got me thinking about Craigslist, but with a twist. Instead of the site being devoted to a geographical location such as a city, my site would be targeted at a specific campus. Once I got the initial idea I had to find some software to implement (why reinvent the wheel?). I tried a few different “Craigslist clone scripts” and the like, but none of them offered what I was looking for. I needed the site to be simple and clean, but also easily manageable. After searching for a few hours I came across OSClass.

If WordPress’ admin UI is a 8/10 in terms of look and functionality, OSClass’ would be a 9 or 10. It is simply fantastic.You can control everything from the easy to use control panel that is very intuitive. So far I haven’t done much more work with the idea, and probably never will. But I was able to tinker around with some cool software, and maybe one day I will implement it for my campus. All I would need to do at this point is buy a domain name (I don’t feel like using a subdomain of willstare.com) and away I will go. I don’t know how much demand there would be for such a site, but people usually have a way of finding innovative uses for things given the opportunity to use it.

So go check out OSClass, you will be very impressed.

osclass front
Main page of my OSClass site.

management 1 osclass
Main dashboard page in the admin panel.

oc class statistics
Some statistics and graphs about the site.

VolumeDrive.com VPS

I just wanted to make a quick plug for my hosting provider, VolumeDrive. There are a lot of positive/negative reviews out there in regards to VolumeDrive, and I thought I would share my experience with them.

I help run a pretty large gaming clan, and when I  first joined, they were using a volumdrive dedicated server. It had 16gb of ram, 8 threads, etc. It was great, and cheap. However, there was an occasional network drop here and there, and we decided to move to a more stable (and expensive!) company for our vital services. I noticed that VD also provided VPS solutions, so I decided to pick one up for a month (only $5) and see how I liked it. It was quickly provisioned, and I began to mess around with it (I chose Ubuntu Server for my OS). I realized that I could do a lot of cool things with this server, and purchased a hostname and got started.

That was about 7 months ago, and I am still very glad that I made the decision to stay with VD. Their network hasn’t been a problem for me at all, and I have had many services running on my server. The only problem I have had is that the VPS reboots regularly, perhaps once every 7-15 days. This isn’t a deal breaker, as it just requires some cron-jobs to keep things running. Other than that, I really can’t complain about it. I have been pushing a lot of data through it , and it is holding up quite well. I would recommend VD VPS’s to anybody wishing to play around with a server with a big fat network connection.

My VPS Specs:
2ghz processor
1GB ram
50GB HDD
100mbps network connection (2000gb/month)
$5 / month 
Check out http://volumedrive.com/vdrive/?a=vps  for more information on the VPS solutions provided by VolumeDrive.

*I have not received any compensation for this blog post, I just really like the company*

How to configure a shoutcast relay server in ubuntu

So you want to relay your favorite shoutcast stream with your ubuntu VPS, but don’t know where to start? Here’s a quick guide to relaying DNAS v1.9.8 shoutcast server streams.

Step 1: Download the sc_serv_1.9.8 file from this thread, or from another website (afterdawn, shoutcast.com, etc)

sc_serv_1.9.8_Linux.tar.gz

Step 2: Unzip the .zip and .tar, and FTP them to your server. I use /var/shoutcast for my folder root, but that might not be the most secure. You could use /home/shoutcast or anything really.

Step 3: If you are going to run the server as root (not recommended) you can skip this. Otherwise, make an account (ex. shoutcast) and place the files into a folder in their home.

Step 4: Edit the sc_serv.conf using nano or vi. Edit any and all settings that you find fit. Here is what I have mine set as.

[spoiler]

; SHOUTcast Distributed Network Audio Server configuration file
; Copyright (C) 1998-2004 Nullsoft, Inc.
; All Rights Reserved.
; Last modified Mar 17 2004

; If you want to manage multiple configurations, just copy
; this file to another name, and run sc_serv with that name
; such as:
; sc_serv.exe sc_leet.conf

; ***************************
; Required stuff
; ***************************

; MaxUser.  The maximum number of simultaneous listeners allowed.
; Compute a reasonable value for your available upstream bandwidth (i.e. if
; you have 256kbps upload DSL, and want to broadcast at 24kbps, you would
; choose 256kbps/24kbps=10 maximum listeners.)  Setting this value higher
; only wastes RAM and screws up your broadcast when more people connect
; than you can support.
MaxUser=100

; Password.  While SHOUTcast never asks a listener for a password, a
; password is required to broadcast through the server, and to perform
; administration via the web interface to this server.  This server should
; consist of only letters and numbers, and is the same server your broadcaster
; will need to enter in the SHOUTcast Source Plug-in for Winamp.  THIS VALUE
; CANNOT BE BLANK.
Password=************

; PortBase. This is the IP port number your server will run on.  The
; value, and the value + 1 must be available.  If you get a fatal error when
; the DNAS is setting up a socket on startup, make sure nothing else on the
; machine is running on the same port (telnet localhost portnumber — if you
; get connection refused then you’re clear to use that port).  Ports < 1024
; may require root privledges on *nix machines.  The default port is 8000.
PortBase=8100

; ***************************
; Optional Parameters
; ***************************

; ***************************
; Logging configuration
; ***************************

; LogFile: file to use for logging. Can be ‘/dev/null’ or ‘none’
; or empty to turn off logging. The default is ./sc_serv.log
; on *nix systems or sc_serv_dir\sc_serv.log on win32.
; Note: on win32 systems if no path is specified the location is
; in the same dir as the executable, on *nix systems it is in the
; current directory.
LogFile=sc_serv.log

; RealTime displays a status line that is updated every second
; with the latest information on the current stream (*nix and win32
; console systems only)
RealTime=1

; ScreenLog controls whether logging is printed to the screen or not
; on *nix and win32 console systems. It is useful to disable this when
; running servers in background without their own terminals. Default is 1
ScreenLog=1

; ShowLastSongs specifies how many songs to list in the /played.html
; page.  The default is 10.  Acceptable entries are 1 to 20.
ShowLastSongs=10

; TchLog decides whether or not the DNAS logfile should track yp
; directory touches.  Adds and removes still appear regardless of
; this setting.
; Default is yes
; TchLog=yes

; WebLog decides whether or not hits to http:// on this DNAS will
; be logged.  Most people leave this off because the DSP plug-in
; uses http:// calls to update titles and get the listener count,
; which takes up a lot of log space eventually.  If you want to
; see people making hits on your admin.cgi or index pages, turn
; this back on.  Note that this setting does NOT affect XML stats
; counters for hits to http:// pages.
; Default is no.
; WebLog=no

; W3CEnable turns on W3C Logging.  W3C logs contain httpd-like accounts
; of every track played for every listener, including byte counts those listeners
; took.  This data can be parsed with tools like Analog and WebTrends, or given
; to third parties like Arbitron and Measurecast for their reporting systems.
; Default is Yes (enabled).
W3CEnable=Yes

; W3CLog describes the name of the logfile for W3C logging.  Default logfile is
; sc_w3c.log, in the same directory wherever the DNAS gets started from.
W3CLog=sc_w3c.log

; ***************************
; Network configuration
; ***************************

; SrcIP, the interface to listen for source connections on (or to make relay
; connections on if relaying). Can and usually will be ANY or 127.0.0.1
; (Making it 127.0.0.1 will keep other machines from being able to
; broadcast using your shoutcast server )
SrcIP=ANY

; DestIP, IP to listen for clients on (and to contact yp.shoutcast.com)
; can and usually will be be ANY. If your machine has multiple IP addresses,
; set this to the one you want it to be accessed by.
DestIP=ANY

; Yport, port to connect to yp.shoutcast.com on. For people behind caching
; webproxies, change this to the alternate port (666 is what it might be,
; check www.shoutcast.com if you have problems). Otherwise, leave this at 80.
; We’re actively working on re-opening port 666, but as of release the only
; working port is port 80.
Yport=80

; NameLookups.  Specify 1 to perform reverse DNS on connections.
; This option may increase the time it takes to connect to your
; server if your DNS server is slow.  Default is 0 (off).
NameLookups=0

; RelayPort and RelayServer specify that you want to be a relay server.
; Relay servers act as clients to another server, and rebroadcast.
; Set RelayPort to 0, RelayServer to empty, or just leave these commented
; out to disable relay mode.
RelayPort=8000
RelayServer=stream1.yourfavoritestream.com

; ***************************
; Server configuration
; ***************************

; AdminPassword.  This password (if specified) changes the
; behavior of Password to be a broadcast-only password, and
; limits HTTP administration tasks to the password specified
; here.  The broadcaster, with the password above, can still
; log in and view connected users, but only the AdminPassword
; will grant the right to kick, ban, and specify reserve hosts.
; The default is undefined (Password allows control for both
; source and admin)
; AdminPassword=************

; AutoDumpUsers controls whether listeners are disconnected if the source
; stream disconnects. The default is 0.
AutoDumpUsers=0

; AutoDumpSourceTime specifies how long, in seconds, the source stream is
; allowed to be idle before the server disconnects it. 0 will let the source
; stream idle indefinately before disconnecting. The default is 30.
AutoDumpSourceTime=30

; ContentDir specifies the directory location on disk of where to stream
; on-demand content from.  Subdirectories are supported as of DNAS 1.8.2.
; Default is ./content, meaning a directory named content in the same directory
; as where sc_serv was invoked from.
; ContentDir=./content

; IntroFile can specify a mp3 file that will be streamed to listeners right
; when they connect before they hear the live stream.
; Note that the intro file MUST be the same samplerate/channels as the
; live stream in order for this to work properly. Although bitrate CAN
; vary, you can use ‘%d’ to specify the bitrate in the filename
; (i.e. C:\intro%d.mp3 would be C:\intro64.mp3 if you are casting at 64kbps).
; The default is no IntroFile
; IntroFile=c:\intro%d.mp3

; BackupFile can specify a mp3 file that will be streamed to listeners over
; and over again when the source stream disconnects. AutoDumpUsers must be
; 0 to use this feature. When the source stream reconnects, the listeners
; are rejoined into the live broadcast.
; Note that the backup file MUST be the same samplerate/channels as the
; live stream in order for this to work properly. Although bitrate CAN
; vary, you can use ‘%d’ to specify the bitrate in the filename
; (i.e. C:\backup%d.mp3 would be C:\backup32.mp3 if you are casting at 32kbps).
; The default is no BackupFile
; BackupFile=C:\intro%d.mp3

; TitleFormat specifies a format string for what title is sent to the listener.
; For example, a string of ‘Justin Radio’ forces the title ‘Justin Radio’ even
; when the source changes the title. You can use up to one ‘%s’ in the string
; which lets you contain the title from the source. For example, if your
; TitleFormat is ‘Justin Radio: %s’, and the source plug-in’s title is
; ‘Billy plays the blues’, then the net title is
; ‘Justin Radio: Billy plays the blues’. Note: only works on non-relay servers.
; The default is no format string.
; TitleFormat=Justin Radio: %s

; URLFormat specifies a format string for what url is sent to the listener.
; Behaves like TitleFormat (see above).
; The default is no format string.
; URLFormat=http://www.server.com/redirect.cgi?url=%s

; PublicServer can be always, never, or default (the default, heh)
; Any setting other than default will override the public status
; of the source plug-in or of a SHOUTcast server that is being relayed.
PublicServer=default

; AllowRelay determines whether or not other SHOUTcast servers will be
; permitted to relay this server.  The default is Yes.
AllowRelay=Yes

; AllowPublicRelay, when set to No, will tell any relaying servers not
; to list the server in the SHOUTcast directory (non-public), provided
; the relaying server’s Public flag is set to default.  The default is
; Yes.
AllowPublicRelay=Yes

; MetaInterval specifies how often, in bytes, metadata sent.
; You should really leave this at the default of 8192, but the option is
; provided anyway.
MetaInterval=32768

[/spoiler]

The main things that I changed were maxlisteners (set to 100), the passwords, and the relay information.

For the relay, you need the port of the stream, as well as the address. To find this information you must open the listen.pls and find the data in there.

*If you are going to run more than 1 server at a time, you will need to change the portbase. I run my streams at 8100 and 8200.

Step 5:

Now that you have configured your server, ssh in and cd to the appropriate folder. To start the server type

./sc_serv sc_serv.conf

It will now start!

If all goes well, the server will pick up the stream, and start relaying. Shoucast will do some magic, and you will soon be taking some of the load off of the main stream and onto yours. Contact the stream owner ahead of time so you can coordinate reserved slots in their streams.

If you have any questions, please leave them below. Remember, this only works with version 1.9.8!