Installing Icecast 2 on DreamHost VPS

Weather Underground Radio Streams

Weather Underground provided a free service to host all of these streams so you could listen into important weather bulletins over the Internet. Weather Underground was purchased by the Weather.com parent company The Weather Company in 2012 and then IBM purchased The Weather Company in 2016. Weather Underground moved all of their services over to Amazon Web Services and canned a few legacy products including the NOAA Weather Radio streams.

For years I’ve been streaming our local NOAA Weather Radio station, KEC60, over the Internet to Weather Underground. I was extremely disappointed when the weather radio service was cut off with no notice to the listeners or the people graciously providing the audio source stream to share. Uploading the audio stream from my home doesn’t use a ton of bandwidth but letting 50-100 people listen during peak times wouldn’t be practical. I have a web server running in DreamHost’s VPS cloud so why not use that and host my own streams?

DreamHost VPS

DreamHost VPS (virtual private server) is an inexpensive high-performance web hosting solution that lets you dial up and down the resources you need to run your sites. I moved over to their VPS service after having hosted a Mac mini in a local data center for years. I couldn’t beat the cost difference and DreamHost VPS is managed meaning they install security updates and mitigate any attacks on the server.

In the recent past DreamHost has removed one feature I specifically moved over to them for: having root access on your server instance. The rationale behind that change is their team needs the ability to maintain the server, install patches, inspect traffic, and do whatever other voodoo is necessary that falls under a “managed” server. The upside is I don’t have to worry about much with the server. The downside is I can’t install software on the server for all users using Aptitude, the Ubuntu system software package manager.

I need to install the streaming audio/video server Icecast 2 to be able to host my own weather radio stream for Milwaukee. Not being able to use Aptitude on my VPS instance makes this more difficult, but not impossible. The process isn’t straightforward and can be very daunting if you’ve never compiled software before on a Linux machine via the command line. I’ve documented my experience here in case you’re interested in doing something similar.

Installation

You don’t have root access on DreamHost VPS so you can’t install Icecast using apt-get. There are ways to download the apt-get packages and manually install but that has its own drawbacks and breakages. I opted to download the source code for Icecast, compile it, and install in the user directory of the site I’m hosting the stream on. By installing in the user directory I require no system-level permissions whatsoever to run Icecast.

The basic steps are:

  1. Download the source code for Icecast and a few related dependencies (libxslt, libogg, and libvorbis).
  2. Configure, compile, and install the three dependencies.
  3. Configure, compile and install Icecast.
  4. Set up the Icecast configuration.
  5. Launch Icecast.
  6. Configure Icecast to launch on startup.

Preconditions

I’m making the assumption you have a basic understanding of Linux command line operations, SSH, and how to use DreamHost’s control panel. You’ll need the following things completed before starting the process I’ve detailed:

  • Purchase a DreamHost VPS instance and have it running. (sometimes you need to be explicit with a tutorial 😝)
  • Create a shell user for your Icecast install. I suggest a separate account with DreamHost’s “Enhanced Security” turned on. This is just in case Icecast introduces any security vulnerabilities to your server and limits the access the process has to your system.
  • My VPS is using Ubuntu 12.04.5 LTS at the time of this post. At one time I did have root access on my machine and may have installed other dependencies that your instance may not have. Feel free to comment on this post if you need help installing those as well.
  • The tutorial starts with the assumption you’re logged into your account via SSH and sitting at the ~/ (home) folder location.
  • I use Bash for my shell. Other shells like Zsh should be fine but you’ll need to adjust where you edit your path.
  • The source file URLs may change and will probably be outdated shortly after I write this post. I suggest you visit the project home pages for the most recent versions when doing this yourself. You’ll also want to occasionally update Icecast as time passes to make sure you patch any security issues. This is the downfall of not being able to use Aptitude or a similar package manager.

Please note: DreamHost currently has “unlimited” bandwidth for VPS customers. This could change in the future and understand that streaming audio and video could consume a ton of bandwidth.

Download Sources

  1. Create a temporary folder:
    mkdir tmp
    cd tmp
  2. Download the source files for Icecast and the dependencies.
    wget http://downloads.xiph.org/releases/icecast/icecast-2.4.3.tar.gz
    wget https://git.gnome.org/browse/libxslt/snapshot/libxslt-1.1.29.zip
    wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.zip
    wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.zip
  3. Unpack each of those downloads.
    tar xvfz *.tar.gz
    unzip *.zip

Compile All the Things

First create the usr (pronounced user) folder and add it to your path.

cd ~/
mkdir -p usr/bin
mkdir -p usr/var/log/icecast
echo 'PATH=$PATH:~/usr/bin' >> ~/.bash_profile
. ~/.bash_profile

The last command re-executes the login script so your path is updated right away.

In the following commands replace “/home/username” with the actual path of the folder you want to install everything into. In most cases you’ll just replace username with the username of the account you created.

cd ~/tmp/libxslt-1.1.29/
./autogen.sh --prefix=/home/username/usr
make install

cd ../libogg-1.3.2/
./configure --prefix=/home/username/usr
make install

cd ../libvorbis-1.3.5/
./configure --prefix=/home/username/usr
make install

cd ../icecast-2.4.3/
./configure --prefix=/home/username/usr
make install

The Autogen & Configure scripts will scan your system for dependencies and set up the configuration file that Make uses to do the actual compilation. Configure will bark if your system is missing anything important that you’ll need to additionally compile.

Configure Icecast

If everything went well you should have a fresh new Icecast installed as ~/usr/bin/icecast and a default configuration file at ~/usr/etc/icecast.xml.

I’m not going to go into too much depth on how to configure Icecast. There is a good amount of documentation on the Icecast website detailing how to get the service up and running.

At a minimum you want to replace all of the default passwords in the configuration file with something other than “hackme”.

Launch Icecast

Go ahead and launch Icecast.

cd ~/
icecast -c usr/etc/icecast.xml

This launches Icecast in interactive mode. If you exit your SSH session, Icecast shuts down. Verify that you can connect to Icecast by visiting:

http://yourserver.dreamhostps.com:8000

Change the hostname to match yours and the port number if you changed the default one in the configuration file. If everything went right you should see an Icecast status page. If you get any errors double check you launched the service properly and that you specified the server hostname correctly.

When you’re done, hit Control+C to kill Icecast. When you’re ready to keep Icecast running long-term, re-launch with -b at the end to background the process:

icecast -c usr/etc/icecast.xml -b

Launch on Startup

The last step to setting up Icecast on a DreamHost VPS is to configure it to launch when your server is rebooted. The easiest option is to use the Cron Jobs control panel provided by DreamHost.

  1. Open the Cron Jobs page in your DreamHost control panel.
  2. Click the Add New Cron Job button.
  3. Select the user you created and installed Icecast into.
  4. Enter a Title that is helpful like Icecast.
  5. Enter an e-mail address if you want log files sent to you. I left this blank.
  6. Enter the following in Command to Run (updating the path with your actual install path for Icecast):
    /home/username/usr/bin/icecast -c /home/username/usr/etc/icecast.xml -b

    The full paths are required so Cron knows exactly where Icecast is. The -b switch puts Icecast into the background.

  7. Make sure Use locking is turned on.
  8. Set When to run to Server Reboot.
  9. Click Add.

Questions?

Let me know if you have any questions in the comments on this post! I’ll probably do a follow-up post with the actual setup I’m using for streaming Weather Radio.

Check out the Milwaukee NOAA Weather Radio stream for KEC60 here:

http://milwaukeeweather.audio

Featured image courtesy of cogdog on Flickr.

IBM buying Weather Underground

IBM announced earlier this week that they’re buying the Weather Channel’s business to business, mobile, and cloud-based properties. One of these is my favorite place to find weather forecasts – Weather Underground.

I’ve been a user of Weather Underground and also uploading my house’s weather station data to the site for over 13 years. I’m not sure what this news ultimately means for WU. NBC dumped money into the site a while back and modernized the user experience – although I’m not sure how much usefulness was added. I’m hoping that IBM buying the properties means a continued interest in open and crowd-sourced weather data source.

I’d hate to think me uploading data is only helping IBM play the stock market better and not the general public with prediction improvements.

Live Storm Chasing App

Enjoy chasing storms from your couch like me?  There’s a great app called “TVNweather Live Storm Chasing” that I’ve been using to watch live streams from actual storm chasers out in the field.  You’ll see names like Reed Timmer (TornadoVideos.net) and the team running the Dominator 2.

TVNweather Live Storm Chasing for iOS

The app itself needs some work with stability, but the collection of active streams is incredibly handy and fun to watch.  An Android version is coming soon as well.  Until then you can also watch on their site at http://tvnweather.com/live.