Icecast on the NSLU2

(19 Oct 2007) I needed an Icecast server to fool around with LiquidSoap (I'd been annoying the Hak5Radio listeners for weeks) and I knew that OpenWRT has a package available so I decided to repurpose one of the NSLU2's. Following are my notes from the install:

1) Install OpenWRT on the NSLU2 as I did here. (Don't forget to run "ipkg update")

2) Install Icecast by running "ipkg install icecast" on the command line. The output should look something like:

 root@OpenWrt:~# ipkg install icecast
 Installing icecast (2.3.0-1) to root...
 Downloading http://downloads.openwrt.org/kamikaze/packages/armeb/./icecast_2.3.0-1_armeb.ipk
 Installing libcurl (7.14.0-1) to root...
 Downloading http://downloads.openwrt.org/kamikaze/packages/armeb/./libcurl_7.14.0-1_armeb.ipk
 Installing libopenssl (0.9.8e-1) to root...
 Downloading http://ipkg.nslu2-linux.org/feeds/openwrt/kamikaze-7.07/./libopenssl_0.9.8e-1_armeb.ipk
 Installing zlib (1.2.3-3) to root...
 Downloading http://ipkg.nslu2-linux.org/feeds/openwrt/kamikaze-7.07/./zlib_1.2.3-3_armeb.ipk
 Installing libvorbisidec (1.2.0-dave-1) to root...
 Downloading http://downloads.openwrt.org/kamikaze/packages/armeb/./libvorbisidec_1.2.0-dave-1_armeb.ipk
 Installing libxml2 (2.6.20-1) to root...
 Downloading http://downloads.openwrt.org/kamikaze/packages/armeb/./libxml2_2.6.20-1_armeb.ipk
 Installing libpthread (0.9.28-9) to root...
 Downloading http://ipkg.nslu2-linux.org/feeds/openwrt/kamikaze-7.07/./libpthread_0.9.28-9_armeb.ipk
 Installing libxslt (1.1.14-1) to root...
 Downloading http://downloads.openwrt.org/kamikaze/packages/armeb/./libxslt_1.1.14-1_armeb.ipk
 Configuring icecast
 Configuring libcurl
 Configuring libopenssl
 Configuring libpthread
 Configuring libvorbisidec
 Configuring libxml2
 Configuring libxslt
 Configuring zlib
 Done.

3) Create the log directory via "mkdir -p /var/log/icecast"

4) Create the logs via "touch /var/log/icecast/access.log" and "touch /var/log/icecast/error.log"

5) Set ownership on those files via "chown nobody:nogroup /var/log/icecast/*.log"

6) Time to mess with the config file (/etc/icecast.xml). This site explains the config entries in detail.

7) Note: the default setting in icecast generates large amounts of log entries. You will want to change "loglevel" in /etc/icecast.xml from a 4 to a 1.

8) Here's a copy of my icecast.xml file (I've removed all of the comment clutter). This will basically relay anything pushed at from SAM Broadcaster, IDJC, LiquidSoap, or the like.

 <icecast>
    <limits>
        <clients>100</clients>
        <sources>2</sources>
        <threadpool>5</threadpool>
        <queue-size>524288</queue-size>
        <client-timeout>30</client-timeout>
        <header-timeout>15</header-timeout>
        <source-timeout>10</source-timeout>
        <burst-on-connect>1</burst-on-connect>
        <burst-size>65535</burst-size>
    </limits>
    <authentication>
        <source-password>hackme</source-password>
        <relay-password>hackme</relay-password>
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>
    <hostname>localhost</hostname>
    <listen-socket>
        <port>8000</port>
    </listen-socket>
    <relay>
        <server>127.0.0.1</server>
        <port>8001</port>
        <mount>/stream2.mp3</mount>
        <local-mount>/different.ogg</local-mount>
        <on-demand>0</on-demand>
        <relay-shoutcast-metadata>0</relay-shoutcast-metadata>
    </relay>
    <paths>
        <basedir>/usr/share/icecast</basedir>
        <logdir>/var/log/icecast</logdir>
        <webroot>/usr/share/icecast/web</webroot>
        <adminroot>/usr/share/icecast/admin</adminroot>
        <alias source="/" dest="/status.xsl"/>
    </paths>
    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
        <loglevel>1</loglevel>
    </logging>
    <security>
        <chroot>0</chroot>
        <changeowner>
            <user>nobody</user>
            <group>nogroup</group>
        </changeowner>
    </security>
 </icecast>

One issue to note at this point, unless you cross-compile code for something like OpenSLUG, to run Icecast on the NSLU2, you're going to run OpenWRT on the NSLU2. OpenWRT is primarily written for devices that you leave on all the time (i.e., routers). There's not a whole lot of polish to it and there's a few idiocyncracies, the most annoying of which is YOU CAN'T TURN THE DANG THING OFF! Neither via software nor the button on the front. (For me, it's enough of an annoyance to learn cross-compiling.)

Just for giggles, here a screenshot of the NSLU2's CPU usage with Icecast running. Note: The difference between Icecast and no Icecast is not noticeable.

Attach:openwrticecast.jpg Δ

Attach:icecastbrowser.jpg Δ